Class DefaultSSOService

  • All Implemented Interfaces:
    SSOUserService, java.io.Serializable, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean
    Direct Known Subclasses:
    BackofficeSSOService

    public class DefaultSSOService
    extends AbstractService
    implements SSOUserService
    Default SSO service for getting/creating user
    See Also:
    Serialized Form
    • Field Detail

      • MD5_PASSWORD_ENCODING

        protected static final java.lang.String MD5_PASSWORD_ENCODING
        See Also:
        Constant Field Values
      • SSO_PASSWORD_ENCODING

        protected static final java.lang.String SSO_PASSWORD_ENCODING
        See Also:
        Constant Field Values
      • SSO_DATABASE_USERGROUP_MAPPING

        protected static final java.lang.String SSO_DATABASE_USERGROUP_MAPPING
        See Also:
        Constant Field Values
    • Constructor Detail

      • DefaultSSOService

        public DefaultSSOService()
    • Method Detail

      • getOrCreateSSOUser

        public UserModel getOrCreateSSOUser​(java.lang.String id,
                                            java.lang.String name,
                                            java.util.Collection<java.lang.String> roles)
        Description copied from interface: SSOUserService
        Return UserModel for existing user or for the newly created.
        Specified by:
        getOrCreateSSOUser in interface SSOUserService
        Parameters:
        id - the user id
        name - the user name
        roles - user roles
        Returns:
        existing or newly created user model
      • createNewUser

        protected UserModel createNewUser​(java.lang.String id,
                                          java.lang.String name,
                                          DefaultSSOService.SSOUserMapping userMapping)
        create a new user
        Parameters:
        id - to be used as the user Id
        name - name of the user
        userMapping - user mappings (groups and user type)
        Returns:
        a new user model
      • lookupExisting

        protected UserModel lookupExisting​(java.lang.String id,
                                           DefaultSSOService.SSOUserMapping mapping)
        Check if a user exists or not
        Parameters:
        id - the user id to search for
        mapping - groups/user type
        Returns:
        return user model in case the user is found or null if not found
      • adjustUserAttributes

        protected void adjustUserAttributes​(UserModel user,
                                            DefaultSSOService.SSOUserMapping mapping)
        Adjusting user groups
        Parameters:
        user - the user to adjust the groups for
        mapping - the mapping which holds the groups
      • findMapping

        protected DefaultSSOService.SSOUserMapping findMapping​(java.util.Collection<java.lang.String> roles)
        Maps SSO usergroups to hybris type and groups. If property SSO_DATABASE_USERGROUP_MAPPING is true, the mapping is taken from database. Otherwise it takes mapping from properties file.
        Parameters:
        roles - Roles to map
        Returns:
        The mapping
      • validateMappings

        protected void validateMappings​(java.util.Collection<java.lang.String> roles,
                                        java.util.List<SamlUserGroupModel> userGroupModels)
      • getMappingForRole

        protected DefaultSSOService.SSOUserMapping getMappingForRole​(java.lang.String role)
        getting the mapping for roles
        Parameters:
        role - the role to get the mapping for
        Returns:
        SSO user mapping object which has the user type and the groups
      • setModelService

        public void setModelService​(ModelService modelService)
      • setUserService

        public void setUserService​(UserService userService)
      • setSamlUserGroupDAO

        public void setSamlUserGroupDAO​(SamlUserGroupDAO samlUserGroupDAO)