@Override public AuthenticationHandlerExecutionResult authenticate(final Credential credential) { LOGGER.debug("Trusting credential for: [{}]", credential); val bearingCredential = (PrincipalBearingCredential) credential; return new DefaultAuthenticationHandlerExecutionResult(this, bearingCredential, bearingCredential.getPrincipal()); }
/** * 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)); } }
/** * 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); }
return new DefaultAuthenticationHandlerExecutionResult(this, x509Credential, this.principalFactory.createPrincipal(x509Credential.getId()));
throw new FailedLoginException("Principal is null, the processing of the SPNEGO Token failed"); return new DefaultAuthenticationHandlerExecutionResult(this, new BasicCredentialMetaData(credential), spnegoCredential.getPrincipal());
val handlerResult = new DefaultAuthenticationHandlerExecutionResult(authenticator, metadata, newPrincipal, new ArrayList<>()); val scopes = CollectionUtils.toCollection(context.getRequest().getParameterValues(OAuth20Constants.SCOPE));
@Override public AuthenticationHandlerExecutionResult authenticate(final Credential credential) throws GeneralSecurityException { val httpCredential = (HttpBasedServiceCredential) credential; if (!httpCredential.getService().getProxyPolicy().isAllowedProxyCallbackUrl(httpCredential.getCallbackUrl())) { LOGGER.warn("Proxy policy for service [{}] cannot authorize the requested callback url [{}].", httpCredential.getService().getServiceId(), httpCredential.getCallbackUrl()); throw new FailedLoginException(httpCredential.getCallbackUrl() + " cannot be authorized"); } LOGGER.debug("Attempting to authenticate [{}]", httpCredential); val callbackUrl = httpCredential.getCallbackUrl(); if (!this.httpClient.isValidEndPoint(callbackUrl)) { throw new FailedLoginException(callbackUrl.toExternalForm() + " sent an unacceptable response status code"); } return new DefaultAuthenticationHandlerExecutionResult(this, httpCredential, this.principalFactory.createPrincipal(httpCredential.getId())); }
@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(); return new DefaultAuthenticationHandlerExecutionResult(this, new BasicCredentialMetaData(ntlmCredential), ntlmCredential.getPrincipal());