org.openliberty.wsc
Class AuthenticationService

java.lang.Object
  extended by org.openliberty.wsc.BaseServiceClient
      extended by org.openliberty.wsc.AuthenticationService

public class AuthenticationService
extends BaseServiceClient

This class bootstraps into the WSF environment authenticating with an Authentication Service (AS) to retrieve a Discovery Service (DS) EndpointReference, utilizing SASL.

Author:
curtis, asa

Nested Class Summary
static class AuthenticationService.AuthMechanism
          This enumeration lists the AUTH mechanisms currently supported by the client library
static class AuthenticationService.ResponseCode
          This enum models the ResponseCodes that are supported by the WSC ClientLib Authentication Service Client at this point.
static class AuthenticationService.WSCExceptionType
          An enumeration that describes the various exceptions that the Authentication Service Client may throw.
 
Field Summary
private  java.lang.String lastMessageId
          Used for the RelatesTo header when there is a CONTINUE
private  AuthenticationService.ResponseCode lastResponseCode
           
private static org.apache.log4j.Logger log
           
(package private)  boolean promiscuousMode
          Indicates whether the service client will attempt to down grade in the event that the server returns an AUTH MECHANISM that was not requested
private  java.net.URL serviceURL
           
 
Constructor Summary
AuthenticationService(DiscoveryService discoveryService, EndpointReference initialEndpointReference)
          
 
Method Summary
 EndpointReference authenticate(java.lang.String username, java.lang.String password, AuthenticationService.AuthMechanism mechanism)
          This wraps method calls
 EndpointReference authenticate(java.lang.String username, java.lang.String password, AuthenticationService.AuthMechanism mechanism, org.opensaml.saml2.core.RequestedAuthnContext requestedAuthnContext)
           
 EndpointReference authenticateCRAM_MD5(java.lang.String username, java.lang.String password, org.opensaml.saml2.core.RequestedAuthnContext requestedAuthnContext)
          CRAM-MD5 is a two stage authentication procedure.
 EndpointReference authenticatePLAIN(java.lang.String username, java.lang.String password, org.opensaml.saml2.core.RequestedAuthnContext requestedAuthnContext)
          authenticate Perform the (multi-step) authentication
 boolean checkForSupportOfAuthMechanism(AuthenticationService.AuthMechanism mechanism)
          This convenience method checks to see whether the server supports a specified AUTH MECHANISM
 AuthenticationService.ResponseCode getLastResponseCode()
          Returns the last response code logged by this client
private  SASLResponse invokeSASLRequest(java.net.URL addressURL, SASLRequest request)
          Invokes a SASLRequest, returning the SASLResponse
 boolean isPromiscuousMode()
           
static AuthenticationService serviceForEndpointReference(DiscoveryService discoveryService, EndpointReference epr)
          Creates an Authentication Service Client from the specified EndpointReference
 void setPromiscuousMode(boolean promiscuousMode)
           
 void setServiceURL(java.net.URL serviceURL)
          Sets the Authentication Service URL
 
Methods inherited from class org.openliberty.wsc.BaseServiceClient
getDiscoveryService, getServiceEndpointReference, getServiceEndpointReferenceStore, isSigningOutgoingMessages, replaceServiceEndpointReference, serviceExplicitlySupportsOption, setDiscoveryService, setServiceEndpointReference, setSigningOutgoingMessages
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.log4j.Logger log

promiscuousMode

boolean promiscuousMode
Indicates whether the service client will attempt to down grade in the event that the server returns an AUTH MECHANISM that was not requested


serviceURL

private java.net.URL serviceURL

lastResponseCode

private AuthenticationService.ResponseCode lastResponseCode

lastMessageId

private java.lang.String lastMessageId
Used for the RelatesTo header when there is a CONTINUE

Constructor Detail

AuthenticationService

public AuthenticationService(DiscoveryService discoveryService,
                             EndpointReference initialEndpointReference)

Method Detail

serviceForEndpointReference

public static AuthenticationService serviceForEndpointReference(DiscoveryService discoveryService,
                                                                EndpointReference epr)
Creates an Authentication Service Client from the specified EndpointReference

Parameters:
epr -
Returns:

setServiceURL

public void setServiceURL(java.net.URL serviceURL)
Sets the Authentication Service URL

Parameters:
serviceURL -

getLastResponseCode

public AuthenticationService.ResponseCode getLastResponseCode()
Returns the last response code logged by this client

Returns:

isPromiscuousMode

public boolean isPromiscuousMode()

setPromiscuousMode

public void setPromiscuousMode(boolean promiscuousMode)

checkForSupportOfAuthMechanism

public boolean checkForSupportOfAuthMechanism(AuthenticationService.AuthMechanism mechanism)
This convenience method checks to see whether the server supports a specified AUTH MECHANISM

Parameters:
mechanism -
Returns:

authenticate

public EndpointReference authenticate(java.lang.String username,
                                      java.lang.String password,
                                      AuthenticationService.AuthMechanism mechanism)
                               throws WSCException
This wraps method calls

Parameters:
username -
password -
mechanism -
Returns:
Throws:
WSCException

authenticate

public EndpointReference authenticate(java.lang.String username,
                                      java.lang.String password,
                                      AuthenticationService.AuthMechanism mechanism,
                                      org.opensaml.saml2.core.RequestedAuthnContext requestedAuthnContext)
                               throws WSCException
Parameters:
username -
password -
mechanism -
requestedAuthnContext -
Returns:
Throws:
WSCException

authenticatePLAIN

public EndpointReference authenticatePLAIN(java.lang.String username,
                                           java.lang.String password,
                                           org.opensaml.saml2.core.RequestedAuthnContext requestedAuthnContext)
                                    throws WSCException
authenticate Perform the (multi-step) authentication

Returns:
EPR or null on error
Throws:
WSCException

authenticateCRAM_MD5

public EndpointReference authenticateCRAM_MD5(java.lang.String username,
                                              java.lang.String password,
                                              org.opensaml.saml2.core.RequestedAuthnContext requestedAuthnContext)
                                       throws WSCException
CRAM-MD5 is a two stage authentication procedure. First the Server is told of the intention to use CRAM-MD5, the server responds with a challenge. The challenge is the key used in the MD5 response

http://www.ietf.org/internet-drafts/draft-ietf-sasl-crammd5-09.txt

Parameters:
username -
password -
Returns:
Throws:
WSCException

invokeSASLRequest

private SASLResponse invokeSASLRequest(java.net.URL addressURL,
                                       SASLRequest request)
                                throws WSCException
Invokes a SASLRequest, returning the SASLResponse

Parameters:
addressUrl -
request -
Returns:
the SASLResponse
Throws:
WSCException