/** {@inheritDoc} */ @Override @Nonnull protected Subject populateSubject(@Nonnull final Subject subject) { subject.getPrincipals().add(new UsernamePrincipal(usernameContext.getUsername())); return subject; } }
if (username != null && !username.isEmpty()) { log.debug("{} User identity extracted from REMOTE_USER: {}", getLogPrefix(), username); authenticationContext.getSubcontext(UsernameContext.class, true).setUsername( applyTransforms(username)); return; if (attr != null && !attr.toString().isEmpty()) { log.debug("{} User identity extracted from attribute {}: {}", getLogPrefix(), s, attr); authenticationContext.getSubcontext(UsernameContext.class, true).setUsername( applyTransforms(attr.toString())); return; if (username != null && !username.isEmpty()) { log.debug("{} User identity extracted from header {}: {}", getLogPrefix(), s, username); authenticationContext.getSubcontext(UsernameContext.class, true).setUsername( applyTransforms(username)); return;
/** {@inheritDoc} */ @Override protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext, @Nonnull final AuthenticationContext authenticationContext) { if (!isAuthenticated(usernameContext.getUsername())) { log.info("{} User '{}' was not valid", getLogPrefix(), usernameContext.getUsername()); ActionSupport.buildEvent(profileRequestContext, AuthnEventIds.INVALID_CREDENTIALS); recordFailure(); return; } log.info("{} Validated user '{}'", getLogPrefix(), usernameContext.getUsername()); recordSuccess(); buildAuthenticationResult(profileRequestContext, authenticationContext); }
/** {@inheritDoc} */ @Override protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext, @Nonnull final AuthenticationContext authenticationContext) { if (!super.doPreExecute(profileRequestContext, authenticationContext)) { return false; } if (authenticationContext.getAttemptedFlow() == null) { log.debug("{} No attempted flow within authentication context", getLogPrefix()); ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX); recordFailure(); return false; } usernameContext = authenticationContext.getSubcontext(UsernameContext.class); if (usernameContext == null) { log.debug("{} No UsernameContext available within authentication context", getLogPrefix()); ActionSupport.buildEvent(profileRequestContext, AuthnEventIds.NO_CREDENTIALS); return false; } if (usernameContext.getUsername() == null) { log.debug("{} No username available within UsernameContext", getLogPrefix()); ActionSupport.buildEvent(profileRequestContext, AuthnEventIds.NO_CREDENTIALS); return false; } return true; }