1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.chemistry.opencmis.commons.spi;
20
21 import java.io.Serializable;
22 import java.util.List;
23 import java.util.Map;
24
25 import org.w3c.dom.Element;
26
27 /**
28 * Authentication provider interface.
29 */
30 public interface AuthenticationProvider extends Serializable {
31 /**
32 * Returns a set of HTTP headers (key-value pairs) that should be added to a
33 * HTTP call. This will be called by the AtomPub and the Web Services
34 * binding. You might want to check the binding in use before you set the
35 * headers.
36 *
37 * @param url
38 * the URL of the HTTP call
39 *
40 * @return the HTTP headers or <code>null</code> if no additional headers
41 * should be set
42 */
43 Map<String, List<String>> getHTTPHeaders(String url);
44
45 /**
46 * Returns a SOAP header that should be added to a Web Services call.
47 *
48 * @param portObject
49 * the port object
50 *
51 * @return the SOAP headers or <code>null</code> if no additional headers
52 * should be set
53 */
54 Element getSOAPHeaders(Object portObject);
55
56 /**
57 * Receives the HTTP headers after a call.
58 *
59 * @param url
60 * the URL
61 * @param statusCode
62 * the status code
63 * @param headers
64 * the HTTP headers
65 */
66 void putResponseHeaders(String url, int statusCode, Map<String, List<String>> headers);
67 }