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 javax.net.ssl.HostnameVerifier;
26 import javax.net.ssl.SSLSocketFactory;
27 import org.apache.chemistry.opencmis.client.bindings.spi.HandlerResolver;
28
29 import org.w3c.dom.Element;
30
31 /**
32 * Authentication provider interface.
33 */
34 public interface AuthenticationProvider extends Serializable {
35 /**
36 * Returns a set of HTTP headers (key-value pairs) that should be added to a
37 * HTTP call. This will be called by the AtomPub and the Web Services
38 * binding. You might want to check the binding in use before you set the
39 * headers.
40 *
41 * @param url
42 * the URL of the HTTP call
43 *
44 * @return the HTTP headers or {@code null} if no additional headers
45 * should be set
46 */
47 Map<String, List<String>> getHTTPHeaders(String url);
48
49 /**
50 * Returns a SOAP header that should be added to a Web Services call.
51 *
52 * @param portObject
53 * the port object
54 *
55 * @return the SOAP headers or {@code null} if no additional headers
56 * should be set
57 */
58 Element getSOAPHeaders(Object portObject);
59
60 /**
61 * Returns a {@link HandlerResolver} object that provides a list of SOAP
62 * handlers.
63 *
64 * @return the HandlerResolver or {@code null} if no handlers should be
65 * set
66 */
67 HandlerResolver getHandlerResolver();
68
69 /**
70 * Returns the SSL Socket Factory to be used when creating sockets for HTTPS
71 * connections.
72 *
73 * @return a {@link SSLSocketFactory} or {@code null}
74 */
75 SSLSocketFactory getSSLSocketFactory();
76
77 /**
78 * Returns the Hostname Verifier for HTTPS connections.
79 *
80 * @return a {@link HostnameVerifier} or {@code null}
81 */
82 HostnameVerifier getHostnameVerifier();
83
84 /**
85 * Receives the HTTP headers after a call.
86 *
87 * @param url
88 * the URL
89 * @param statusCode
90 * the status code
91 * @param headers
92 * the HTTP headers
93 */
94 void putResponseHeaders(String url, int statusCode, Map<String, List<String>> headers);
95 }