Class AMModelBase

    • Field Detail

      • debug

        public static Debug debug
        debug object
      • locationDN

        protected String locationDN
      • locale

        protected Locale locale
    • 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 Request
        rbName - 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 Request
        rbName - resource bundle name
        map - 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 Request
        map - of user information
    • Method Detail

      • setLocationDN

        public void setLocationDN​(String DN)
        Set location distinguished name
        Specified by:
        setLocationDN in interface AMModel
        Parameters:
        DN - distinguished name
      • getLocationDN

        public String getLocationDN()
        Returns location DN.
        Specified by:
        getLocationDN in interface AMModel
        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:
        getUniversalID in interface AMModel
        Returns:
        Universal ID of user.
      • getUserLocale

        public Locale getUserLocale()
        Returns the preferred locale of currently logged in user.
        Specified by:
        getUserLocale in interface AMModel
        Returns:
        java.util.Locale of currently logged in user.
      • getUserSSOToken

        public SSOToken getUserSSOToken()
        Returns current user's Single Sign On Token.
        Specified by:
        getUserSSOToken in interface AMModel
        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
        1. check validity of SSO token
        2. get user information from user map and SSO token
        3. read console profile information from SSO token
        Parameters:
        req - HTTP Servlet Request
        rbName - resource bundle name
      • getClientType

        public String getClientType()
        Returns client type from SSO token
        Specified by:
        getClientType in interface AMModel
        Returns:
        client type
      • getRandomString

        public String getRandomString()
        Returns random string
        Specified by:
        getRandomString in interface AMModel
        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 in Search Return Attribute. The FIRST entry in this attribute is the value returned. If the attribute contains the following values cn uid, then cn will 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 in User 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 in User Search Key.
        Returns:
        attribute name for user searches.
      • getUserDN

        public String getUserDN()
        Returns DN of currently logged in user.
        Specified by:
        getUserDN in interface AMModel
        Returns:
        DN of currently logged in user.
      • getUserName

        public String getUserName()
        Returns currently logged in user.
        Specified by:
        getUserName in interface AMModel
        Returns:
        currently logged in user.
      • getUserOrganization

        public String getUserOrganization()
        Returns the DN of the users organization.
        Returns:
        DN of the users organization.
      • getErrorString

        public String getErrorString​(Throwable ex)
        Returns a localized error message from an exception. If the exception is of type AMException the 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 from Exception.getMessage.
        Specified by:
        getErrorString in interface AMModel
        Parameters:
        ex - exception
        Returns:
        String error message localized to users locale
      • logEvent

        public void logEvent​(String id,
                             String[] data)
        Writes log event.
        Specified by:
        logEvent in interface AMModel
        Parameters:
        id - Log Message ID.
        data - Log Data.
      • getResourceBundle

        protected ResourceBundle getResourceBundle()
        Returns resource bundle.
        Returns:
        resource bundle.
      • getLocalizedString

        public String getLocalizedString​(String key)
        Returns localized string.
        Specified by:
        getLocalizedString in interface AMModel
        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:
        getPageSize in interface AMModel
        Returns:
        paging page size
      • 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:
        getLocalizedServiceName in interface AMModel
        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:
        getServicePropertiesViewBeanURL in interface AMModel
        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:
        getSupportedEntityTypes in interface AMModel
        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:
        getSupportedAgentTypes in interface AMModel
        Returns:
        a map of supported agent type to its localized name.
      • getStartDN

        public String getStartDN()
        Gets start DN
        Specified by:
        getStartDN in interface AMModel
        Returns:
        start DN
      • getStartDSDN

        public String getStartDSDN()
        Returns directory management start DN.
        Specified by:
        getStartDSDN in interface AMModel
        Returns:
        directory management start DN.
      • 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 invalid
        SMSException - 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.encrypt will 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:
        ignoreUserProfile in interface AMModel
        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:
        getUserDisplayName in interface AMModel
        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:
        getSpecialUsers in interface AMModel
        Parameters:
        realmName - Name of Realm.
        Returns:
        a set of AMIdentity entries that should not be displayed in the console.
      • isAMSDKEnabled

        public boolean isAMSDKEnabled()
        Returns true if server is running with AMSDK repo enabled.
        Specified by:
        isAMSDKEnabled in interface AMModel
        Returns:
        true if server is running with AMSDK repo enabled.
      • getServerInstanceForLogMsg

        protected String[] getServerInstanceForLogMsg()
      • isAmadminUser

        public boolean isAmadminUser​(AMIdentity amid)
        Description copied from interface: AMModel
        Returns true if identity is amadmin user.
        Specified by:
        isAmadminUser in interface AMModel
        Parameters:
        amid - user object.
        Returns:
        true if identity is amadmin user.