public class IDMappingExtUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static IDMappingExtCache |
_cache |
static IDMappingExtCache |
_customcacheForHVBD |
static IDMappingExtCache |
_customcacheForRedis |
static java.lang.String |
ALIAS_TYPE_OLD |
static java.lang.String |
ALIAS_TYPE_PARTNER |
static java.lang.String |
ALIAS_TYPE_SELF |
static java.lang.String |
ENFORCE_JDBC |
static java.lang.String |
ENFORCE_REDIS |
static java.lang.String |
IDMappingExtUtils_java_copyright |
static java.lang.String |
IDMappingExtUtils_java_sourceCodeID |
Constructor and Description |
---|
IDMappingExtUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
addAliasForUser(java.lang.String fedContextId,
java.lang.String username,
java.lang.String alias)
addAliasForUser will store a mapping from the given federation context id
and username to the given alias.
|
static boolean |
addAliasForUser(java.lang.String fedContextId,
java.lang.String username,
java.lang.String alias,
java.lang.String aliasType)
addAliasForUser will store a mapping from the given federation context id
and username to the given alias.
|
static java.lang.String |
extractBinarySecurityToken(org.w3c.dom.Node node)
Extract Binary Security Token from STS exchange result.
|
static java.lang.String |
generateHmacSecretKey(int keyLength)
Generate Hmac Secret Key for the length specified.
|
static java.lang.String |
getCurrentTimeStringUTC()
Returns the current time in UTC in XML format.
|
static IDMappingExtCache |
getIDMappingExtCache() |
static IDMappingExtCache |
getIDMappingExtCache(boolean useRedis)
This method in the utility class provides flexibility for the customer to choose storage, i.e.
|
static java.lang.String |
getSPSSessionData(java.lang.String key)
Retrieves a String value from the user's Single Sign-on Protocol
Service (SPS) session based on a key
|
static java.lang.String |
getSPSSessionID()
Returns an id that is guaranteed to be consistent across multiple
federation contexts within the Single Sign-On Protocol Service (SPS).
|
static java.lang.String |
getTimeStringUTC(int year,
int month,
int day,
int hour,
int minute,
int second)
Constructs a time string in XML format based on the specified year, month, day,
hour, minute and second.
|
static void |
logAuditEvent(java.lang.String username,
java.lang.String message,
boolean result)
Audit - Generate audit log event
|
static void |
logCIAuthAuditEvent(java.lang.String username,
java.lang.String authMethod,
java.lang.String serverConnection,
java.lang.String rule,
boolean result,
java.lang.String statusCode,
java.lang.String correlation)
CI Audit Authentication - Generate CI Auth audit log event
|
static void |
logCISelfCareAuditEvent(java.lang.String username,
java.lang.String action,
java.lang.String serverConnection,
java.lang.String rule,
java.lang.String failureReason)
CI Audit Self Care - Generate CI Self Care audit log event
|
static java.lang.String |
lookupAliasesForUserAsDelimitedString(java.lang.String fedContextId,
java.lang.String username,
java.lang.String delimiter)
Returns the list of aliases associated with a given username within a
given federation context id.
|
static java.lang.String |
lookupAliasesForUserAsDelimitedString(java.lang.String fedContextId,
java.lang.String username,
java.lang.String delimiter,
java.lang.String aliasType)
Returns the list of aliases associated with a given username within a
given federation context id.
|
static java.lang.String[] |
lookupAliasesForUserAsStringArray(java.lang.String fedContextId,
java.lang.String username)
Returns the list of aliases associated with a given username within a
given federation context id.
|
static java.lang.String[] |
lookupAliasesForUserAsStringArray(java.lang.String fedContextId,
java.lang.String username,
java.lang.String aliasType)
Returns the list of aliases associated with a given username within a
given federation context id.
|
static java.lang.String |
lookupUserFromAlias(java.lang.String fedContextId,
java.lang.String alias)
Finds and returns the user associated with the given alias within the
given federation context id (scope of the alias->username mapping).
|
static java.lang.String |
lookupUserFromAlias(java.lang.String fedContextId,
java.lang.String alias,
java.lang.String aliasType)
Finds and returns the user associated with the given alias within the
given federation context id (scope of the alias->username mapping).
|
static org.w3c.dom.Document |
newXMLDocument() |
static QueryServiceAttribute[] |
parseQueryServiceAttributes(java.lang.String claimsNode)
Recursively searches the XML contained in the passed-in string looking
for elements which have this format:
<fimqs:Attribute
xmlns:fimqs="urn:ibm:names:ITFIM:queryservice"
name="openid.sreg.email"
type="whatever"e
optional="true" />
If it finds elements that match this qname, they will be added to the
result set.
|
static InfoCardClaim[] |
parseRequestedClaims(java.lang.String claimsNode)
Recursively searches the XML contained in the passed-in string looking
for elements which have this format:
<wsid:ClaimType
xmlns:wsid="http://schemas.xmlsoap.org/ws/2005/05/identity"
Uri="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname"
Optional="true" />
If it finds elements that match this qname, they will be added to the
result set.
|
static boolean |
removeAliasForUser(java.lang.String fedContextId,
java.lang.String username,
java.lang.String alias)
removeAliasForUser will remove a mapping from the given federation
context id and username for the given alias.
|
static boolean |
removeAliasForUser(java.lang.String fedContextId,
java.lang.String username,
java.lang.String alias,
java.lang.String aliasType)
removeAliasForUser will remove a mapping from the given federation
context id and username for the given alias.
|
static java.lang.String |
removeHotpSecretKey(java.lang.String user)
remove an HOTP secret key for a user
|
static java.lang.String |
removeSecretKey(java.lang.String otpFederation,
java.lang.String userInfoProviderType,
java.lang.String user,
java.lang.String secretKeyName,
java.lang.String secretKeyNamespace)
Deprecated.
See the simplified methods
removeTotpSecretKey(java.lang.String)
and removeHotpSecretKey(java.lang.String) |
static java.lang.String |
removeSPSSessionData(java.lang.String key)
Removes a String value from the user's Single Sign-on Protocol Service
(SPS) session based on a key
|
static java.lang.String |
removeTotpSecretKey(java.lang.String user)
remove an TOTP secret key for a user
|
static java.lang.String |
retrieveHotpSecretKey(java.lang.String user)
Retrieve a HOTP Secret key for a user
|
static java.lang.String |
retrieveSecretKey(java.lang.String otpFederation,
java.lang.String userInfoProviderType,
java.lang.String user,
java.lang.String secretKeyName,
java.lang.String secretKeyNamespace)
Deprecated.
See the simplified methods
retrieveTotpSecretKey(java.lang.String)
and retrieveHotpSecretKey(java.lang.String) |
static java.lang.String |
retrieveTotpSecretKey(java.lang.String user)
Retrieve a TOTP Secret key for a user
|
static void |
setSPSSessionData(java.lang.String key,
java.lang.String value)
Stores a key/value String pair in the user's Single Sign-on Protocol
Service (SPS) session
|
static void |
sleep(long timeInMillis)
Sleep for a number of milliseconds.
|
static void |
storeHotpSecretKey(java.lang.String user,
java.lang.String value)
Store an HOTP secret key for a user
|
static void |
storeSecretKey(java.lang.String otpFederation,
java.lang.String userInfoProviderType,
java.lang.String user,
java.lang.String secretKeyName,
java.lang.String secretKeyNamespace,
java.lang.String value)
Deprecated.
See the simplified methods
storeTotpSecretKey(java.lang.String, java.lang.String)
and storeHotpSecretKey(java.lang.String, java.lang.String) |
static void |
storeTotpSecretKey(java.lang.String user,
java.lang.String value)
Store an TOTP secret key for a user
|
static org.w3c.dom.Element |
stringToXMLElement(java.lang.String string) |
static java.lang.String |
subStringAfterLast(java.lang.String text,
java.lang.String chars)
Returns the substring of text after the last occurence of chars.
|
static java.lang.String |
subStringBeforeLast(java.lang.String text,
java.lang.String chars)
Returns the substring of text before the last occurence of chars.
|
static void |
throwSTSException(java.lang.String message)
Used to throw STS Messages from Javascript mapping rules.
|
static void |
throwSTSUserMessageException(java.lang.String message)
Used to throw STSUserMessageException from XSLT/Javascript mapping rules
The error message of this exception is displayed in the response to the client.
|
static void |
traceString(java.lang.String str)
Provides a convenient tracing mechanism for js mapping rule.
|
static void |
traceString(java.lang.String str,
java.util.logging.Level level)
Provides a convenient tracing mechanism for js mapping rule.
|
static java.lang.String |
translatePPID(java.lang.String ppid)
Tranlates a base64 encoded PPID string into a friendly display format
according to the Information Card specifications.
|
static java.lang.String |
xmlElementToString(org.w3c.dom.Element element) |
public static final java.lang.String IDMappingExtUtils_java_sourceCodeID
public static final java.lang.String IDMappingExtUtils_java_copyright
public static final java.lang.String ALIAS_TYPE_SELF
public static final java.lang.String ALIAS_TYPE_PARTNER
public static final java.lang.String ALIAS_TYPE_OLD
public static IDMappingExtCache _cache
public static IDMappingExtCache _customcacheForRedis
public static IDMappingExtCache _customcacheForHVBD
public static final java.lang.String ENFORCE_REDIS
public static final java.lang.String ENFORCE_JDBC
public static void throwSTSException(java.lang.String message) throws STSException
message
- STSException
public static void throwSTSUserMessageException(java.lang.String message) throws STSUserMessageException
message
- STSUserMessageException
public static java.lang.String translatePPID(java.lang.String ppid)
ppid
- public static java.lang.String subStringAfterLast(java.lang.String text, java.lang.String chars)
text
- chars
- public static java.lang.String subStringBeforeLast(java.lang.String text, java.lang.String chars)
text
- chars
- public static InfoCardClaim[] parseRequestedClaims(java.lang.String claimsNode)
<wsid:ClaimType xmlns:wsid="http://schemas.xmlsoap.org/ws/2005/05/identity" Uri="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" Optional="true" />If it finds elements that match this qname, they will be added to the result set. If the passed in string cannot be parsed as XML, an empty array will be returned.
claimsNode
- public static QueryServiceAttribute[] parseQueryServiceAttributes(java.lang.String claimsNode)
<fimqs:Attribute xmlns:fimqs="urn:ibm:names:ITFIM:queryservice" name="openid.sreg.email" type="whatever"e optional="true" />If it finds elements that match this qname, they will be added to the result set. If the passed in string cannot be parsed as XML, an empty array will be returned.
claimsNode
- public static boolean addAliasForUser(java.lang.String fedContextId, java.lang.String username, java.lang.String alias) throws STSException
fedContextId
- - the federation context idusername
- - the TFIM usernamealias
- - the alias to associate with the username within the given
federation context idSTSException
public static boolean addAliasForUser(java.lang.String fedContextId, java.lang.String username, java.lang.String alias, java.lang.String aliasType) throws STSException
fedContextId
- - the federation context idusername
- - the TFIM usernamealias
- - the alias to associate with the username within the given
federation context idaliasType
- - the type of alias to add. Must be "self", "partner", or
"old".STSException
public static boolean removeAliasForUser(java.lang.String fedContextId, java.lang.String username, java.lang.String alias) throws STSException
fedContextId
- - the federation context idusername
- - the TFIM usernamealias
- - the alias associated with the username within the given
federation context idSTSException
public static boolean removeAliasForUser(java.lang.String fedContextId, java.lang.String username, java.lang.String alias, java.lang.String aliasType) throws STSException
fedContextId
- - the federation context idusername
- - the TFIM usernamealias
- - the alias associated with the username within the given
federation context idaliasType
- - the type of alias to remove, must be "self", "partner", or
"old".STSException
public static java.lang.String lookupUserFromAlias(java.lang.String fedContextId, java.lang.String alias) throws STSException
fedContextId
- - the federation context idalias
- - the alias of the associated user within the given federation
context idSTSException
public static java.lang.String lookupUserFromAlias(java.lang.String fedContextId, java.lang.String alias, java.lang.String aliasType) throws STSException
fedContextId
- - the federation context idalias
- - the alias of the associated user within the given federation
context idaliasType
- - the type of alias to search for. Valid values are "self",
"parnter", or "old".STSException
public static java.lang.String[] lookupAliasesForUserAsStringArray(java.lang.String fedContextId, java.lang.String username) throws STSException
fedContextId
- - the federation context idusername
- - the username for which to search for aliasesSTSException
public static java.lang.String[] lookupAliasesForUserAsStringArray(java.lang.String fedContextId, java.lang.String username, java.lang.String aliasType) throws STSException
fedContextId
- - the federation context idusername
- - the username for which to search for aliasesaliasType
- - the type of alias to search.STSException
public static java.lang.String lookupAliasesForUserAsDelimitedString(java.lang.String fedContextId, java.lang.String username, java.lang.String delimiter) throws STSException
fedContextId
- - the federation context idusername
- - the username for which to search for aliasesdelimiter
- - the string delimiter to put between aliases in the return
valueSTSException
public static java.lang.String lookupAliasesForUserAsDelimitedString(java.lang.String fedContextId, java.lang.String username, java.lang.String delimiter, java.lang.String aliasType) throws STSException
fedContextId
- - the federation context idusername
- - the username for which to search for aliasesdelimiter
- - the string delimiter to put between aliases in the return
valuealiasType
- - the type of alias to lookupSTSException
public static void traceString(java.lang.String str)
str
- - String to tracepublic static void traceString(java.lang.String str, java.util.logging.Level level)
str
- level,
- If the null value is passed in, it will use the default value "FINER"public static java.lang.String getCurrentTimeStringUTC()
public static java.lang.String getTimeStringUTC(int year, int month, int day, int hour, int minute, int second)
year
- month
- day
- hour
- minute
- second
- timeZone
- public static IDMappingExtCache getIDMappingExtCache()
public static IDMappingExtCache getIDMappingExtCache(boolean useRedis)
useRedis,if
- the value is false, it is stored in HVDB. if it is true, it will be stored in the Redispublic static java.lang.String getSPSSessionID()
public static void setSPSSessionData(java.lang.String key, java.lang.String value)
key
- the key used to store the entryvalue
- the value to store in the user's sessionpublic static java.lang.String getSPSSessionData(java.lang.String key)
key
- the key used to retrieve the entrypublic static java.lang.String removeSPSSessionData(java.lang.String key)
key
- the key used to remove the entrypublic static java.lang.String generateHmacSecretKey(int keyLength) throws STSException
keyLengh
- the length of the key to generate. The
keyLength should be multiples of 5.STSException
public static void storeTotpSecretKey(java.lang.String user, java.lang.String value) throws STSException
user
- - user namevalue
- - secret key value to storeSTSException
public static void storeHotpSecretKey(java.lang.String user, java.lang.String value) throws STSException
user
- user namevalue
- secret key value to storeSTSException
public static void storeSecretKey(java.lang.String otpFederation, java.lang.String userInfoProviderType, java.lang.String user, java.lang.String secretKeyName, java.lang.String secretKeyNamespace, java.lang.String value) throws STSException
storeTotpSecretKey(java.lang.String, java.lang.String)
and storeHotpSecretKey(java.lang.String, java.lang.String)
otpFederation
- OTP federation name or group id.userInfoProviderType
- OTP user info provider type.user
- user namesecretKeyName
- secret key attribute name.secretKeyNamespace
- secret key attribute namespace.secretKeyDatatype
- secret key attribute datatype.value
- The secret key value to storeSTSException
public static java.lang.String retrieveTotpSecretKey(java.lang.String user) throws STSException
user
- the user to retrieveSTSException
public static java.lang.String retrieveHotpSecretKey(java.lang.String user) throws STSException
user
- the user to retrieveSTSException
public static java.lang.String retrieveSecretKey(java.lang.String otpFederation, java.lang.String userInfoProviderType, java.lang.String user, java.lang.String secretKeyName, java.lang.String secretKeyNamespace) throws STSException
retrieveTotpSecretKey(java.lang.String)
and retrieveHotpSecretKey(java.lang.String)
otpFederation
- OTP federation name or group id.userInfoProviderType
- OTP user info provider type.user
- user namesecretKeyName
- secret key attribute name.secretKeyNamespace
- secret key attribute namespace.STSException
public static java.lang.String removeTotpSecretKey(java.lang.String user) throws STSException
user
- - user nameSTSException
public static java.lang.String removeHotpSecretKey(java.lang.String user) throws STSException
user
- - user nameSTSException
public static java.lang.String removeSecretKey(java.lang.String otpFederation, java.lang.String userInfoProviderType, java.lang.String user, java.lang.String secretKeyName, java.lang.String secretKeyNamespace) throws STSException
removeTotpSecretKey(java.lang.String)
and removeHotpSecretKey(java.lang.String)
otpFederation
- OTP federation name or group id.userInfoProviderType
- OTP user info provider type.user
- user namesecretKeyName
- secret key attribute name.secretKeyNamespace
- secret key attribute namespace.STSException
public static org.w3c.dom.Document newXMLDocument()
public static java.lang.String xmlElementToString(org.w3c.dom.Element element)
public static org.w3c.dom.Element stringToXMLElement(java.lang.String string) throws STSException
STSException
public static void sleep(long timeInMillis)
timeInMillis
- to sleep forpublic static java.lang.String extractBinarySecurityToken(org.w3c.dom.Node node)
Node
- containing BinarySecurityToken element.public static void logCISelfCareAuditEvent(java.lang.String username, java.lang.String action, java.lang.String serverConnection, java.lang.String rule, java.lang.String failureReason)
username
- user information to include in the audit record; may be nullaction
- the self care action to include in the audit recordserverConnection
- the server connection to include in the audit recordrule
- the rule to include in the audit recordfailureReason
- the failure reason. set to null if the operation being audited
was successfulpublic static void logCIAuthAuditEvent(java.lang.String username, java.lang.String authMethod, java.lang.String serverConnection, java.lang.String rule, boolean result, java.lang.String statusCode, java.lang.String correlation)
username
- user information to include in the audit record; may be nullauthMethod
- the auth method to include in the audit recordserverConnection
- the server connection to include in the audit recordrule
- the rule to include in the audit recordresult
- boolean to indicate if the operation being audited was
successfulstatusCode
- code to include if the operation being audited was
unsuccessfulpublic static void logAuditEvent(java.lang.String username, java.lang.String message, boolean result)
username
- user information to include in the audit record; may be nullmessage
- the message to include in the audit recordresult
- boolean to indicate if the operation being audited was successful