Class ValidateRemoteUser

  • All Implemented Interfaces:
    net.shibboleth.idp.authn.principal.PrincipalSupportingComponent, net.shibboleth.utilities.java.support.component.Component, net.shibboleth.utilities.java.support.component.DestructableComponent, net.shibboleth.utilities.java.support.component.InitializableComponent, org.opensaml.profile.action.ProfileAction, Aware, MessageSource, MessageSourceAware, Action

    public class ValidateRemoteUser
    extends net.shibboleth.idp.authn.AbstractValidationAction
    An action that checks for a UsernameContext and directly produces an AuthenticationResult based on that identity.

    Various optional properties are supported to control the validation process.

    Event:
    EventIds.PROCEED_EVENT_ID, AuthnEventIds.INVALID_CREDENTIALS, AuthnEventIds.NO_CREDENTIALS
    Precondition:
    ProfileRequestContext.getSubcontext(AuthenticationContext.class, false).getAttemptedFlow() != null
    Postcondition:
    If AuthenticationContext.getSubcontext(UsernameContext.class, false).getUsername() != null, then an AuthenticationResult is saved to the AuthenticationContext.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void doExecute​(org.opensaml.profile.context.ProfileRequestContext profileRequestContext, net.shibboleth.idp.authn.context.AuthenticationContext authenticationContext)
      protected boolean doPreExecute​(org.opensaml.profile.context.ProfileRequestContext profileRequestContext, net.shibboleth.idp.authn.context.AuthenticationContext authenticationContext)
      private boolean isAuthenticated​(String username)
      Check whitelist, blacklist, and matching expression for acceptance.
      protected Subject populateSubject​(Subject subject)
      void setBlacklistedUsernames​(Collection<String> blacklist)
      Set the blacklisted usernames.
      void setMatchExpression​(Pattern expression)
      Set a matching expression to apply for acceptance.
      void setWhitelistedUsernames​(Collection<String> whitelist)
      Set the whitelisted usernames.
      • Methods inherited from class net.shibboleth.idp.authn.AbstractValidationAction

        addDefaultPrincipals, buildAuthenticationResult, getClassifiedErrors, getMetricName, getRequesterLookupStrategy, getResponderLookupStrategy, getResultCachingPredicate, getSubject, getSupportedPrincipals, handleError, handleError, handleWarning, recordFailure, recordSuccess, setAddDefaultPrincipals, setClassifiedMessages, setMetricName, setRequesterLookupStrategy, setResponderLookupStrategy, setResultCachingPredicate, setSupportedPrincipals
      • Methods inherited from class net.shibboleth.idp.authn.AbstractAuthenticationAction

        doExecute, doPreExecute, setAuthenticationContextLookupStrategy
      • Methods inherited from class net.shibboleth.idp.profile.AbstractProfileAction

        doExecute, execute, getMessage, getMessage, getMessage, getProfileContextLookupStrategy, getRequestContext, getResult, setMessageSource, setProfileContextLookupStrategy
      • Methods inherited from class org.opensaml.profile.action.AbstractConditionalProfileAction

        getActivationCondition, setActivationCondition
      • Methods inherited from class org.opensaml.profile.action.AbstractProfileAction

        doPostExecute, doPostExecute, execute, getHttpServletRequest, getHttpServletResponse, getLogPrefix, setHttpServletRequest, setHttpServletResponse
      • Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent

        destroy, doDestroy, doInitialize, initialize, isDestroyed, isInitialized
      • Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent

        initialize, isInitialized
    • Field Detail

      • DEFAULT_METRIC_NAME

        @Nonnull
        @NotEmpty
        private static final String DEFAULT_METRIC_NAME
        Default prefix for metrics.
        See Also:
        Constant Field Values
      • log

        @Nonnull
        private final org.slf4j.Logger log
        Class logger.
      • whitelistedUsernames

        @Nonnull
        @NonnullElements
        private Set<String> whitelistedUsernames
        A whitelist of usernames to accept.
      • blacklistedUsernames

        @Nonnull
        @NonnullElements
        private Set<String> blacklistedUsernames
        A blacklist of usernames to deny.
      • matchExpression

        @Nullable
        private Pattern matchExpression
        A regular expression to apply for acceptance testing.
      • usernameContext

        @Nullable
        private net.shibboleth.idp.authn.context.UsernameContext usernameContext
        Username context identifying identity to validate.
    • Constructor Detail

      • ValidateRemoteUser

        public ValidateRemoteUser()
        Constructor.
    • Method Detail

      • setWhitelistedUsernames

        public void setWhitelistedUsernames​(@Nonnull @NonnullElements
                                            Collection<String> whitelist)
        Set the whitelisted usernames.
        Parameters:
        whitelist - whitelist to set
      • setBlacklistedUsernames

        public void setBlacklistedUsernames​(@Nonnull @NonnullElements
                                            Collection<String> blacklist)
        Set the blacklisted usernames.
        Parameters:
        blacklist - blacklist to set
      • setMatchExpression

        public void setMatchExpression​(@Nullable
                                       Pattern expression)
        Set a matching expression to apply for acceptance.
        Parameters:
        expression - a matching expression
      • doPreExecute

        protected boolean doPreExecute​(@Nonnull
                                       org.opensaml.profile.context.ProfileRequestContext profileRequestContext,
                                       @Nonnull
                                       net.shibboleth.idp.authn.context.AuthenticationContext authenticationContext)
        Overrides:
        doPreExecute in class net.shibboleth.idp.authn.AbstractValidationAction
      • doExecute

        protected void doExecute​(@Nonnull
                                 org.opensaml.profile.context.ProfileRequestContext profileRequestContext,
                                 @Nonnull
                                 net.shibboleth.idp.authn.context.AuthenticationContext authenticationContext)
        Overrides:
        doExecute in class net.shibboleth.idp.authn.AbstractAuthenticationAction
      • isAuthenticated

        private boolean isAuthenticated​(@Nonnull @NotEmpty
                                        String username)
        Check whitelist, blacklist, and matching expression for acceptance.
        Parameters:
        username - the username to evaluate
        Returns:
        true iff the username is acceptable
      • populateSubject

        @Nonnull
        protected Subject populateSubject​(@Nonnull
                                          Subject subject)
        Specified by:
        populateSubject in class net.shibboleth.idp.authn.AbstractValidationAction