use of org.springframework.security.config.annotation.ObjectPostProcessor in project credhub by cloudfoundry-incubator.
the class Oauth2TestConfiguration method authenticationManagerBuilder.
@Bean
public AuthenticationManagerBuilder authenticationManagerBuilder() {
final ObjectPostProcessor<Object> objectPostProcessor = new ObjectPostProcessor<Object>() {
@Override
public <O extends Object> O postProcess(O object) {
return object;
}
};
final AuthenticationManagerBuilder authenticationManagerBuilder = new AuthenticationManagerBuilder(objectPostProcessor);
authenticationManagerBuilder.parentAuthenticationManager(authenticationManager());
return authenticationManagerBuilder;
}
use of org.springframework.security.config.annotation.ObjectPostProcessor in project hub-alert by blackducksoftware.
the class AuthenticationHandler method createRoleProcessor.
private ObjectPostProcessor<AffirmativeBased> createRoleProcessor() {
return new ObjectPostProcessor<>() {
@Override
public <O extends AffirmativeBased> O postProcess(O affirmativeBased) {
WebExpressionVoter webExpressionVoter = new WebExpressionVoter();
DefaultWebSecurityExpressionHandler expressionHandler = new DefaultWebSecurityExpressionHandler();
expressionHandler.setRoleHierarchy(authorities -> {
String[] allAlertRoles = retrieveAllowedRoles();
return AuthorityUtils.createAuthorityList(allAlertRoles);
});
webExpressionVoter.setExpressionHandler(expressionHandler);
affirmativeBased.getDecisionVoters().add(webExpressionVoter);
return affirmativeBased;
}
};
}
use of org.springframework.security.config.annotation.ObjectPostProcessor in project credhub by cloudfoundry-incubator.
the class OAuth2Configuration method authenticationManagerBuilder.
@Bean
public AuthenticationManagerBuilder authenticationManagerBuilder() {
final ObjectPostProcessor<Object> objectPostProcessor = new ObjectPostProcessor<Object>() {
@Override
public <O extends Object> O postProcess(O object) {
return object;
}
};
final AuthenticationManagerBuilder authenticationManagerBuilder = new AuthenticationManagerBuilder(objectPostProcessor);
authenticationManagerBuilder.parentAuthenticationManager(authenticationManager());
return authenticationManagerBuilder;
}
Aggregations