/** * Helper method to construct a handler result * on successful authentication events. * * @param credential the credential on which the authentication was successfully performed. * Note that this credential instance may be different from what was originally provided * as transformation of the username may have occurred, if one is in fact defined. * @param principal the resolved principal * @param warnings the warnings * @return the constructed handler result */ protected AuthenticationHandlerExecutionResult createHandlerResult(final @NonNull Credential credential, final @NonNull Principal principal, final List<MessageDescriptor> warnings) { return new DefaultAuthenticationHandlerExecutionResult(this, new BasicCredentialMetaData(credential), principal, warnings); }
/** * Helper method to construct a handler result * on successful authentication events. * * @param credential the credential on which the authentication was successfully performed. * Note that this credential instance may be different from what was originally provided * as transformation of the username may have occurred, if one is in fact defined. * @param principal the resolved principal * @return the constructed handler result */ protected AuthenticationHandlerExecutionResult createHandlerResult(final @NonNull Credential credential, final @NonNull Principal principal) { return new DefaultAuthenticationHandlerExecutionResult(this, new BasicCredentialMetaData(credential), principal, new ArrayList<>(0)); } }
@Override public AuthenticationHandlerExecutionResult authenticate(final Credential credential) throws GeneralSecurityException { val c = (OpenIdCredential) credential; val t = this.ticketRegistry.getTicket(c.getTicketGrantingTicketId(), TicketGrantingTicket.class); if (t == null || t.isExpired()) { throw new FailedLoginException("Ticket-granting ticket is null or expired."); } val principal = t.getAuthentication().getPrincipal(); if (!principal.getId().equals(c.getUsername())) { throw new FailedLoginException("Principal ID mismatch"); } return new DefaultAuthenticationHandlerExecutionResult(this, new BasicCredentialMetaData(c), principal); }
throw new FailedLoginException("Principal is null, the processing of the SPNEGO Token failed"); return new DefaultAuthenticationHandlerExecutionResult(this, new BasicCredentialMetaData(credential), spnegoCredential.getPrincipal());
credentials.forEach(cred -> builder.addCredential(new BasicCredentialMetaData(cred)));
val metadata = new BasicCredentialMetaData(new BasicIdentifiableCredential(profile.getId())); val handlerResult = new DefaultAuthenticationHandlerExecutionResult(authenticator, metadata, newPrincipal, new ArrayList<>()); val scopes = CollectionUtils.toCollection(context.getRequest().getParameterValues(OAuth20Constants.SCOPE));
throw new FailedLoginException(); return new DefaultAuthenticationHandlerExecutionResult(this, new BasicCredentialMetaData(ntlmCredential), ntlmCredential.getPrincipal());