org.apache.chemistry.opencmis.client.bindings.spi
Class StandardAuthenticationProvider

java.lang.Object
  extended by org.apache.chemistry.opencmis.client.bindings.spi.AbstractAuthenticationProvider
      extended by org.apache.chemistry.opencmis.client.bindings.spi.StandardAuthenticationProvider
All Implemented Interfaces:
java.io.Serializable, SessionAwareAuthenticationProvider, AuthenticationProvider

public class StandardAuthenticationProvider
extends AbstractAuthenticationProvider

Standard authentication provider class. Adds a basic authentication HTTP header and a WS-Security UsernameToken SOAP header.

See Also:
Serialized Form

Constructor Summary
StandardAuthenticationProvider()
           
 
Method Summary
protected  java.util.List<java.lang.String> createBasicAuthHeaderValue(java.lang.String username, java.lang.String password)
          Creates a basic authentication header value from a username and a password.
 java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHTTPHeaders(java.lang.String url)
          Returns a set of HTTP headers (key-value pairs) that should be added to a HTTP call.
 org.w3c.dom.Element getSOAPHeaders(java.lang.Object portObject)
          Returns a SOAP header that should be added to a Web Services call.
protected  boolean isTrue(java.lang.String parameterName)
          Returns true if the given parameter exists in the session and is set to true, false otherwise.
 void putResponseHeaders(java.lang.String url, int statusCode, java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)
          Receives the HTTP headers after a call.
 void setSession(BindingSession session)
          Sets the BindingSession the authentication provider lives in.
 
Methods inherited from class org.apache.chemistry.opencmis.client.bindings.spi.AbstractAuthenticationProvider
getPassword, getProxyPassword, getProxyUser, getSession, getUser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardAuthenticationProvider

public StandardAuthenticationProvider()
Method Detail

setSession

public void setSession(BindingSession session)
Description copied from class: AbstractAuthenticationProvider
Sets the BindingSession the authentication provider lives in.

Specified by:
setSession in interface SessionAwareAuthenticationProvider
Overrides:
setSession in class AbstractAuthenticationProvider

getHTTPHeaders

public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHTTPHeaders(java.lang.String url)
Description copied from interface: AuthenticationProvider
Returns a set of HTTP headers (key-value pairs) that should be added to a HTTP call. This will be called by the AtomPub and the Web Services binding. You might want to check the binding in use before you set the headers.

Specified by:
getHTTPHeaders in interface AuthenticationProvider
Overrides:
getHTTPHeaders in class AbstractAuthenticationProvider
Parameters:
url - the URL of the HTTP call
Returns:
the HTTP headers or null if no additional headers should be set

putResponseHeaders

public void putResponseHeaders(java.lang.String url,
                               int statusCode,
                               java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)
Description copied from interface: AuthenticationProvider
Receives the HTTP headers after a call.

Specified by:
putResponseHeaders in interface AuthenticationProvider
Overrides:
putResponseHeaders in class AbstractAuthenticationProvider
Parameters:
url - the URL
statusCode - the status code
headers - the HTTP headers

getSOAPHeaders

public org.w3c.dom.Element getSOAPHeaders(java.lang.Object portObject)
Description copied from interface: AuthenticationProvider
Returns a SOAP header that should be added to a Web Services call.

Specified by:
getSOAPHeaders in interface AuthenticationProvider
Overrides:
getSOAPHeaders in class AbstractAuthenticationProvider
Parameters:
portObject - the port object
Returns:
the SOAP headers or null if no additional headers should be set

createBasicAuthHeaderValue

protected java.util.List<java.lang.String> createBasicAuthHeaderValue(java.lang.String username,
                                                                      java.lang.String password)
Creates a basic authentication header value from a username and a password.


isTrue

protected boolean isTrue(java.lang.String parameterName)
Returns true if the given parameter exists in the session and is set to true, false otherwise.



Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.