This project has retired. For details please refer to its
Attic page.
AbstractAuthenticationProvider xref
1/*2 * Licensed to the Apache Software Foundation (ASF) under one3 * or more contributor license agreements. See the NOTICE file4 * distributed with this work for additional information5 * regarding copyright ownership. The ASF licenses this file6 * to you under the Apache License, Version 2.0 (the7 * "License"); you may not use this file except in compliance8 * with the License. You may obtain a copy of the License at9 *10 * http://www.apache.org/licenses/LICENSE-2.011 *12 * Unless required by applicable law or agreed to in writing,13 * software distributed under the License is distributed on an14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY15 * KIND, either express or implied. See the License for the16 * specific language governing permissions and limitations17 * under the License.18 */19package org.apache.chemistry.opencmis.client.bindings.spi;
2021import java.util.List;
22import java.util.Map;
2324import org.apache.chemistry.opencmis.commons.SessionParameter;
25import org.w3c.dom.Element;
2627/**28 * Authentication provider class.29 */30publicabstractclassAbstractAuthenticationProvider implements SessionAwareAuthenticationProvider {
3132privatestaticfinallong serialVersionUID = 1L;
3334privateBindingSession session;
3536/**37 * Sets the {@link BindingSession} the authentication provider lives in.38 */39publicvoid setSession(BindingSession session) {
40this.session = session;
41 }
4243/**44 * Returns {@link BindingSession}.45 */46publicBindingSession getSession() {
47return session;
48 }
4950public Map<String, List<String>> getHTTPHeaders(String url) {
51returnnull;
52 }
5354public Element getSOAPHeaders(Object portObject) {
55returnnull;
56 }
5758publicvoid putResponseHeaders(String url, int statusCode, Map<String, List<String>> headers) {
59 }
6061/**62 * Gets the user name from the session.63 * 64 * @return the user name or <code>null</code> if the user name is not set65 */66protected String getUser() {
67 Object userObject = getSession().get(SessionParameter.USER);
68if (userObject instanceof String) {
69return (String) userObject;
70 }
7172returnnull;
73 }
7475/**76 * Gets the password from the session.77 * 78 * @return the password or <code>null</code> if the password is not set79 */80protected String getPassword() {
81 Object passwordObject = getSession().get(SessionParameter.PASSWORD);
82if (passwordObject instanceof String) {
83return (String) passwordObject;
84 }
8586returnnull;
87 }
8889/**90 * Gets the proxy user name from the session.91 * 92 * @return the proxy user name or <code>null</code> if the user name is not93 * set94 */95protected String getProxyUser() {
96 Object userObject = getSession().get(SessionParameter.PROXY_USER);
97if (userObject instanceof String) {
98return (String) userObject;
99 }
100101returnnull;
102 }
103104/**105 * Gets the proxy password from the session.106 * 107 * @return the proxy password or <code>null</code> if the password is not108 * set109 */110protected String getProxyPassword() {
111 Object passwordObject = getSession().get(SessionParameter.PROXY_PASSWORD);
112if (passwordObject instanceof String) {
113return (String) passwordObject;
114 }
115116returnnull;
117 }
118 }