Search in sources :

Example 1 with WebflowConversationStateCipherExecutor

use of org.apereo.cas.util.cipher.WebflowConversationStateCipherExecutor in project cas by apereo.

the class CasCoreWebflowConfiguration method webflowCipherExecutor.

@Bean
@RefreshScope
public CipherExecutor webflowCipherExecutor() {
    final WebflowProperties webflow = casProperties.getWebflow();
    final EncryptionRandomizedSigningJwtCryptographyProperties crypto = webflow.getCrypto();
    boolean enabled = crypto.isEnabled();
    if (!enabled && (StringUtils.isNotBlank(crypto.getEncryption().getKey())) && StringUtils.isNotBlank(crypto.getSigning().getKey())) {
        LOGGER.warn("Webflow encryption/signing is not enabled explicitly in the configuration, yet signing/encryption keys " + "are defined for operations. CAS will proceed to enable the webflow encryption/signing functionality.");
        enabled = true;
    }
    if (enabled) {
        return new WebflowConversationStateCipherExecutor(crypto.getEncryption().getKey(), crypto.getSigning().getKey(), crypto.getAlg(), crypto.getSigning().getKeySize(), crypto.getEncryption().getKeySize());
    }
    LOGGER.warn("Webflow encryption/signing is turned off. This " + "MAY NOT be safe in a production environment. Consider using other choices to handle encryption, " + "signing and verification of webflow state.");
    return CipherExecutor.noOp();
}
Also used : WebflowConversationStateCipherExecutor(org.apereo.cas.util.cipher.WebflowConversationStateCipherExecutor) WebflowProperties(org.apereo.cas.configuration.model.webapp.WebflowProperties) EncryptionRandomizedSigningJwtCryptographyProperties(org.apereo.cas.configuration.model.core.util.EncryptionRandomizedSigningJwtCryptographyProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

EncryptionRandomizedSigningJwtCryptographyProperties (org.apereo.cas.configuration.model.core.util.EncryptionRandomizedSigningJwtCryptographyProperties)1 WebflowProperties (org.apereo.cas.configuration.model.webapp.WebflowProperties)1 WebflowConversationStateCipherExecutor (org.apereo.cas.util.cipher.WebflowConversationStateCipherExecutor)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)1 Bean (org.springframework.context.annotation.Bean)1