Class AMModelBase
- java.lang.Object
-
- com.sun.identity.console.base.model.AMModelBase
-
- All Implemented Interfaces:
AMAdminConstants,AMModel
- Direct Known Subclasses:
AgentDumpModelImpl,AgentExportPolicyModelImpl,AgentsModelImpl,AMServiceProfileModelImpl,AuthConfigurationModelImpl,AuthPropertiesModelImpl,CreateMetaDataModelImpl,DelegationModelImpl,EntitiesModelImpl,EntityModelImpl,EntityResourceOfferingModelImpl,FSAuthDomainsModelImpl,FSSAMLServiceModelImpl,IDRepoModelImpl,ImportEntityModelImpl,MAPModelBase,OAuth2ModelImpl,PolicyModelImpl,RealmResourceOfferingModelImpl,RMRealmModelImpl,SCConfigModelImpl,SCModelBase,SelectRealmModelImpl,ServerSiteModelImpl,ServicesModelImpl,SMProfileModelImpl,SocialAuthNModelImpl,STSExportPolicyModelImpl,STSHomeViewBeanModelImpl,SubConfigModelImpl,TaskModelImpl,UMChangeUserPasswordModelImpl,UMUserPasswordResetOptionsModelImpl,UMUserResourceOfferingModelImpl
public class AMModelBase extends Object implements AMModel
This class implements all the basic and commonly used methods used by view beans.All the OpenSSO model implementation classes extends from this class.
-
-
Field Summary
Fields Modifier and Type Field Description static Debugdebugdebug objectprotected Localelocaleprotected StringlocationDN-
Fields inherited from interface com.sun.identity.console.base.model.AMAdminConstants
ADMIN_CONSOLE_SERVICE, ADMIN_DISPLAY_ATTRIBUTE, ADMIN_DISPLAY_READONLY_ATTRIBUTE, AGENT_REPOSITORY_LOCATION_ATTR, AGENTS_NODE_ID, AMSDK_DEBUG_FILENAME, ATTR_USER_OLD_PASSWORD, ATTR_USER_PASSWORD, ATTR_USER_RESOURCE_OFFERING, ATTR_USER_STATUS, AUTH_CONFIG_SERVICE, CDM_CONTENT_TYPE_PROPERTY_NAME, CHOICES, CONFIGURATION_NODE_ID, CONSOLE_DEBUG_FILENAME, CONSOLE_LOCATION_DN, CONSOLE_ORG_CUSTOM_JSP_DIRECTORY, CONSOLE_UM_ENABLED_ATTR, CONSOLE_USER_ATTRS_SEARCH_KEY, CONSOLE_USER_SEARCH_KEY, CONSOLE_USER_SEARCH_RETURN_KEY, CORE_AUTH_SERVICE, CURRENT_ORG, CURRENT_PROFILE, CURRENT_REALM, DEFAULT_RB, DEFAULT_SEARCH_TIMEOUT, DISCOVERY_SERVICE, DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF, DISCOVERY_SERVICE_NAME_DYNAMIC_DISCO_ENTRIES, DISCOVERY_SERVICE_PROVIDER_RESOURCE_ID_MAPPER, DISCOVERY_SERVICE_PROVIDER_RESOURCE_ID_MAPPER_ID_MAPPER, DISCOVERY_SERVICE_PROVIDER_RESOURCE_ID_MAPPER_PROVIDER_ID, DISPLAY_ATTRIBUTE, DISPLAY_READONLY_ATTRIBUTE, DYN_LINK_COMPONENT_NAME, ENCRYPTED, FED_TAB_ID, G11N_SERIVCE_COMMON_NAME_FORMAT, G11N_SERVICE_NAME, IDREPO_SERVICE_NAME, IMAGES_PRIMARY_PRODUCT_NAME_PNG, OPERATION_ADD, OPERATION_EDIT, OPTIONAL_ATTRIBUTE, ORGANIZATION_NODE_ID, PASSWORD, PERMISSION_DELEGATE, PERMISSION_MODIFY, PERMISSION_READ, PG_SESSION_INIT_PAGETRAIL, PLATFORM_SERVICE, POLICY_SELECTED_RESPONSE_PROVIDER, POLICY_SERVICE, PREVIOUS_ORGANIZATION, PREVIOUS_REALM, PREVIOUS_TAB_ID, PW_RESET_SERVICE, REALM_NODE_ID, REQUIRED_ATTRIBUTE, REST_STS_SERVICE, ROLE_DISPLAY_OPTION_ATTRIBUTE_NAME, SAML_SERVICE, SAVE_VB_NAME, SERVICE_NAME, SESSION_SERVICE, SESSIONS_NODE_ID, SOAP_STS_SERVICE, SSO_TOKEN_LOCALE_ATTRIBUTE_NAME, SSO_TOKEN_ORGANIZATION_ATTRIBUTE_NAME, STRING_ACTIVE, STRING_FALSE, STRING_INACTIVE, SUBJECTS_NODE_ID, TAB_AGENT_PREFIX, TAB_AGENT_PREFIX_INT, URL_LOGIN, URL_LOGOUT, USER_SERVICE, USER_SERVICE_PREFERRED_LOCALE, VALUES
-
Fields inherited from interface com.sun.identity.console.base.model.AMModel
CONSOLE_PAGING_SIZE_ATTR, CONSOLE_SEARCH_RESULT_LIMIT_ATTR, CONSOLE_SEARCH_TIME_LIMIT_ATTR, DEFAULT_PAGE_SIZE, DEFAULT_SEARCH_RESULT_LIMIT, DEFAULT_SEARCH_TIME_LIMIT
-
-
Constructor Summary
Constructors Constructor Description AMModelBase()AMModelBase(jakarta.servlet.http.HttpServletRequest req)Creates a simple model using default resource bundle.AMModelBase(jakarta.servlet.http.HttpServletRequest req, String rbName)Creates a simple model.AMModelBase(jakarta.servlet.http.HttpServletRequest req, String rbName, Map map)Creates a model with user information retrieved from the user information map.AMModelBase(jakarta.servlet.http.HttpServletRequest req, Map map)Creates a model with user information retrieved from the user information map.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SetencryptString(Set values)Converts a set of string values to encrypted values.protected SetgetAttributesToDisplay(ServiceSchemaManager mgr, SchemaType schemaType, String schemaName)StringgetAuthenticatedOrgDN()Gets the organization where user authenticated to.StringgetClientType()Returns client type from SSO tokenprotected MapgetConsoleAttributes()Returns a map of the cosole service attributes configured at the realm where the user started (typically where they logged in at.)StringgetConsoleDirectory()StringgetErrorString(Throwable ex)Returns a localized error message from an exception.intgetGlobalPageSize()Returns globally defined page sizeintgetGlobalSearchResultLimit()Returns globally defined search result limit.intgetGlobalSearchTimeOutLimit()Returns globally defined search timeout limit.StringgetLocalizedServiceName(String service)Returns the localized service name.StringgetLocalizedServiceName(String service, String defaultValue)Returns the localized service name.StringgetLocalizedString(String key)Returns localized string.StringgetLocationDN()Returns location DN.static StringgetLogoutURL()Gets URL of hyperlink to logoutintgetPageSize()Returns paging page size from template if one exists otherwise page size that is defined globally.StringgetRandomString()Returns random stringSet<String>getRealmNames(String base, String filter)protected ResourceBundlegetResourceBundle()Returns resource bundle.intgetSearchResultLimit()Returns search result limit from template if one exists otherwise page size that is defined globally.intgetSearchTimeOutLimit()Returns search time limit from template if one exists otherwise page size that is defined globally.protected String[]getServerInstanceForLogMsg()StringgetServicePropertiesViewBeanURL(String serviceName)Returns properties view bean URL of a service.protected ResourceBundlegetServiceResourceBundle(String serviceName)protected ServiceSchemaManagergetServiceSchemaManager(String name)Gets service schema manager, we cache instance of this manager per HTTP requestSetgetSpecialUsers(String realmName)Returns a set of special user identities.StringgetStartDN()Gets start DNstatic StringgetStartDN(jakarta.servlet.http.HttpServletRequest req)StringgetStartDSDN()Returns directory management start DN.MapgetSupportedAgentTypes()Returns a map of supported agent type to its localized name.MapgetSupportedEntityTypes(String realmName)Returns a map of suppported entity type to its localized name.StringgetUniversalID()Returns universal ID of user.Set<String>getUserAdditionalSearchAttributes()Returns the attribute name that is used when performing searches on user entries.StringgetUserDisplayAttribute()Returns the attribute name that is used for the main user display on user entries.StringgetUserDisplayName(AMIdentity id)Returns the formated display name for user identities.StringgetUserDN()Returns DN of currently logged in user.protected voidgetUserInfo(jakarta.servlet.http.HttpServletRequest req)Returns user information from SSO token or map of serialized information.LocalegetUserLocale()Returns the preferred locale of currently logged in user.StringgetUserName()Returns currently logged in user.StringgetUserOrganization()Returns theDNof the users organization.StringgetUserSearchAttribute()Returns the attribute name that is used when performing searches on user entries.SSOTokengetUserSSOToken()Returns current user's Single Sign On Token.booleanignoreUserProfile()Returns true if the user profile is to be ignored by the console.protected voidinitialize(jakarta.servlet.http.HttpServletRequest req, String rbName)Initializes object.booleanisAmadminUser(AMIdentity amid)Returnstrueif identity is amadmin user.booleanisAMSDKEnabled()Returnstrueif server is running withAMSDKrepo enabled.protected booleanisDisplayed(AttributeSchema attrSchema)Determines whether attribute is to be displayed or notvoidlogEvent(String id, String[] data)Writes log event.voidsetLocationDN(String DN)Set location distinguished nameprotected voidvalidateUserStatusEntry(Map data)Check the value of the user status attribute.
-
-
-
Constructor Detail
-
AMModelBase
public AMModelBase(jakarta.servlet.http.HttpServletRequest req)
Creates a simple model using default resource bundle.- Parameters:
req- HTTP Servlet Request
-
AMModelBase
public AMModelBase()
-
AMModelBase
public AMModelBase(jakarta.servlet.http.HttpServletRequest req, String rbName)Creates a simple model. The LDAP location distinguished name (DN) if default to start DN of the currently logged in user.- Parameters:
req- HTTP Servlet RequestrbName- resource bundle name
-
AMModelBase
public AMModelBase(jakarta.servlet.http.HttpServletRequest req, String rbName, Map map)Creates a model with user information retrieved from the user information map.- Parameters:
req- HTTP Servlet RequestrbName- resource bundle namemap- of user information
-
AMModelBase
public AMModelBase(jakarta.servlet.http.HttpServletRequest req, Map map)Creates a model with user information retrieved from the user information map. (using default resource bundle)- Parameters:
req- HTTP Servlet Requestmap- of user information
-
-
Method Detail
-
setLocationDN
public void setLocationDN(String DN)
Set location distinguished name- Specified by:
setLocationDNin interfaceAMModel- Parameters:
DN- distinguished name
-
getLocationDN
public String getLocationDN()
Returns location DN.- Specified by:
getLocationDNin interfaceAMModel- Returns:
- location DN.
-
getUserInfo
protected void getUserInfo(jakarta.servlet.http.HttpServletRequest req)
Returns user information from SSO token or map of serialized information.
-
getUniversalID
public String getUniversalID()
Returns universal ID of user.- Specified by:
getUniversalIDin interfaceAMModel- Returns:
- Universal ID of user.
-
getUserLocale
public Locale getUserLocale()
Returns the preferred locale of currently logged in user.- Specified by:
getUserLocalein interfaceAMModel- Returns:
java.util.Localeof currently logged in user.
-
getUserSSOToken
public SSOToken getUserSSOToken()
Returns current user's Single Sign On Token.- Specified by:
getUserSSOTokenin interfaceAMModel- Returns:
- current user's Single Sign On Token.
-
initialize
protected void initialize(jakarta.servlet.http.HttpServletRequest req, String rbName)Initializes object. It does the followings- check validity of SSO token
- get user information from user map and SSO token
- read console profile information from SSO token
- Parameters:
req- HTTP Servlet RequestrbName- resource bundle name
-
getClientType
public String getClientType()
Returns client type from SSO token- Specified by:
getClientTypein interfaceAMModel- Returns:
- client type
-
getRandomString
public String getRandomString()
Returns random string- Specified by:
getRandomStringin interfaceAMModel- Returns:
- random string
-
getUserDisplayAttribute
public String getUserDisplayAttribute()
Returns the attribute name that is used for the main user display on user entries. This attribute is defined in the administration service inSearch Return Attribute. The FIRST entry in this attribute is the value returned. If the attribute contains the following valuescn uid, thencnwill be the return value.- Returns:
- attribute name used when displaying user entries.
-
getUserSearchAttribute
public String getUserSearchAttribute()
Returns the attribute name that is used when performing searches on user entries. This attribute is defined in the administration service inUser Search Key.- Returns:
- attribute name for user searches.
-
getUserAdditionalSearchAttributes
public Set<String> getUserAdditionalSearchAttributes()
Returns the attribute name that is used when performing searches on user entries. This attribute is defined in the administration service inUser Search Key.- Returns:
- attribute name for user searches.
-
getUserDN
public String getUserDN()
Returns DN of currently logged in user.
-
getUserName
public String getUserName()
Returns currently logged in user.- Specified by:
getUserNamein interfaceAMModel- Returns:
- currently logged in user.
-
getUserOrganization
public String getUserOrganization()
Returns theDNof the users organization.- Returns:
DNof the users organization.
-
getErrorString
public String getErrorString(Throwable ex)
Returns a localized error message from an exception. If the exception is of typeAMExceptionthe error code and any possible arguments will be extracted from the exception and the message will be generated from the code and arguments. All other exception types will return the message fromException.getMessage.- Specified by:
getErrorStringin interfaceAMModel- Parameters:
ex- exception- Returns:
- String error message localized to users locale
-
getResourceBundle
protected ResourceBundle getResourceBundle()
Returns resource bundle.- Returns:
- resource bundle.
-
getLocalizedString
public String getLocalizedString(String key)
Returns localized string.- Specified by:
getLocalizedStringin interfaceAMModel- Parameters:
key- Key of resource string.- Returns:
- localized string.
-
getPageSize
public int getPageSize()
Returns paging page size from template if one exists otherwise page size that is defined globally.- Specified by:
getPageSizein interfaceAMModel- Returns:
- paging page size
-
getConsoleDirectory
public String getConsoleDirectory()
- Specified by:
getConsoleDirectoryin interfaceAMModel
-
getConsoleAttributes
protected Map getConsoleAttributes()
Returns a map of the cosole service attributes configured at the realm where the user started (typically where they logged in at.) If the admin service is not configured in that realm, the defaults are taken from global configuration.
-
getGlobalPageSize
public int getGlobalPageSize()
Returns globally defined page size- Returns:
- globally defined page size.
-
getSearchResultLimit
public int getSearchResultLimit()
Returns search result limit from template if one exists otherwise page size that is defined globally.- Returns:
- search result limit.
-
getGlobalSearchResultLimit
public int getGlobalSearchResultLimit()
Returns globally defined search result limit.- Returns:
- globally defined search result limit.
-
getSearchTimeOutLimit
public int getSearchTimeOutLimit()
Returns search time limit from template if one exists otherwise page size that is defined globally.- Returns:
- search time limit.
-
getGlobalSearchTimeOutLimit
public int getGlobalSearchTimeOutLimit()
Returns globally defined search timeout limit.- Returns:
- globally defined search timeout limit.
-
getLocalizedServiceName
public String getLocalizedServiceName(String service)
Returns the localized service name.- Specified by:
getLocalizedServiceNamein interfaceAMModel- Parameters:
service- Name of service.- Returns:
- the localized service name.
-
getLocalizedServiceName
public String getLocalizedServiceName(String service, String defaultValue)
Returns the localized service name.- Parameters:
service- Name of service.defaultValue- Default value of service name if localized service name cannot be determine.- Returns:
- the localized service name.
-
getServiceResourceBundle
protected ResourceBundle getServiceResourceBundle(String serviceName)
-
getServicePropertiesViewBeanURL
public String getServicePropertiesViewBeanURL(String serviceName)
Returns properties view bean URL of a service.- Specified by:
getServicePropertiesViewBeanURLin interfaceAMModel- Parameters:
serviceName- Name of service.- Returns:
- properties view bean URL of a service. Returns null if this URL is not defined in the schema.
-
getLogoutURL
public static String getLogoutURL()
Gets URL of hyperlink to logout- Returns:
- URL of hyperlink to logout page
-
getSupportedEntityTypes
public Map getSupportedEntityTypes(String realmName)
Returns a map of suppported entity type to its localized name.- Specified by:
getSupportedEntityTypesin interfaceAMModel- Parameters:
realmName- Name of Realm.- Returns:
- a map of suppported entity type to its localized name.
-
getSupportedAgentTypes
public Map getSupportedAgentTypes()
Returns a map of supported agent type to its localized name.- Specified by:
getSupportedAgentTypesin interfaceAMModel- Returns:
- a map of supported agent type to its localized name.
-
getStartDN
public String getStartDN()
Gets start DN- Specified by:
getStartDNin interfaceAMModel- Returns:
- start DN
-
getStartDSDN
public String getStartDSDN()
Returns directory management start DN.- Specified by:
getStartDSDNin interfaceAMModel- Returns:
- directory management start DN.
-
getAttributesToDisplay
protected Set getAttributesToDisplay(ServiceSchemaManager mgr, SchemaType schemaType, String schemaName)
-
isDisplayed
protected boolean isDisplayed(AttributeSchema attrSchema)
Determines whether attribute is to be displayed or not- Parameters:
attrSchema- - attribute schema- Returns:
- true if
-
getServiceSchemaManager
protected ServiceSchemaManager getServiceSchemaManager(String name) throws SSOException, SMSException
Gets service schema manager, we cache instance of this manager per HTTP request- Parameters:
name- of service- Returns:
- service schema manager
- Throws:
SSOException- when SSO token is invalidSMSException- when we are unable to retrieve the service schema manager
-
encryptString
public Set encryptString(Set values)
Converts a set of string values to encrypted values.AMPasswordUtil.encryptwill be called on each value in the set to convert the current value to an encrypted value.- Parameters:
values- containing string values- Returns:
- Set of encrypted data.
-
getStartDN
public static String getStartDN(jakarta.servlet.http.HttpServletRequest req)
-
getAuthenticatedOrgDN
public String getAuthenticatedOrgDN()
Gets the organization where user authenticated to. This value is found in single-sign on token. return organization where user authenticated.
-
validateUserStatusEntry
protected void validateUserStatusEntry(Map data)
Check the value of the user status attribute. It needs to be either 'Active' or 'Inactive' for the display to be set correctly.
-
ignoreUserProfile
public boolean ignoreUserProfile()
Returns true if the user profile is to be ignored by the console. The authentication service sets a property in the users session based on the properties in the core authentication service.- Specified by:
ignoreUserProfilein interfaceAMModel- Returns:
- true if the user profile should be ignored.
-
getUserDisplayName
public String getUserDisplayName(AMIdentity id)
Returns the formated display name for user identities. This is needed to handle the situation where the attribute displayed for the user is not the same as the naming attribute. It is also possible that the attribute being displayed has multiple values. In the multiple value situation each of the values will be separated by a semicolon ";".- Specified by:
getUserDisplayNamein interfaceAMModel- Parameters:
id- identity of the user being displayed.- Returns:
- String value of the attribute to be displayed.
-
getSpecialUsers
public Set getSpecialUsers(String realmName)
Returns a set of special user identities. This set of identities typically should not be displayed in the console.- Specified by:
getSpecialUsersin interfaceAMModel- Parameters:
realmName- Name of Realm.- Returns:
- a set of
AMIdentityentries that should not be displayed in the console.
-
getRealmNames
public Set<String> getRealmNames(String base, String filter) throws AMConsoleException
- Specified by:
getRealmNamesin interfaceAMModel- Throws:
AMConsoleException
-
isAMSDKEnabled
public boolean isAMSDKEnabled()
Returnstrueif server is running withAMSDKrepo enabled.- Specified by:
isAMSDKEnabledin interfaceAMModel- Returns:
trueif server is running withAMSDKrepo enabled.
-
getServerInstanceForLogMsg
protected String[] getServerInstanceForLogMsg()
-
isAmadminUser
public boolean isAmadminUser(AMIdentity amid)
Description copied from interface:AMModelReturnstrueif identity is amadmin user.- Specified by:
isAmadminUserin interfaceAMModel- Parameters:
amid- user object.- Returns:
trueif identity is amadmin user.
-
-