Class IdpAttributeMapperScriptHelper
java.lang.Object
com.sun.identity.saml2.plugins.scripted.IdpAttributeMapperScriptHelper
This class exposes methods that are only intended to be used by IDP Attribute Mapper script types.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateSAMLAttribute
(String name, String nameFormat, Set<String> values) Create a SAMLAttribute
object.getAttributes
(Object session, Set<String> attrNames) Get attributes from a session.getBinaryAttributes
(Object session, Set<String> attrNames) Get binary attributes from a session.getBinaryAttributeValues
(String samlAttribute, String localAttribute, Map<String, byte[][]> binaryValueMap) Return a Set of Base64 encoded String values that represent the binary attribute values.getHostedIDPConfigAttributeMap
(String realm, String hostedEntityId) Return the attribute map by parsing the configured map in hosted identity provider configuration.getPropertySet
(Object session, String property) Return the property value of a session object.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.removeBinaryAttributeFlag
(String attributeName) Return the attributeName without the binary flag if it is included.removeStaticAttributeFlag
(String attributeName) Return the attributeName without the flag if it is included.
-
Constructor Details
-
IdpAttributeMapperScriptHelper
public IdpAttributeMapperScriptHelper()Construct a new instance ofIdpAttributeMapperScriptHelper
.
-
-
Method Details
-
isSessionValid
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 com.sun.identity.saml2.common.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:
com.sun.identity.saml2.common.SAML2Exception
- if any failure.
-
getRemoteSPConfigAttributeMap
public Map<String,String> getRemoteSPConfigAttributeMap(String realm, String remoteEntityId) throws com.sun.identity.saml2.common.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:
com.sun.identity.saml2.common.SAML2Exception
- if any failure.
-
isIgnoredProfile
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
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 com.sun.identity.saml2.common.SAML2Exception, DataStoreProviderException, SessionException Get attributes from a session.- Parameters:
session
- the sessionattrNames
- the attr names- Returns:
- the attributes from session
- Throws:
com.sun.identity.saml2.common.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 com.sun.identity.saml2.common.SAML2Exception, DataStoreProviderException, SessionException Get binary attributes from a session.- Parameters:
session
- the sessionattrNames
- the attr names- Returns:
- the binary attributes
- Throws:
com.sun.identity.saml2.common.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
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
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
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
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 com.sun.identity.saml2.common.SAML2Exception Create a SAMLAttribute
object.- Parameters:
name
- attribute namenameFormat
- Name format of the attributevalues
- attribute values- Returns:
- SAML Attribute element
- Throws:
com.sun.identity.saml2.common.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
-