com.atlassian.crowd.plugin.saml
Class SAMLMessageManagerImpl

java.lang.Object
  extended by com.atlassian.crowd.plugin.saml.SAMLMessageManagerImpl
All Implemented Interfaces:
SAMLMessageManager

public class SAMLMessageManagerImpl
extends Object
implements SAMLMessageManager


Constructor Summary
SAMLMessageManagerImpl()
           
 
Method Summary
 void afterPropertiesSet()
          Performs initialisation of the manager by loading the template SAML XML response and DSA keys from disk.
 void deleteKeys()
          Deletes any generated DSA keys in the "/plugin-data/crowd-saml-plugin" folder.
 SAMLAuthResponse generateAuthResponse(SAMLAuthRequest authRequest, String authenticatedUser)
          Generates a successful authentication response for an authentication request given the username of the authenticated user.
 void generateKeys()
          Generates and stores the private and public keys in the Crowd home directory under the "/plugin-data/crowd-saml-plugin" folder.
 String getKeyPath()
           
protected  String getPrivateKeyFilePath()
           
protected  String getPublicKeyFilePath()
           
 boolean hasValidKeys()
          The SAMLMessageManager is ready to perform generate signatures if a valid key-pair has been loaded/generated.
protected  void loadKeys()
          Loads the private and public keys in the Crowd home directory under the "/saml" folder.
 SAMLAuthRequest parseAuthRequest(String samlRequestXML, String relayStateURL)
          Parses the non null request parameters for a SAML request into a SAML request object.
 void setAssertionNotBeforeMinutes(int assertionNotBeforeMinutes)
           
 void setAssertionNotOnOrAfterMinutes(int assertionNotOnOrAfterMinutes)
           
 void setEncryptionAlgorithm(String encryptionAlgorithm)
           
 void setHomeLocator(com.atlassian.config.HomeLocator homeLocator)
           
 void setKeyPath(String keyPath)
           
 void setKeySize(int keySize)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAMLMessageManagerImpl

public SAMLMessageManagerImpl()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Performs initialisation of the manager by loading the template SAML XML response and DSA keys from disk.

Throws:
Exception

parseAuthRequest

public SAMLAuthRequest parseAuthRequest(String samlRequestXML,
                                        String relayStateURL)
                                 throws SAMLException
Description copied from interface: SAMLMessageManager
Parses the non null request parameters for a SAML request into a SAML request object.

Specified by:
parseAuthRequest in interface SAMLMessageManager
Parameters:
samlRequestXML - request XML string.
relayStateURL - relay state URL.
Returns:
SAML authentication request object.
Throws:
SAMLException - error parsing request.

generateAuthResponse

public SAMLAuthResponse generateAuthResponse(SAMLAuthRequest authRequest,
                                             String authenticatedUser)
                                      throws SAMLException
Description copied from interface: SAMLMessageManager
Generates a successful authentication response for an authentication request given the username of the authenticated user.

Specified by:
generateAuthResponse in interface SAMLMessageManager
Parameters:
authRequest - authentication request object.
authenticatedUser - username of authenticated user.
Returns:
signed authentication response object.
Throws:
SAMLException - error generating or signing XML response.

generateKeys

public void generateKeys()
                  throws SAMLException
Description copied from interface: SAMLMessageManager
Generates and stores the private and public keys in the Crowd home directory under the "/plugin-data/crowd-saml-plugin" folder.

This will overwrite any existing keys.

Specified by:
generateKeys in interface SAMLMessageManager
Throws:
SAMLException - if there was an error generating or storing the new keys.

deleteKeys

public void deleteKeys()
Description copied from interface: SAMLMessageManager
Deletes any generated DSA keys in the "/plugin-data/crowd-saml-plugin" folder. This also makes the SAMLMessageManager unable to sign requests.

Specified by:
deleteKeys in interface SAMLMessageManager

loadKeys

protected void loadKeys()
                 throws SAMLException
Loads the private and public keys in the Crowd home directory under the "/saml" folder.

This method is not thread-safe.

Throws:
SAMLException - if there was an error loading the key-pair from disk.

getPublicKeyFilePath

protected String getPublicKeyFilePath()
Returns:
file path of the encoded public key.

getPrivateKeyFilePath

protected String getPrivateKeyFilePath()
Returns:
file path of the encoded private key.

getKeyPath

public String getKeyPath()
Specified by:
getKeyPath in interface SAMLMessageManager
Returns:
directory path of the stored key-pair.

hasValidKeys

public boolean hasValidKeys()
Description copied from interface: SAMLMessageManager
The SAMLMessageManager is ready to perform generate signatures if a valid key-pair has been loaded/generated.

Specified by:
hasValidKeys in interface SAMLMessageManager
Returns:
true if and only if a valid key-pair exists.

setHomeLocator

public void setHomeLocator(com.atlassian.config.HomeLocator homeLocator)

setEncryptionAlgorithm

public void setEncryptionAlgorithm(String encryptionAlgorithm)

setKeySize

public void setKeySize(int keySize)

setAssertionNotBeforeMinutes

public void setAssertionNotBeforeMinutes(int assertionNotBeforeMinutes)

setAssertionNotOnOrAfterMinutes

public void setAssertionNotOnOrAfterMinutes(int assertionNotOnOrAfterMinutes)

setKeyPath

public void setKeyPath(String keyPath)


Copyright © 2013 Atlassian. All Rights Reserved.