/** * Authenticate ecp request. * * @param credential the credential * @param authnRequest the authn request * @return the authentication */ protected Authentication authenticateEcpRequest(final Credential credential, final Pair<AuthnRequest, MessageContext> authnRequest) { val issuer = SamlIdPUtils.getIssuerFromSamlObject(authnRequest.getKey()); LOGGER.debug("Located issuer [{}] from request prior to authenticating [{}]", issuer, credential.getId()); val service = webApplicationServiceFactory.createService(issuer); LOGGER.debug("Executing authentication request for service [{}] on behalf of credential id [{}]", service, credential.getId()); val authenticationResult = authenticationSystemSupport.handleAndFinalizeSingleAuthenticationTransaction(service, credential); return authenticationResult.getAuthentication(); }
authenticationSystemSupport.handleAndFinalizeSingleAuthenticationTransaction(service, credential); val authenticationResult = builder .collect(authn) .build(this.authenticationSystemSupport.getPrincipalElectionStrategy(), service); return this.serviceTicketResourceEntityResponseFactory.build(tgtId, service, authenticationResult);
/** * Handle authentication transaction and grant ticket granting ticket. * * @param context the context * @return the set */ protected Set<Event> handleAuthenticationTransactionAndGrantTicketGrantingTicket(final RequestContext context) { val response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context); try { val credential = getCredentialFromContext(context); val builderResult = WebUtils.getAuthenticationResultBuilder(context); LOGGER.debug("Handling authentication transaction for credential [{}]", credential); val service = WebUtils.getService(context); val builder = this.authenticationSystemSupport.handleAuthenticationTransaction(service, builderResult, credential); LOGGER.debug("Issuing ticket-granting tickets for service [{}]", service); return CollectionUtils.wrapSet(grantTicketGrantingTicketToAuthenticationResult(context, builder, service)); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); val messageContext = context.getMessageContext(); messageContext.addMessage(new MessageBuilder() .error() .code(DEFAULT_MESSAGE_BUNDLE_PREFIX.concat(e.getClass().getSimpleName())) .build()); response.setStatus(HttpStatus.UNAUTHORIZED.value()); return CollectionUtils.wrapSet(getAuthenticationFailureErrorEvent(context)); } }
val builder = this.authenticationSystemSupport.establishAuthenticationContextFromInitial(authentication, credential);
val service = WebUtils.getService(context); if (credential != null) { val builder = this.authenticationSystemSupport.handleInitialAuthenticationTransaction(service, credential); if (builder.getInitialAuthentication().isPresent()) { WebUtils.putAuthenticationResultBuilder(builder, context);
.establishAuthenticationContextFromInitial(authentication); final AuthenticationResult authenticationResult = authenticationResultBuilder.build(service);
/** * Handle proxy granting ticket delivery. * * @param serviceTicketId the service ticket id * @param credential the service credential * @return the ticket granting ticket * @throws AuthenticationException the authentication exception * @throws AbstractTicketException the abstract ticket exception */ public TicketGrantingTicket handleProxyGrantingTicketDelivery(final String serviceTicketId, final Credential credential) throws AuthenticationException, AbstractTicketException { val serviceTicket = this.centralAuthenticationService.getTicket(serviceTicketId, ServiceTicket.class); val authenticationResult = this.authenticationSystemSupport.handleAndFinalizeSingleAuthenticationTransaction(serviceTicket.getService(), credential); val proxyGrantingTicketId = this.centralAuthenticationService.createProxyGrantingTicket(serviceTicketId, authenticationResult); LOGGER.debug("Generated proxy-granting ticket [{}] off of service ticket [{}] and credential [{}]", proxyGrantingTicketId.getId(), serviceTicketId, credential); return proxyGrantingTicketId; }
authenticationSystemSupport.handleAndFinalizeSingleAuthenticationTransaction(service, credential); if (authenticationResult == null) { throw new FailedLoginException("Authentication failed");
/** * Create ticket granting ticket for request ticket granting ticket. * * @param requestBody the request body * @param request the request * @return the ticket granting ticket */ protected TicketGrantingTicket createTicketGrantingTicketForRequest(final MultiValueMap<String, String> requestBody, final HttpServletRequest request) { val credential = this.credentialFactory.fromRequest(request, requestBody); if (credential == null || credential.isEmpty()) { throw new BadRestRequestException("No credentials are provided or extracted to authenticate the REST request"); } val service = this.serviceFactory.createService(request); val authenticationResult = authenticationSystemSupport.handleAndFinalizeSingleAuthenticationTransaction(service, credential); return centralAuthenticationService.createTicketGrantingTicket(authenticationResult); } }
: null; val authenticationResult = authenticationSystemSupport.handleAndFinalizeSingleAuthenticationTransaction(service, casCredential); if (authenticationResult == null) { throw new CredentialsException("Could not authenticate the provided credentials");
val result = this.authenticationSystemSupport.handleAndFinalizeSingleAuthenticationTransaction(selectedService, credential); val authentication = result.getAuthentication();
this.authenticationSystemSupport.handleAndFinalizeSingleAuthenticationTransaction(service, credential); val serviceTicketId = this.centralAuthenticationService.grantServiceTicket(ticketGrantingTicketId, service, authenticationResult); WebUtils.putServiceTicketInRequestScope(context, serviceTicketId);