use of org.apereo.cas.configuration.model.support.consent.ConsentProperties in project cas by apereo.
the class CasConsentCoreConfiguration method consentCipherExecutor.
@ConditionalOnMissingBean(name = "consentCipherExecutor")
@Bean
@RefreshScope
public CipherExecutor consentCipherExecutor() {
final ConsentProperties consent = casProperties.getConsent();
final EncryptionJwtSigningJwtCryptographyProperties crypto = consent.getCrypto();
if (crypto.isEnabled()) {
return new AttributeReleaseConsentCipherExecutor(crypto.getEncryption().getKey(), crypto.getSigning().getKey(), crypto.getAlg());
}
LOGGER.debug("Consent attributes stored by CAS are not signed/encrypted.");
return CipherExecutor.noOp();
}
use of org.apereo.cas.configuration.model.support.consent.ConsentProperties in project cas by apereo.
the class AbstractConsentAction method prepareConsentForRequestContext.
/**
* Prepare consent for request context.
*
* @param requestContext the request context
*/
protected void prepareConsentForRequestContext(final RequestContext requestContext) {
final ConsentProperties consentProperties = casProperties.getConsent();
final Service service = this.authenticationRequestServiceSelectionStrategies.resolveService(WebUtils.getService(requestContext));
final RegisteredService registeredService = getRegisteredServiceForConsent(requestContext, service);
final Authentication authentication = WebUtils.getAuthentication(requestContext);
final Map<String, Object> attributes = consentEngine.resolveConsentableAttributesFrom(authentication, service, registeredService);
requestContext.getFlowScope().put("attributes", attributes);
requestContext.getFlowScope().put("principal", authentication.getPrincipal().getId());
requestContext.getFlashScope().put("service", service);
final ConsentDecision decision = consentEngine.findConsentDecision(service, registeredService, authentication);
requestContext.getFlowScope().put("option", decision == null ? ConsentOptions.ATTRIBUTE_NAME.getValue() : decision.getOptions().getValue());
final long reminder = decision == null ? consentProperties.getReminder() : decision.getReminder();
requestContext.getFlowScope().put("reminder", Long.valueOf(reminder));
requestContext.getFlowScope().put("reminderTimeUnit", decision == null ? consentProperties.getReminderTimeUnit().name() : decision.getReminderTimeUnit().name());
}
Aggregations