com.tivoli.am.fim.trustserver.sts.utilities
Class OAuthMappingExtUtils

java.lang.Object
  extended by com.tivoli.am.fim.trustserver.sts.utilities.OAuthMappingExtUtils

public class OAuthMappingExtUtils
extends java.lang.Object

Implementation of STS Mapping Extension Functions for OAuth.


Field Summary
static java.lang.String OAuthMappingExtUtils_java_copyright
           
static java.lang.String OAuthMappingExtUtils_java_sourceCodeID
           
 
Constructor Summary
OAuthMappingExtUtils()
           
 
Method Summary
static boolean associate(java.lang.String stateID, java.lang.String attrKey, java.lang.String attrValue)
          Associates the attribute key-value pair to authorization grant state ID.
static boolean deleteGrant(java.lang.String stateID)
          Delete an OAuth grant from the cache.
static boolean deleteToken(java.lang.String tokenID)
          Delete an OAuth token from the cache.
static java.lang.String disassociate(java.lang.String stateID, java.lang.String attrKey)
          Disassociates the attribute key-value pair from the authorization grant state ID.
static java.lang.String getAssociation(java.lang.String stateID, java.lang.String attrKey)
          Get an attribute value associated with the given state ID and attibute key.
static java.lang.String[] getAssociationKeys(java.lang.String stateID)
          Get all the attribute keys associated with the given authorization grant state ID.
static Grant[] getGrants(java.lang.String username)
          Get the grants associated with the given username.
static com.tivoli.am.fim.trustserver.sts.oauth20.Token[] getTokens(java.lang.String clientId, java.lang.String username)
          Get the tokens associated with the given username and client ID
static HttpResponse httpGet(java.lang.String urlstr)
          HTTP client GET method.
static HttpResponse httpGet(java.lang.String urlstr, java.util.Map headers, java.lang.String httpsTrustStore, java.lang.String basicAuthUsername, java.lang.String basicAuthPassword, java.lang.String clientKeyStore, java.lang.String clientKeyAlias)
          HTTP client GET method.
static HttpResponse httpPost(java.lang.String urlstr, java.util.Map params)
          HTTP client POST method.
static HttpResponse httpPost(java.lang.String urlstr, java.util.Map headers, java.util.Map params, java.lang.String httpsTrustStore, java.lang.String basicAuthUsername, java.lang.String basicAuthPassword, java.lang.String clientKeyStore, java.lang.String clientKeyAlias)
          HTTP client POST method.
static void throwSTSException(java.lang.String message)
          Used to throw STS Messages from XLST/Javascript mapping rules.
static void throwSTSUserMessageException(java.lang.String message)
          Used to throw STS Messages from XLST/Javascript mapping rules.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OAuthMappingExtUtils_java_sourceCodeID

public static final java.lang.String OAuthMappingExtUtils_java_sourceCodeID
See Also:
Constant Field Values

OAuthMappingExtUtils_java_copyright

public static final java.lang.String OAuthMappingExtUtils_java_copyright
See Also:
Constant Field Values
Constructor Detail

OAuthMappingExtUtils

public OAuthMappingExtUtils()
Method Detail

throwSTSException

public static void throwSTSException(java.lang.String message)
                              throws com.tivoli.am.fim.trustserver.sts.STSException
Used to throw STS Messages from XLST/Javascript mapping rules. use IDMappingExtUtils.throwSTSException(String) instead

Throws:
com.tivoli.am.fim.trustserver.sts.STSException

throwSTSUserMessageException

public static void throwSTSUserMessageException(java.lang.String message)
                                         throws com.tivoli.am.fim.trustserver.sts.utilities.STSUserMessageException
Used to throw STS Messages from XLST/Javascript mapping rules. use IDMappingExtUtils.throwSTSException(String) instead

Throws:
com.tivoli.am.fim.trustserver.sts.utilities.STSUserMessageException

associate

public static boolean associate(java.lang.String stateID,
                                java.lang.String attrKey,
                                java.lang.String attrValue)
Associates the attribute key-value pair to authorization grant state ID.

Parameters:
stateID - State ID of the authorization grant
attrKey - Attribute key
attrValue - Attribute value
Returns:
Whether or not it succeeded.

disassociate

public static java.lang.String disassociate(java.lang.String stateID,
                                            java.lang.String attrKey)
Disassociates the attribute key-value pair from the authorization grant state ID.

Parameters:
stateID - State ID of the authorization grant
attrKey - Attribute key
Returns:
Attribute value of disassociated attribute. Null if attribute not found.

getTokens

public static com.tivoli.am.fim.trustserver.sts.oauth20.Token[] getTokens(java.lang.String clientId,
                                                                          java.lang.String username)
Get the tokens associated with the given username and client ID

Parameters:
clientId - The client id of the token. This parameter cannot be null or empty.
username - The user name of the token. This parameter cannot be null or empty.
Returns:
An array of tokens associated with the given username and client ID. Null if no tokens found.

deleteToken

public static boolean deleteToken(java.lang.String tokenID)
Delete an OAuth token from the cache.

Parameters:
tokenID - ID of the OAuth token to be deleted. This cannot be null or empty.
Returns:
false- No token deleted true- Token deleted

getGrants

public static Grant[] getGrants(java.lang.String username)
Get the grants associated with the given username.

Parameters:
username - The username of the grant. This parameter cannot be null or empty.
Returns:
An array of grants associated with the given username. Null if no grants found.

deleteGrant

public static boolean deleteGrant(java.lang.String stateID)
Delete an OAuth grant from the cache.

Parameters:
stateID - ID of the OAuth grant to be deleted. This cannot be null or empty.
Returns:
false- No grant deleted true- Grant deleted

getAssociationKeys

public static java.lang.String[] getAssociationKeys(java.lang.String stateID)
Get all the attribute keys associated with the given authorization grant state ID.

Parameters:
stateID - State ID of the authorization grant
Returns:
A String array of all attribute keys associated with the authorization grant state ID. Returns null if state ID is invalid, problem retrieving from token cache, or no associated attributes.

getAssociation

public static java.lang.String getAssociation(java.lang.String stateID,
                                              java.lang.String attrKey)
Get an attribute value associated with the given state ID and attibute key.

Parameters:
stateID - State ID of the authorization grant
Returns:
Attribute value. Null if not found.

httpGet

public static HttpResponse httpGet(java.lang.String urlstr)
HTTP client GET method.

Parameters:
urlstr - URL
Returns:
The HTTP response. Null if invalid URL or no response.

httpGet

public static HttpResponse httpGet(java.lang.String urlstr,
                                   java.util.Map headers,
                                   java.lang.String httpsTrustStore,
                                   java.lang.String basicAuthUsername,
                                   java.lang.String basicAuthPassword,
                                   java.lang.String clientKeyStore,
                                   java.lang.String clientKeyAlias)
HTTP client GET method.

Parameters:
urlstr - URL
headers - A Map (String,String) to be added to the request header.
httpsTrustStore - The name of the trust store to use. If a HTTPS connection is required and this is set to NULL, the default trust store specified in the override configs will be used.
basicAuthUsername - Basic-auth username. If null, basic-auth will be disabled.
basicAuthPassword - Basic-auth password. If null, basic-auth will be disabled.
clientKeyStore - Client key store. If null, client cert auth will be disabled.
clientKeyAlias - Client key alias. If null, client cert auth will be disabled.
Returns:
The HTTP response. Null if invalid URL or no response.

httpPost

public static HttpResponse httpPost(java.lang.String urlstr,
                                    java.util.Map params)
HTTP client POST method.

Parameters:
urlstr - URL
params - A Map (String,String) to be added to the request body.
Returns:
The HTTP response. Null if invalid URL or no response.

httpPost

public static HttpResponse httpPost(java.lang.String urlstr,
                                    java.util.Map headers,
                                    java.util.Map params,
                                    java.lang.String httpsTrustStore,
                                    java.lang.String basicAuthUsername,
                                    java.lang.String basicAuthPassword,
                                    java.lang.String clientKeyStore,
                                    java.lang.String clientKeyAlias)
HTTP client POST method.

Parameters:
urlstr - URL
headers - A Map (String,String) to be added to the request header.
params - A Map (String,String) to be added to the request body.
httpsTrustStore - The trust store to use. If a HTTPS connection is required and this is set to NULL, the default trust store specified in the override configs will be used.
basicAuthUsername - Basic-auth username. If null, basic-auth will be disabled.
basicAuthPassword - Basic-auth password. If null, basic-auth will be disabled.
clientKeyStore - Client key store. If null, client cert auth will be disabled.
clientKeyAlias - Client key alias. If null, client cert auth will be disabled.
Returns:
The HTTP response. Null if invalid URL or no response.