Class AllowCurrentUserAccessPredicate
- All Implemented Interfaces:
Predicate<ProfileRequestContext>,Component,DestructableComponent,IdentifiableComponent,IdentifiedComponent,InitializableComponent
It is important to prevent users from changing their username between the registration and authentication flows. If this is allowed, it would create a loophole in the WebAuthn authentication process which could allow a user bypass. For instance, a user who starts the registration of a new WebAuthn credential, without any previous WebAuthn credentials, could then login with an inferior authentication mechanism as another user who should only be using WebAuthn (although the overall flow is the responsibility of the MFA flow logic).
More complicated comparison predicates might be needed if either the principal in the subject context and or the username in the registration context have been transformed into different forms but are still logically equivalent.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDefault comparison predicate which just compares the equality of the input strings. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BiPredicate<ProfileRequestContext,Pair<String, String>> The predicate that performs the comparison.private final org.slf4j.LoggerClass logger.private Function<ProfileRequestContext,SubjectContext> Strategy function to lookup SubjectContext.Lookup strategy to locate the WebAuthn authentication context.Lookup strategy to locate the WebAuthn registration context. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetComparisonPredicate(BiPredicate<ProfileRequestContext, Pair<String, String>> predicate) Set the predicate that performs the comparison between the principal name from the subject context (as the first item in the pair) with the username in the registration context (as the second item in the pair).voidSet the lookup strategy to use to locate theSubjectContext.voidsetWebauthnContextLookupStrategy(Function<ProfileRequestContext, WebAuthnAuthenticationContext> strategy) Set the WebAuthn authentication context lookup strategy to use.voidsetWebauthnRegistrationContextLookupStrategy(Function<ProfileRequestContext, WebAuthnRegistrationContext> strategy) Set the WebAuthn registration context lookup strategy to use.booleantest(ProfileRequestContext profileRequestContext) Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
setIdMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
doInitialize, ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentExceptionMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.IdentifiedComponent
getId
-
Field Details
-
log
Class logger. -
webauthnRegistrationContextLookupStrategy
@Nonnull private Function<ProfileRequestContext,WebAuthnRegistrationContext> webauthnRegistrationContextLookupStrategyLookup strategy to locate the WebAuthn registration context. -
webauthnContextLookupStrategy
@Nonnull private Function<ProfileRequestContext,WebAuthnAuthenticationContext> webauthnContextLookupStrategyLookup strategy to locate the WebAuthn authentication context. -
subjectContextLookupStrategy
Strategy function to lookup SubjectContext. -
comparisonPredicate
The predicate that performs the comparison.
-
-
Constructor Details
-
AllowCurrentUserAccessPredicate
public AllowCurrentUserAccessPredicate()Constructor.
-
-
Method Details
-
setWebauthnContextLookupStrategy
public void setWebauthnContextLookupStrategy(@Nonnull Function<ProfileRequestContext, WebAuthnAuthenticationContext> strategy) Set the WebAuthn authentication context lookup strategy to use.- Parameters:
strategy- lookup strategy
-
setSubjectContextLookupStrategy
public void setSubjectContextLookupStrategy(@Nonnull Function<ProfileRequestContext, SubjectContext> strategy) Set the lookup strategy to use to locate theSubjectContext.- Parameters:
strategy- lookup function to use
-
setComparisonPredicate
public void setComparisonPredicate(@Nonnull BiPredicate<ProfileRequestContext, Pair<String, String>> predicate) Set the predicate that performs the comparison between the principal name from the subject context (as the first item in the pair) with the username in the registration context (as the second item in the pair). The profile request context adds additional information if required.- Parameters:
predicate- The comparison predicate to set.
-
setWebauthnRegistrationContextLookupStrategy
public void setWebauthnRegistrationContextLookupStrategy(@Nonnull Function<ProfileRequestContext, WebAuthnRegistrationContext> strategy) Set the WebAuthn registration context lookup strategy to use.- Parameters:
strategy- lookup strategy
-
test
- Specified by:
testin interfacePredicate<ProfileRequestContext>
-