use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class CasCookieConfiguration method cookieCipherExecutor.
@ConditionalOnMissingBean(name = "cookieCipherExecutor")
@RefreshScope
@Bean
public CipherExecutor cookieCipherExecutor() {
final EncryptionJwtSigningJwtCryptographyProperties crypto = casProperties.getTgc().getCrypto();
boolean enabled = crypto.isEnabled();
if (!enabled && (StringUtils.isNotBlank(crypto.getEncryption().getKey())) && StringUtils.isNotBlank(crypto.getSigning().getKey())) {
LOGGER.warn("Token encryption/signing is not enabled explicitly in the configuration, yet signing/encryption keys " + "are defined for operations. CAS will proceed to enable the cookie encryption/signing functionality.");
enabled = true;
}
if (enabled) {
return new TicketGrantingCookieCipherExecutor(crypto.getEncryption().getKey(), crypto.getSigning().getKey(), crypto.getAlg());
}
LOGGER.warn("Ticket-granting cookie 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 ticket-granting cookies.");
return CipherExecutor.noOp();
}
use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class CasCoreAuthenticationHandlersConfiguration method acceptUsersAuthenticationHandler.
@RefreshScope
@Bean
public AuthenticationHandler acceptUsersAuthenticationHandler() {
final AcceptAuthenticationProperties props = casProperties.getAuthn().getAccept();
final AcceptUsersAuthenticationHandler h = new AcceptUsersAuthenticationHandler(props.getName(), servicesManager, acceptUsersPrincipalFactory(), null, getParsedUsers());
h.setPasswordEncoder(PasswordEncoderUtils.newPasswordEncoder(props.getPasswordEncoder()));
if (acceptPasswordPolicyConfiguration != null) {
h.setPasswordPolicyConfiguration(acceptPasswordPolicyConfiguration);
}
h.setCredentialSelectionPredicate(CoreAuthenticationUtils.newCredentialSelectionPredicate(props.getCredentialCriteria()));
h.setPrincipalNameTransformer(PrincipalNameTransformerUtils.newPrincipalNameTransformer(props.getPrincipalTransformation()));
return h;
}
use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class CasCoreAuthenticationSupportConfiguration method authenticationContextValidator.
@RefreshScope
@Bean
@ConditionalOnMissingBean(name = "authenticationContextValidator")
public AuthenticationContextValidator authenticationContextValidator() {
final MultifactorAuthenticationProperties mfa = casProperties.getAuthn().getMfa();
final String contextAttribute = mfa.getAuthenticationContextAttribute();
final String failureMode = mfa.getGlobalFailureMode();
final String authnAttributeName = mfa.getTrusted().getAuthenticationContextAttribute();
return new DefaultAuthenticationContextValidator(contextAttribute, failureMode, authnAttributeName);
}
use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class U2FConfiguration method u2fRegistrationRecordCipherExecutor.
@Bean
@RefreshScope
public CipherExecutor u2fRegistrationRecordCipherExecutor() {
final EncryptionJwtSigningJwtCryptographyProperties crypto = casProperties.getAuthn().getMfa().getU2f().getCrypto();
if (crypto.isEnabled()) {
return new U2FAuthenticationRegistrationRecordCipherExecutor(crypto.getEncryption().getKey(), crypto.getSigning().getKey(), crypto.getAlg());
}
LOGGER.info("U2F registration record encryption/signing is turned off and " + "MAY NOT be safe in a production environment. " + "Consider using other choices to handle encryption, signing and verification of " + "U2F registration records for MFA");
return CipherExecutor.noOp();
}
use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class U2FAuthenticationEventExecutionPlanConfiguration method u2fAuthenticationProvider.
@Bean
@RefreshScope
public MultifactorAuthenticationProvider u2fAuthenticationProvider() {
final U2FMultifactorAuthenticationProvider p = new U2FMultifactorAuthenticationProvider();
p.setBypassEvaluator(u2fBypassEvaluator());
p.setGlobalFailureMode(casProperties.getAuthn().getMfa().getGlobalFailureMode());
p.setOrder(casProperties.getAuthn().getMfa().getU2f().getRank());
p.setId(casProperties.getAuthn().getMfa().getU2f().getId());
return p;
}
Aggregations