Search in sources :

Example 1 with ConsentOptions

use of org.apereo.cas.consent.ConsentOptions in project cas by apereo.

the class ConfirmConsentAction method doExecute.

@Override
protected Event doExecute(final RequestContext requestContext) {
    final HttpServletRequest request = WebUtils.getHttpServletRequestFromExternalWebflowContext(requestContext);
    final Service service = this.authenticationRequestServiceSelectionStrategies.resolveService(WebUtils.getService(requestContext));
    final RegisteredService registeredService = getRegisteredServiceForConsent(requestContext, service);
    final Authentication authentication = WebUtils.getAuthentication(requestContext);
    final int optionValue = Integer.parseInt(request.getParameter("option"));
    final ConsentOptions option = ConsentOptions.valueOf(optionValue);
    final long reminder = Long.parseLong(request.getParameter("reminder"));
    final String reminderTimeUnit = request.getParameter("reminderTimeUnit");
    final ChronoUnit unit = ChronoUnit.valueOf(reminderTimeUnit.toUpperCase());
    consentEngine.storeConsentDecision(service, registeredService, authentication, reminder, unit, option);
    return new EventFactorySupport().success(this);
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) ConsentOptions(org.apereo.cas.consent.ConsentOptions) RegisteredService(org.apereo.cas.services.RegisteredService) Authentication(org.apereo.cas.authentication.Authentication) RegisteredService(org.apereo.cas.services.RegisteredService) Service(org.apereo.cas.authentication.principal.Service) EventFactorySupport(org.springframework.webflow.action.EventFactorySupport) ChronoUnit(java.time.temporal.ChronoUnit)

Aggregations

ChronoUnit (java.time.temporal.ChronoUnit)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 Authentication (org.apereo.cas.authentication.Authentication)1 Service (org.apereo.cas.authentication.principal.Service)1 ConsentOptions (org.apereo.cas.consent.ConsentOptions)1 RegisteredService (org.apereo.cas.services.RegisteredService)1 EventFactorySupport (org.springframework.webflow.action.EventFactorySupport)1