Class IdpAttributeMapperScriptHelper
- java.lang.Object
-
- com.sun.identity.saml2.plugins.scripted.IdpAttributeMapperScriptHelper
-
@EvolvingAll public class IdpAttributeMapperScriptHelper extends Object
This class exposes methods that are only intended to be used by IDP Attribute Mapper script types.
-
-
Constructor Summary
Constructors Constructor Description IdpAttributeMapperScriptHelper()
Construct a new instance ofIdpAttributeMapperScriptHelper
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Attribute
createSAMLAttribute(String name, String nameFormat, Set<String> values)
Create a SAMLAttribute
object.Map<String,Set<String>>
getAttributes(Object session, Set<String> attrNames)
Get attributes from a session.Map<String,byte[][]>
getBinaryAttributes(Object session, Set<String> attrNames)
Get binary attributes from a session.Set<String>
getBinaryAttributeValues(String samlAttribute, String localAttribute, Map<String,byte[][]> binaryValueMap)
Return a Set of Base64 encoded String values that represent the binary attribute values.Map<String,String>
getHostedIDPConfigAttributeMap(String realm, String hostedEntityId)
Return the attribute map by parsing the configured map in hosted identity provider configuration.Set<String>
getPropertySet(Object session, String property)
Return the property value of a session object.Map<String,String>
getRemoteSPConfigAttributeMap(String realm, String remoteEntityId)
Return the attribute map by parsing the configured map in remote service provider configurationboolean
isBinaryAttribute(String attributeName)
For the given attributeName, return true if it is flagged as a binary attribute.boolean
isIgnoredProfile(Object session, String realm)
Return true if ignore profile is enabled for this realm.boolean
isSessionValid(Object session)
Check if a session is valid.boolean
isStaticAttribute(String attributeName)
For the given attributeName, return true if it is flagged as an attribute.String
removeBinaryAttributeFlag(String attributeName)
Return the attributeName without the binary flag if it is included.String
removeStaticAttributeFlag(String attributeName)
Return the attributeName without the flag if it is included.
-
-
-
Constructor Detail
-
IdpAttributeMapperScriptHelper
public IdpAttributeMapperScriptHelper()
Construct a new instance ofIdpAttributeMapperScriptHelper
.
-
-
Method Detail
-
isSessionValid
public boolean isSessionValid(Object session) throws SessionException
Check if a session is valid. This is useful for toolkit clean-up thread.- Parameters:
session
- Session object.- Returns:
- true if the session is valid.
- Throws:
SessionException
- the session exception
-
getHostedIDPConfigAttributeMap
public Map<String,String> getHostedIDPConfigAttributeMap(String realm, String hostedEntityId) throws SAML2Exception
Return the attribute map by parsing the configured map in hosted identity provider configuration.- Parameters:
realm
- realm name.hostedEntityId
- the hosted entity identity.- Returns:
- a map of local attributes configuration map. This map will have a key as the SAML attribute name and the value is the local attribute.
- Throws:
SAML2Exception
- if any failure.
-
getRemoteSPConfigAttributeMap
public Map<String,String> getRemoteSPConfigAttributeMap(String realm, String remoteEntityId) throws SAML2Exception
Return the attribute map by parsing the configured map in remote service provider configuration- Parameters:
realm
- realm name.remoteEntityId
- the remote entity identity.- Returns:
- a map of local attributes configuration map. This map will have a key as the SAML attribute name and the value is the local attribute.
- Throws:
SAML2Exception
- if any failure.
-
isIgnoredProfile
public boolean isIgnoredProfile(Object session, String realm)
Return true if ignore profile is enabled for this realm.- Parameters:
session
- SSOToken to check the profile creation attributes.realm
- realm to check the profile creation attributes.- Returns:
- true if ignore profile is enabled, false otherwise.
-
getPropertySet
public Set<String> getPropertySet(Object session, String property) throws SessionException
Return the property value of a session object.- Parameters:
session
- the sessionproperty
- the property name- Returns:
- the property set
- Throws:
SessionException
- on failing to get the datastore provider or reading the value from the datastore.
-
getAttributes
public Map<String,Set<String>> getAttributes(Object session, Set<String> attrNames) throws SAML2Exception, DataStoreProviderException, SessionException
Get attributes from a session.- Parameters:
session
- the sessionattrNames
- the attr names- Returns:
- the attributes from session
- Throws:
SAML2Exception
- on failing to get the datastore provider and on failing to read attributes from the datastore provider.SessionException
- on failing to get the session provider.DataStoreProviderException
- on failing to read the binary attributes from the datastore provider.
-
getBinaryAttributes
public Map<String,byte[][]> getBinaryAttributes(Object session, Set<String> attrNames) throws SAML2Exception, DataStoreProviderException, SessionException
Get binary attributes from a session.- Parameters:
session
- the sessionattrNames
- the attr names- Returns:
- the binary attributes
- Throws:
SAML2Exception
- on failing to get the datastore provider and on failing to read attributes from the datastore provider.SessionException
- on failing to get the session provider.DataStoreProviderException
- on failing to read the binary attributes from the datastore provider.
-
isStaticAttribute
public boolean isStaticAttribute(String attributeName)
For the given attributeName, return true if it is flagged as an attribute.- Parameters:
attributeName
- The attributeName to check for the flag- Returns:
- true if the attributeName is flagged as an attribute
-
removeStaticAttributeFlag
public String removeStaticAttributeFlag(String attributeName)
Return the attributeName without the flag if it is included.- Parameters:
attributeName
- The attribute name with the flag included- Returns:
- The attributeName with the flag removed
-
isBinaryAttribute
public boolean isBinaryAttribute(String attributeName)
For the given attributeName, return true if it is flagged as a binary attribute.- Parameters:
attributeName
- The attributeName to check for the binary flag- Returns:
- true if the attributeName is flagged as a binary attribute
-
removeBinaryAttributeFlag
public String removeBinaryAttributeFlag(String attributeName)
Return the attributeName without the binary flag if it is included.- Parameters:
attributeName
- The attribute name with the binary flag included- Returns:
- The attributeName with the binary flag removed
-
createSAMLAttribute
public Attribute createSAMLAttribute(String name, String nameFormat, Set<String> values) throws SAML2Exception
Create a SAMLAttribute
object.- Parameters:
name
- attribute namenameFormat
- Name format of the attributevalues
- attribute values- Returns:
- SAML Attribute element
- Throws:
SAML2Exception
-
getBinaryAttributeValues
public Set<String> getBinaryAttributeValues(String samlAttribute, String localAttribute, Map<String,byte[][]> binaryValueMap)
Return a Set of Base64 encoded String values that represent the binary attribute values.- Parameters:
samlAttribute
- the SAML attribute that will be assigned these valueslocalAttribute
- the attribute to find in the mapbinaryValueMap
- the map of binary values for the all binary attributes- Returns:
- Set of Base64 encoded String values for the given binary attribute values
-
-