Class CoreAuthenticationUtils

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static PrincipalResolutionContext buildPrincipalResolutionContext​(org.apereo.cas.authentication.principal.PrincipalFactory principalFactory, org.apereo.services.persondir.IPersonAttributeDao attributeRepository, org.apereo.services.persondir.support.merger.IAttributeMerger attributeMerger, org.apereo.cas.configuration.model.core.authentication.PersonDirectoryPrincipalResolverProperties... personDirectory)
      New PrincipalResolutionContext.
      static java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> convertAttributeValuesToMultiValuedObjects​(java.util.Map<java.lang.String,​java.lang.Object> attributes)
      Convert attribute values to multi valued objects.
      static org.apereo.services.persondir.support.merger.IAttributeMerger getAttributeMerger​(org.apereo.cas.configuration.model.core.authentication.PrincipalAttributesCoreProperties.MergingStrategyTypes mergingPolicy)
      Gets attribute merger.
      static java.lang.Boolean isRememberMeAuthentication​(org.apereo.cas.authentication.Authentication authentication)
      Is remember me recorded in authentication.
      static boolean isRememberMeAuthentication​(org.apereo.cas.authentication.Authentication model, org.apereo.cas.validation.Assertion assertion)
      Is remember me authentication? looks at the authentication object to find RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME and expects the assertion to also note a new login session.
      static java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> mergeAttributes​(java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> currentAttributes, java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> attributesToMerge)
      Merge attributes map.
      static java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> mergeAttributes​(java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> currentAttributes, java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> attributesToMerge, org.apereo.services.persondir.support.merger.IAttributeMerger merger)
      Merge attributes map.
      static java.util.Collection<org.apereo.cas.authentication.AuthenticationPolicy> newAuthenticationPolicy​(org.apereo.cas.configuration.model.core.authentication.AuthenticationPolicyProperties policyProps)
      New authentication policy collection.
      static java.util.function.Predicate<org.apereo.cas.authentication.Credential> newCredentialSelectionPredicate​(java.lang.String selectionCriteria)
      Gets credential selection predicate.
      static org.apereo.cas.authentication.adaptive.intel.IPAddressIntelligenceService newIpAddressIntelligenceService​(org.apereo.cas.configuration.model.core.authentication.AdaptiveAuthenticationProperties adaptive)
      New ip address intelligence service.
      static org.apereo.cas.authentication.AuthenticationPasswordPolicyHandlingStrategy newPasswordPolicyHandlingStrategy​(org.apereo.cas.configuration.model.core.authentication.PasswordPolicyProperties properties, org.springframework.context.ApplicationContext applicationContext)
      New password policy handling strategy.
      static <T extends org.apereo.cas.authentication.principal.PrincipalResolver>
      T
      newPersonDirectoryPrincipalResolver​(org.apereo.cas.authentication.principal.PrincipalFactory principalFactory, org.apereo.services.persondir.IPersonAttributeDao attributeRepository, org.apereo.services.persondir.support.merger.IAttributeMerger attributeMerger, java.lang.Class<T> resolverClass, org.apereo.cas.configuration.model.core.authentication.PersonDirectoryPrincipalResolverProperties... personDirectory)
      New person directory principal resolver.
      static org.apereo.cas.authentication.principal.PrincipalResolver newPersonDirectoryPrincipalResolver​(org.apereo.cas.authentication.principal.PrincipalFactory principalFactory, org.apereo.services.persondir.IPersonAttributeDao attributeRepository, org.apereo.services.persondir.support.merger.IAttributeMerger attributeMerger, org.apereo.cas.configuration.model.core.authentication.PersonDirectoryPrincipalResolverProperties... personDirectory)
      New person directory principal resolver.
      static org.apereo.cas.authentication.PrincipalElectionStrategyConflictResolver newPrincipalElectionStrategyConflictResolver​(org.apereo.cas.configuration.model.core.authentication.PersonDirectoryPrincipalResolverProperties properties)
      New principal election strategy conflict resolver.
      static java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> retrieveAttributesFromAttributeRepository​(org.apereo.services.persondir.IPersonAttributeDao attributeRepository, java.lang.String principalId, java.util.Set<java.lang.String> activeAttributeRepositoryIdentifiers, java.util.Optional<org.apereo.cas.authentication.principal.Principal> currentPrincipal)
      Retrieve attributes from attribute repository and return map.
      static java.util.Map<java.lang.String,​java.lang.Object> transformPrincipalAttributesListIntoMap​(java.util.List<java.lang.String> list)
      Transform principal attributes list into map map.
      static com.google.common.collect.Multimap<java.lang.String,​java.lang.Object> transformPrincipalAttributesListIntoMultiMap​(java.util.List<java.lang.String> list)
      Transform principal attributes into map.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CoreAuthenticationUtils

        public CoreAuthenticationUtils()
    • Method Detail

      • convertAttributeValuesToMultiValuedObjects

        public static java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> convertAttributeValuesToMultiValuedObjects​(java.util.Map<java.lang.String,​java.lang.Object> attributes)
        Convert attribute values to multi valued objects.
        Parameters:
        attributes - the attributes
        Returns:
        the map of attributes to return
      • retrieveAttributesFromAttributeRepository

        public static java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> retrieveAttributesFromAttributeRepository​(org.apereo.services.persondir.IPersonAttributeDao attributeRepository,
                                                                                                                                       java.lang.String principalId,
                                                                                                                                       java.util.Set<java.lang.String> activeAttributeRepositoryIdentifiers,
                                                                                                                                       java.util.Optional<org.apereo.cas.authentication.principal.Principal> currentPrincipal)
        Retrieve attributes from attribute repository and return map.
        Parameters:
        attributeRepository - the attribute repository
        principalId - the principal id
        activeAttributeRepositoryIdentifiers - the active attribute repository identifiers
        currentPrincipal - the current principal
        Returns:
        the map or null
      • getAttributeMerger

        public static org.apereo.services.persondir.support.merger.IAttributeMerger getAttributeMerger​(org.apereo.cas.configuration.model.core.authentication.PrincipalAttributesCoreProperties.MergingStrategyTypes mergingPolicy)
        Gets attribute merger.
        Parameters:
        mergingPolicy - the merging policy
        Returns:
        the attribute merger
      • isRememberMeAuthentication

        public static boolean isRememberMeAuthentication​(org.apereo.cas.authentication.Authentication model,
                                                         org.apereo.cas.validation.Assertion assertion)
        Is remember me authentication? looks at the authentication object to find RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME and expects the assertion to also note a new login session.
        Parameters:
        model - the model
        assertion - the assertion
        Returns:
        true if remember-me, false if otherwise.
      • isRememberMeAuthentication

        public static java.lang.Boolean isRememberMeAuthentication​(org.apereo.cas.authentication.Authentication authentication)
        Is remember me recorded in authentication.
        Parameters:
        authentication - the authentication
        Returns:
        the boolean
      • mergeAttributes

        public static java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> mergeAttributes​(java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> currentAttributes,
                                                                                                             java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> attributesToMerge,
                                                                                                             org.apereo.services.persondir.support.merger.IAttributeMerger merger)
        Merge attributes map.
        Parameters:
        currentAttributes - the current attributes
        attributesToMerge - the attributes to merge
        merger - the merger
        Returns:
        the map
      • mergeAttributes

        public static java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> mergeAttributes​(java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> currentAttributes,
                                                                                                             java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> attributesToMerge)
        Merge attributes map.
        Parameters:
        currentAttributes - the current attributes
        attributesToMerge - the attributes to merge
        Returns:
        the map
      • transformPrincipalAttributesListIntoMap

        public static java.util.Map<java.lang.String,​java.lang.Object> transformPrincipalAttributesListIntoMap​(java.util.List<java.lang.String> list)
        Transform principal attributes list into map map.
        Parameters:
        list - the list
        Returns:
        the map
      • transformPrincipalAttributesListIntoMultiMap

        public static com.google.common.collect.Multimap<java.lang.String,​java.lang.Object> transformPrincipalAttributesListIntoMultiMap​(java.util.List<java.lang.String> list)
        Transform principal attributes into map. Items in the list are defined in the syntax of "cn", or "cn:commonName" for virtual renaming and maps.
        Parameters:
        list - the list
        Returns:
        the map
      • newCredentialSelectionPredicate

        public static java.util.function.Predicate<org.apereo.cas.authentication.Credential> newCredentialSelectionPredicate​(java.lang.String selectionCriteria)
        Gets credential selection predicate.
        Parameters:
        selectionCriteria - the selection criteria
        Returns:
        the credential selection predicate
      • newPasswordPolicyHandlingStrategy

        public static org.apereo.cas.authentication.AuthenticationPasswordPolicyHandlingStrategy newPasswordPolicyHandlingStrategy​(org.apereo.cas.configuration.model.core.authentication.PasswordPolicyProperties properties,
                                                                                                                                   org.springframework.context.ApplicationContext applicationContext)
        New password policy handling strategy.
        Parameters:
        properties - the properties
        applicationContext - the application context
        Returns:
        the authentication password policy handling strategy
      • newPersonDirectoryPrincipalResolver

        public static org.apereo.cas.authentication.principal.PrincipalResolver newPersonDirectoryPrincipalResolver​(org.apereo.cas.authentication.principal.PrincipalFactory principalFactory,
                                                                                                                    org.apereo.services.persondir.IPersonAttributeDao attributeRepository,
                                                                                                                    org.apereo.services.persondir.support.merger.IAttributeMerger attributeMerger,
                                                                                                                    org.apereo.cas.configuration.model.core.authentication.PersonDirectoryPrincipalResolverProperties... personDirectory)
        New person directory principal resolver.
        Parameters:
        principalFactory - the principal factory
        attributeRepository - the attribute repository
        attributeMerger - the attribute merger
        personDirectory - the person directory
        Returns:
        the principal resolver
      • newPersonDirectoryPrincipalResolver

        public static <T extends org.apereo.cas.authentication.principal.PrincipalResolver> T newPersonDirectoryPrincipalResolver​(org.apereo.cas.authentication.principal.PrincipalFactory principalFactory,
                                                                                                                                  org.apereo.services.persondir.IPersonAttributeDao attributeRepository,
                                                                                                                                  org.apereo.services.persondir.support.merger.IAttributeMerger attributeMerger,
                                                                                                                                  java.lang.Class<T> resolverClass,
                                                                                                                                  org.apereo.cas.configuration.model.core.authentication.PersonDirectoryPrincipalResolverProperties... personDirectory)
        New person directory principal resolver.
        Type Parameters:
        T - the type parameter
        Parameters:
        principalFactory - the principal factory
        attributeRepository - the attribute repository
        attributeMerger - the attribute merger
        resolverClass - the resolver class
        personDirectory - the person directory
        Returns:
        the resolver
      • buildPrincipalResolutionContext

        public static PrincipalResolutionContext buildPrincipalResolutionContext​(org.apereo.cas.authentication.principal.PrincipalFactory principalFactory,
                                                                                 org.apereo.services.persondir.IPersonAttributeDao attributeRepository,
                                                                                 org.apereo.services.persondir.support.merger.IAttributeMerger attributeMerger,
                                                                                 org.apereo.cas.configuration.model.core.authentication.PersonDirectoryPrincipalResolverProperties... personDirectory)
        New PrincipalResolutionContext.
        Parameters:
        principalFactory - the principal factory
        attributeRepository - the attribute repository
        attributeMerger - the attribute merger
        personDirectory - the person directory properties
        Returns:
        the resolver
      • newAuthenticationPolicy

        public static java.util.Collection<org.apereo.cas.authentication.AuthenticationPolicy> newAuthenticationPolicy​(org.apereo.cas.configuration.model.core.authentication.AuthenticationPolicyProperties policyProps)
        New authentication policy collection.
        Parameters:
        policyProps - the policy props
        Returns:
        the collection
      • newIpAddressIntelligenceService

        public static org.apereo.cas.authentication.adaptive.intel.IPAddressIntelligenceService newIpAddressIntelligenceService​(org.apereo.cas.configuration.model.core.authentication.AdaptiveAuthenticationProperties adaptive)
        New ip address intelligence service.
        Parameters:
        adaptive - the adaptive
        Returns:
        the ip address intelligence service
      • newPrincipalElectionStrategyConflictResolver

        public static org.apereo.cas.authentication.PrincipalElectionStrategyConflictResolver newPrincipalElectionStrategyConflictResolver​(org.apereo.cas.configuration.model.core.authentication.PersonDirectoryPrincipalResolverProperties properties)
        New principal election strategy conflict resolver.
        Parameters:
        properties - the properties
        Returns:
        the principal election strategy conflict resolver