Class AgentConfiguration
- java.lang.Object
-
- com.sun.identity.common.configuration.AgentConfiguration
-
public class AgentConfiguration extends Object
This class provides agent configuration utilities.
-
-
Field Summary
Fields Modifier and Type Field Description static StringAGENT_ROOT_URLstatic StringAGENT_TYPE_2_DOT_2_AGENTstatic StringAGENT_TYPE_AGENT_AUTHENTICATORstatic StringAGENT_TYPE_J2EEstatic StringAGENT_TYPE_OAUTH2static StringAGENT_TYPE_WEBstatic StringATTR_CONFIG_REPOstatic StringATTR_NAME_FREE_FORMstatic StringATTR_NAME_PWDstatic StringDEVICE_KEYstatic StringVAL_CONFIG_REPO_LOCAL
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidAddAgentToGroup(AMIdentity group, AMIdentity agent)Adds an agent to a group.static AMIdentitycreateAgent(SSOToken ssoToken, String realm, String agentName, String agentType, Map attrValues)Creates an agent.static voidcreateAgent(SSOToken ssoToken, String realm, String agentName, String agentType, Map attrValues, String serverURL, String agentURL)Creates an agent.static voidcreateAgentGroup(SSOToken ssoToken, String realm, String agentGroupName, String agentType, Map attrValues)Creates an agent group.static voidcreateAgentGroup(SSOToken ssoToken, String realm, String agentGroupName, String agentType, Map attrValues, String serverURL, String agentURL)Creates an agent group.static voidcreateAgentLocal(SSOToken ssoToken, String realm, String agentName, String agentType, Map attrValues, String agentURL)Creates a localized agent.static voiddeleteAgentGroups(SSOToken ssoToken, String realm, Set agentGroups)Deletes agent groups.static MapgetAgentAttributes(SSOToken ssoToken, String realm, String agentName)Returns agent's attribute values.static MapgetAgentAttributes(SSOToken ssoToken, String realm, String agentName, boolean bInherit)Returns agent's attribute values.static MapgetAgentAttributes(AMIdentity amid, boolean reformat)Returns agent's attribute values.static AttributeSchemagetAgentAttributeSchema(String name, String agentTypeName)Returns attribute schema of a given agent type.static SetgetAgentAttributeSchemas(String agentTypeName)Returns a set of attribute schemas of a given agent type.static MapgetAgentGroupAttributes(SSOToken ssoToken, String realm, String agentGroupName)Returns agent group's attribute values.static StringgetAgentType(AMIdentity amid)For the given Agent identity, return the value that represents the agent type.static SetgetAgentTypes()Returns a set of supported agent types.static MapgetAttributeSchemas(String agentType, Collection names)Returns attribute schema for a given set of attribute names.static SetgetAttributesSchemaNames(AMIdentity amid, AttributeSchema.Syntax syntax)Returns a set of attribute schema names whose schema match a given syntax.static SetgetAttributesSchemaNames(String agentType, AttributeSchema.Type type)Returns a set of attribute schema names whose schema match a given type.static MapgetChoiceValues(String name, String agentType)Returns choice values of an attribute schema.static MapgetDefaultValues(String agentType, boolean bGroup)Returns the default values of attribute schemas of a given agent type.static SetgetInheritedAttributeNames(AMIdentity amid)Returns the inherited attribute names.static SetgetLocalPropertyNames(String agentType)Returns a set of local property name if an agent type.static StringgetResourceBundleName()Returns resource bundle name of agent service.static ResourceBundlegetServiceResourceBundle(Locale locale)static booleanremoveAgentGroup(AMIdentity amid, AMIdentity groupToRemove)Removes agent from it group.static voidremoveDefaultDuplicates(Map<String,Set<String>> attributeValues, Map<String,Set<String>> finalAttributes)For the given map of user supplied attributeValues, use the keys to find duplicate default values and remove them from the finalAttributes which will end up being used to create the actual agent configuration.
For example:static booleansetAgentGroup(SSOToken ssoToken, String realm, AMIdentity amid, String groupName)Set agent group.static booleansetAgentGroup(SSOToken ssoToken, String realm, String universalId, String groupName)Set agent group.static booleansetAgentGroup(AMIdentity amid, AMIdentity newGroup)Set agent group.static booleansupportLocalProperties(String agentType)Returnstrueif an agent type support local properties.static voidtagswapAttributeValues(Map attributeValues, String agentType, FQDNUrl serverURL, FQDNUrl agentURL)static voidupdateAgent(SSOToken ssoToken, String realm, String agentName, Map attrValues, boolean bSet)Updates agent attribute values.static voidupdateAgentGroup(SSOToken ssoToken, String realm, String agentGroupName, Map attrValues)Updates agent group attribute values.static voidupdateAgentGroup(SSOToken ssoToken, String realm, String agentGroupName, Map attrValues, boolean bSet)Updates agent group attribute values.static voidupdateInheritance(AMIdentity amid, Map inherit)Updates the inherited attribute names.static voidvalidateAgentRootURLs(Map map)
-
-
-
Field Detail
-
AGENT_TYPE_J2EE
public static final String AGENT_TYPE_J2EE
- See Also:
- Constant Field Values
-
AGENT_TYPE_WEB
public static final String AGENT_TYPE_WEB
- See Also:
- Constant Field Values
-
AGENT_TYPE_OAUTH2
public static final String AGENT_TYPE_OAUTH2
- See Also:
- Constant Field Values
-
AGENT_TYPE_2_DOT_2_AGENT
public static final String AGENT_TYPE_2_DOT_2_AGENT
- See Also:
- Constant Field Values
-
AGENT_TYPE_AGENT_AUTHENTICATOR
public static final String AGENT_TYPE_AGENT_AUTHENTICATOR
- See Also:
- Constant Field Values
-
ATTR_NAME_PWD
public static final String ATTR_NAME_PWD
- See Also:
- Constant Field Values
-
ATTR_NAME_FREE_FORM
public static final String ATTR_NAME_FREE_FORM
- See Also:
- Constant Field Values
-
ATTR_CONFIG_REPO
public static final String ATTR_CONFIG_REPO
- See Also:
- Constant Field Values
-
VAL_CONFIG_REPO_LOCAL
public static final String VAL_CONFIG_REPO_LOCAL
- See Also:
- Constant Field Values
-
AGENT_ROOT_URL
public static final String AGENT_ROOT_URL
- See Also:
- Constant Field Values
-
DEVICE_KEY
public static String DEVICE_KEY
-
-
Method Detail
-
getAgentTypes
public static Set getAgentTypes() throws SMSException, SSOException
Returns a set of supported agent types.- Returns:
- a set of supported agent types.
- Throws:
SMSExceptionSSOException
-
createAgentGroup
public static void createAgentGroup(SSOToken ssoToken, String realm, String agentGroupName, String agentType, Map attrValues) throws IdRepoException, SSOException, SMSException, ConfigurationException
Creates an agent group.- Parameters:
ssoToken- Single Sign On token that is to be used for creation.realm- Realm where group resides.agentGroupName- Name of agent group.agentType- Type of agent group.attrValues- Map of attribute name to its values.- Throws:
IdRepoException- if there are Id Repository related errors.SSOException- if the Single Sign On token is invalid or has expired.SMSException- if there are errors in service management layers.ConfigurationException- if there are missing information in server or agent URL; or invalid agent type.
-
createAgentGroup
public static void createAgentGroup(SSOToken ssoToken, String realm, String agentGroupName, String agentType, Map attrValues, String serverURL, String agentURL) throws IdRepoException, SSOException, SMSException, MalformedURLException, ConfigurationException
Creates an agent group.- Parameters:
ssoToken- Single Sign On token that is to be used for creation.realm- Realm where group resides.agentGroupName- Name of agent group.agentType- Type of agent group.attrValues- Map of attribute name to its values.serverURL- Server URL.agentURL- Agent URL.- Throws:
IdRepoException- if there are Id Repository related errors.SSOException- if the Single Sign On token is invalid or has expired.SMSException- if there are errors in service management layers.MalformedURLException- if server or agent URL is invalid.ConfigurationException- if there are missing information in server or agent URL; or invalid agent type
-
createAgent
public static void createAgent(SSOToken ssoToken, String realm, String agentName, String agentType, Map attrValues, String serverURL, String agentURL) throws IdRepoException, SSOException, SMSException, ConfigurationException
Creates an agent.- Parameters:
ssoToken- Single Sign On token that is to be used for creation.realm- Realm where agent resides.agentName- Name of agent.agentType- Type of agent.attrValues- Map of attribute name to its values.serverURL- Server URL.agentURL- Agent URL.- Throws:
IdRepoException- if there are Id Repository related errors.SSOException- if the Single Sign On token is invalid or has expired.SMSException- if there are errors in service management layers.ConfigurationException- if there are missing information in server or agent URL; or invalid agent type.
-
createAgentLocal
public static void createAgentLocal(SSOToken ssoToken, String realm, String agentName, String agentType, Map attrValues, String agentURL) throws IdRepoException, SSOException, SMSException, MalformedURLException, ConfigurationException
Creates a localized agent.- Parameters:
ssoToken- Single Sign On token that is to be used for creation.realm- Realm where agent resides.agentName- Name of agent.agentType- Type of agent.attrValues- Map of attribute name to its values.agentURL- Agent URL.- Throws:
IdRepoException- if there are Id Repository related errors.SSOException- if the Single Sign On token is invalid or has expired.SMSException- if there are errors in service management layers.MalformedURLException- if server or agent URL is invalid.ConfigurationException- if there are missing information in server or agent URL; or invalid agent type.
-
createAgent
public static AMIdentity createAgent(SSOToken ssoToken, String realm, String agentName, String agentType, Map attrValues) throws IdRepoException, SSOException, SMSException, ConfigurationException
Creates an agent.- Parameters:
ssoToken- Single Sign On token that is to be used for creation.realm- Realm where agent resides.agentName- Name of agent.agentType- Type of agent.attrValues- Map of attribute name to its values.- Throws:
IdRepoException- if there are Id Repository related errors.SSOException- if the Single Sign On token is invalid or has expired.SMSException- if there are errors in service management layers.ConfigurationException- if there are missing information in server or agent URL; or invalid agent type.
-
validateAgentRootURLs
public static void validateAgentRootURLs(Map map) throws ConfigurationException
- Throws:
ConfigurationException
-
removeDefaultDuplicates
public static void removeDefaultDuplicates(Map<String,Set<String>> attributeValues, Map<String,Set<String>> finalAttributes)
For the given map of user supplied attributeValues, use the keys to find duplicate default values and remove them from the finalAttributes which will end up being used to create the actual agent configuration.
For example:com.sun.identity.agents.config.notenforced.url=[[0]=] from defaults is transformed into com.sun.identity.agents.config.notenforced.url[0]= which then clashes with any supplied values like com.sun.identity.agents.config.notenforced.url[0]=[*.gif]
- Parameters:
attributeValues- a map of values supplied when configuring the agentfinalAttributes- a map of values that will be used to create the agent configuration.
-
tagswapAttributeValues
public static void tagswapAttributeValues(Map attributeValues, String agentType, FQDNUrl serverURL, FQDNUrl agentURL) throws ConfigurationException
- Throws:
ConfigurationException
-
updateAgent
public static void updateAgent(SSOToken ssoToken, String realm, String agentName, Map attrValues, boolean bSet) throws IdRepoException, SSOException, SMSException, ConfigurationException
Updates agent attribute values.- Parameters:
ssoToken- Single Sign On token that is to be used for creation.realm- Name of realm where agent resides.agentName- Name of agent.attrValues- Map of attribute name to its values.bSet-trueto overwrite the values for the attribute.- Throws:
IdRepoException- if there are Id Repository related errors.SSOException- if the Single Sign On token is invalid or has expired.SMSException- if there are errors in service management layers.ConfigurationException- if agent does not exist.
-
updateAgentGroup
public static void updateAgentGroup(SSOToken ssoToken, String realm, String agentGroupName, Map attrValues) throws IdRepoException, SSOException, SMSException, ConfigurationException
Updates agent group attribute values.- Parameters:
ssoToken- Single Sign On token that is to be used for creation.realm- Realm where group resides.agentGroupName- Name group of agent.attrValues- Map of attribute name to its values.- Throws:
IdRepoException- if there are Id Repository related errors.SSOException- if the Single Sign On token is invalid or has expired.SMSException- if there are errors in service management layers.ConfigurationException- if attribute values map contains invalid values.
-
updateAgentGroup
public static void updateAgentGroup(SSOToken ssoToken, String realm, String agentGroupName, Map attrValues, boolean bSet) throws IdRepoException, SSOException, SMSException, ConfigurationException
Updates agent group attribute values.- Parameters:
ssoToken- Single Sign On token that is to be used for creation.realm- Name of realm where agent resides.agentGroupName- Name of agent group.attrValues- Map of attribute name to its values.bSet-trueto overwrite the values for the attribute.- Throws:
IdRepoException- if there are Id Repository related errors.SSOException- if the Single Sign On token is invalid or has expired.SMSException- if there are errors in service management layers.ConfigurationException- if attribute values map contains invalid values.
-
getAgentAttributeSchemas
public static Set getAgentAttributeSchemas(String agentTypeName) throws SMSException, SSOException
Returns a set of attribute schemas of a given agent type.- Parameters:
agentTypeName- Name of agent type.- Returns:
- a set of attribute schemas of a given agent type.
- Throws:
SSOException- if the Single Sign On token is invalid or has expired.SMSException- if there are errors in service management layers.
-
getAgentGroupAttributes
public static Map getAgentGroupAttributes(SSOToken ssoToken, String realm, String agentGroupName) throws IdRepoException, SMSException, SSOException
Returns agent group's attribute values.- Parameters:
ssoToken- Single Sign On token that is to be used for query.realm- Name of realm where agent group resides.agentGroupName- Name of agent group.- Returns:
- agent group's attribute values.
- Throws:
IdRepoException- if there are Id Repository related errors.SSOException- if the Single Sign On token is invalid or has expired.SMSException- if there are errors in service management layers.
-
getAgentAttributes
public static Map getAgentAttributes(SSOToken ssoToken, String realm, String agentName) throws IdRepoException, SMSException, SSOException
Returns agent's attribute values.- Parameters:
ssoToken- Single Sign On token that is to be used for query.realm- Realm where agent resides.agentName- Name of agent.- Returns:
- agent's attribute values.
- Throws:
IdRepoException- if there are Id Repository related errors.SSOException- if the Single Sign On token is invalid or has expired.SMSException- if there are errors in service management layers.
-
getAgentAttributes
public static Map getAgentAttributes(SSOToken ssoToken, String realm, String agentName, boolean bInherit) throws IdRepoException, SMSException, SSOException
Returns agent's attribute values.- Parameters:
ssoToken- Single Sign On token that is to be used for query.realm- Realm where agent resides.agentName- Name of agent.bInherit-trueto inherit from group.- Returns:
- agent's attribute values.
- Throws:
IdRepoException- if there are Id Repository related errors.SSOException- if the Single Sign On token is invalid or has expired.SMSException- if there are errors in service management layers.
-
getAgentAttributes
public static Map getAgentAttributes(AMIdentity amid, boolean reformat) throws IdRepoException, SMSException, SSOException
Returns agent's attribute values.- Parameters:
amid- Identity object.reformat-trueto reformat the values.- Returns:
- agent's attribute values.
- Throws:
IdRepoException- if there are Id Repository related errors.SSOException- if the Single Sign On token is invalid or has expired.SMSException- if there are errors in service management layers.
-
getAgentType
public static String getAgentType(AMIdentity amid) throws IdRepoException, SSOException
For the given Agent identity, return the value that represents the agent type.- Parameters:
amid- Identity object containing value.- Returns:
- agent type or empty string if not found.
- Throws:
IdRepoException- if there are Id Repository related errors.SSOException- if the Single Sign On token is invalid or has expired.
-
getAttributesSchemaNames
public static Set getAttributesSchemaNames(AMIdentity amid, AttributeSchema.Syntax syntax) throws SMSException, SSOException, IdRepoException
Returns a set of attribute schema names whose schema match a given syntax.- Parameters:
amid- Identity Object. Agent Type is to be gotten from it.syntax- Syntax.- Returns:
- a set of attribute schema names whose schema match a given syntax.
- Throws:
IdRepoException- if there are Id Repository related errors.SSOException- if the Single Sign On token is invalid or has expired.SMSException- if there are errors in service management layers.
-
getAttributesSchemaNames
public static Set getAttributesSchemaNames(String agentType, AttributeSchema.Type type) throws SMSException, SSOException
Returns a set of attribute schema names whose schema match a given type.- Parameters:
agentType- Agent typetype- AttributeSchema type- Returns:
- a set of attribute schema names whose schema match a given type.
- Throws:
IdRepoException- if there are Id Repository related errors.SSOException- if the Single Sign On token is invalid or has expired.SMSException- if there are errors in service management layers.
-
getResourceBundleName
public static String getResourceBundleName() throws SMSException, SSOException
Returns resource bundle name of agent service.- Returns:
- resource bundle name of agent service.
- Throws:
SMSException- if Service Schema cannot be located.SSOException- if admin single sign on token has expired.
-
getDefaultValues
public static Map getDefaultValues(String agentType, boolean bGroup) throws SMSException, SSOException
Returns the default values of attribute schemas of a given agent type.- Parameters:
agentType- Type of agent.bGroup-trueif this is for a group.- Throws:
SSOException- if the Single Sign On token is invalid or has expired.SMSException- if there are errors in service management layers.
-
getChoiceValues
public static Map getChoiceValues(String name, String agentType) throws SMSException, SSOException
Returns choice values of an attribute schema.- Parameters:
name- Name of attribute schema.agentType- Type of agent.- Returns:
- choice values of an attribute schema.
- Throws:
SSOException- if the Single Sign On token is invalid or has expired.SMSException- if there are errors in service management layers.
-
getAgentAttributeSchema
public static AttributeSchema getAgentAttributeSchema(String name, String agentTypeName) throws SMSException, SSOException
Returns attribute schema of a given agent type.- Parameters:
name- Name of attribute schema.agentTypeName- Name of agent type.- Returns:
- attribute schema of a given agent type.
- Throws:
SSOException- if the Single Sign On token is invalid or has expired.SMSException- if there are errors in service management layers.
-
getInheritedAttributeNames
public static Set getInheritedAttributeNames(AMIdentity amid) throws IdRepoException, SSOException, SMSException
Returns the inherited attribute names.- Parameters:
amid- Identity object of the agent.- Returns:
- the inherited attribute names.
- Throws:
IdRepoException- if attribute names cannot obtained.SSOException- if single sign on token is expired or invalid.SMSException
-
updateInheritance
public static void updateInheritance(AMIdentity amid, Map inherit) throws IdRepoException, SSOException, SMSException
Updates the inherited attribute names.- Parameters:
amid- Identity object of the agent.inherit- Map of attribute name to either "1" or "0". "1" to inherit and "0" not.- Throws:
IdRepoException- if attribute names cannot obtained.SSOException- if single sign on token is expired or invalid.SMSException
-
getAttributeSchemas
public static Map getAttributeSchemas(String agentType, Collection names) throws SMSException, SSOException
Returns attribute schema for a given set of attribute names.- Parameters:
agentType- Agent type.names- Set of attribute names.- Returns:
- localized names for a given set of attribute names.
- Throws:
SMSExceptionSSOException
-
getServiceResourceBundle
public static ResourceBundle getServiceResourceBundle(Locale locale) throws SMSException, SSOException
- Throws:
SMSExceptionSSOException
-
AddAgentToGroup
public static void AddAgentToGroup(AMIdentity group, AMIdentity agent) throws IdRepoException, SSOException, ConfigurationException
Adds an agent to a group.- Parameters:
group- Agent Group.agent- Agent.- Throws:
SSOException- if Single Sign on for accessing identity attribute values is invalid.IdRepoException- if unable to access attribute values.ConfigurationException- if agent's properties are locally stored.
-
supportLocalProperties
public static boolean supportLocalProperties(String agentType)
Returnstrueif an agent type support local properties.- Parameters:
agentType- Agent Type.- Returns:
trueif an agent type support local properties.
-
getLocalPropertyNames
public static Set getLocalPropertyNames(String agentType)
Returns a set of local property name if an agent type. Returns null if agent type does not support local properties.- Parameters:
agentType- Agent Type.- Returns:
- a set of local property name if an agent type.
-
deleteAgentGroups
public static void deleteAgentGroups(SSOToken ssoToken, String realm, Set agentGroups) throws IdRepoException, SSOException, SMSException
Deletes agent groups.- Parameters:
ssoToken- Single Sign On token that is to be used for deletion.realm- Realm where agent groups reside.agentGroups- Set of Agent Group object.- Throws:
IdRepoException- if unable to delete groups.SSOException- if the Single Sign On token is invalid or has expired.SMSException- if there are errors in service management layers.
-
setAgentGroup
public static boolean setAgentGroup(SSOToken ssoToken, String realm, String universalId, String groupName) throws IdRepoException, SSOException, SMSException
Set agent group. Returnstrueif group is set.- Parameters:
ssoToken- Single Sign On token that is to be used for this operation.realm- Realm name where agent and group reside.universalId- Universal ID of Agent.groupName- Name of Group object to be set.- Returns:
trueif group is set.- Throws:
IdRepoException- if group cannot be set.SSOException- if the Single Sign On token is invalid or has expired.SMSException- if there are errors in service management layers
-
setAgentGroup
public static boolean setAgentGroup(SSOToken ssoToken, String realm, AMIdentity amid, String groupName) throws IdRepoException, SSOException, SMSException
Set agent group. Returnstrueif group is set.- Parameters:
ssoToken- Single Sign On token that is to be used for this operation.realm- Realm name where agent and group reside.amid- Agent object.groupName- Name of Group object to be set.- Returns:
trueif group is set.- Throws:
IdRepoException- if group cannot be set.SSOException- if the Single Sign On token is invalid or has expired.SMSException- if there are errors in service management layers
-
setAgentGroup
public static boolean setAgentGroup(AMIdentity amid, AMIdentity newGroup) throws IdRepoException, SSOException, SMSException
Set agent group. Returnstrueif group is set.- Parameters:
amid- Agent object.newGroup- Group object to be set.- Returns:
trueif group is set.- Throws:
IdRepoException- if group cannot be set.SSOException- if the Single Sign On token is invalid or has expired.SMSException- if there are errors in service management layers
-
removeAgentGroup
public static boolean removeAgentGroup(AMIdentity amid, AMIdentity groupToRemove) throws IdRepoException, SSOException, SMSException
Removes agent from it group. Returnstrueif group is removed.- Parameters:
amid- Agent object.groupToRemove- Group object to be removed.- Returns:
trueif group is removed.- Throws:
IdRepoException- if group cannot be removed.SSOException- if the Single Sign On token is invalid or has expired.SMSException- if there are errors in service management layers
-
-