Package org.apereo.cas.authentication
Class CoreAuthenticationUtils
- java.lang.Object
-
- org.apereo.cas.authentication.CoreAuthenticationUtils
-
public class CoreAuthenticationUtils extends java.lang.ObjectThis isCoreAuthenticationUtils.- Since:
- 5.2.0
-
-
Constructor Summary
Constructors Constructor Description CoreAuthenticationUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PrincipalResolutionContextbuildPrincipalResolutionContext(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.IAttributeMergergetAttributeMerger(org.apereo.cas.configuration.model.core.authentication.PrincipalAttributesCoreProperties.MergingStrategyTypes mergingPolicy)Gets attribute merger.static java.lang.BooleanisRememberMeAuthentication(org.apereo.cas.authentication.Authentication authentication)Is remember me recorded in authentication.static booleanisRememberMeAuthentication(org.apereo.cas.authentication.Authentication model, org.apereo.cas.validation.Assertion assertion)Is remember me authentication? looks at the authentication object to findRememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_MEand 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.IPAddressIntelligenceServicenewIpAddressIntelligenceService(org.apereo.cas.configuration.model.core.authentication.AdaptiveAuthenticationProperties adaptive)New ip address intelligence service.static org.apereo.cas.authentication.AuthenticationPasswordPolicyHandlingStrategynewPasswordPolicyHandlingStrategy(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>
TnewPersonDirectoryPrincipalResolver(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.PrincipalResolvernewPersonDirectoryPrincipalResolver(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.PrincipalElectionStrategyConflictResolvernewPrincipalElectionStrategyConflictResolver(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.
-
-
-
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 repositoryprincipalId- the principal idactiveAttributeRepositoryIdentifiers- the active attribute repository identifierscurrentPrincipal- 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 findRememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_MEand expects the assertion to also note a new login session.- Parameters:
model- the modelassertion- 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 attributesattributesToMerge- the attributes to mergemerger- 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 attributesattributesToMerge- 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 propertiesapplicationContext- 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 factoryattributeRepository- the attribute repositoryattributeMerger- the attribute mergerpersonDirectory- 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 factoryattributeRepository- the attribute repositoryattributeMerger- the attribute mergerresolverClass- the resolver classpersonDirectory- 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 factoryattributeRepository- the attribute repositoryattributeMerger- the attribute mergerpersonDirectory- 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
-
-