org.springframework.boot.autoconfigure.security.SecurityProperties Java Examples

The following examples show how to use org.springframework.boot.autoconfigure.security.SecurityProperties. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OAuth2RestOperationsConfiguration.java    From spring-security-oauth2-boot with Apache License 2.0 6 votes vote down vote up
@Bean
public FilterRegistrationBean<OAuth2ClientContextFilter> oauth2ClientFilterRegistration(
		OAuth2ClientContextFilter filter, SecurityProperties security) {
	FilterRegistrationBean<OAuth2ClientContextFilter> registration = new FilterRegistrationBean<>();
	registration.setFilter(filter);
	registration.setOrder(security.getFilter().getOrder() - 10);
	return registration;
}
 
Example #2
Source File: WebConfig.java    From mPaaS with Apache License 2.0 5 votes vote down vote up
/**
 * 系统内置filter,优先级高于spring security的身份认证
 * @return
 */
@Bean
public FilterRegistrationBean<WebThreadFilter> filterRegistrationBean(@SuppressWarnings("SpringJavaAutowiringInspection") Environment environment) {
    FilterRegistrationBean<WebThreadFilter> registration = new FilterRegistrationBean<WebThreadFilter>();
    registration.addUrlPatterns("/*");
    WebThreadFilter filterProxy = new WebThreadFilter(filterDefs);
    filterProxy.setEnvironment(environment);
    registration.setFilter(filterProxy);
    registration.setOrder(SecurityProperties.DEFAULT_FILTER_ORDER - 1);
    return registration;
}
 
Example #3
Source File: WebConfig.java    From mPass with Apache License 2.0 5 votes vote down vote up
/**
 * 系统内置filter,优先级高于spring security的身份认证
 * @return
 */
@Bean
public FilterRegistrationBean<WebThreadFilter> filterRegistrationBean(@SuppressWarnings("SpringJavaAutowiringInspection") Environment environment) {
    FilterRegistrationBean<WebThreadFilter> registration = new FilterRegistrationBean<WebThreadFilter>();
    registration.addUrlPatterns("/*");
    WebThreadFilter filterProxy = new WebThreadFilter(filterDefs);
    filterProxy.setEnvironment(environment);
    registration.setFilter(filterProxy);
    registration.setOrder(SecurityProperties.DEFAULT_FILTER_ORDER - 1);
    return registration;
}
 
Example #4
Source File: OAuth2SecurityConfiguration.java    From jhipster-registry with Apache License 2.0 5 votes vote down vote up
@Bean
public InMemoryUserDetailsManager inMemoryUserDetailsManager(
    SecurityProperties properties,
    ObjectProvider<PasswordEncoder> passwordEncoder) {
    SecurityProperties.User user = properties.getUser();
    List<String> roles = user.getRoles();
    return new InMemoryUserDetailsManager(User.withUsername(user.getName())
        .password(getOrDeducePassword(user, passwordEncoder.getIfAvailable()))
        .roles(StringUtils.toStringArray(roles)).build());
}
 
Example #5
Source File: OAuth2SecurityConfiguration.java    From jhipster-registry with Apache License 2.0 5 votes vote down vote up
private String getOrDeducePassword(SecurityProperties.User user,
                                   PasswordEncoder encoder) {
    if (encoder != null) {
        return user.getPassword();
    }
    return "{noop}" + user.getPassword();
}
 
Example #6
Source File: BootUrlBasedSecurityConfig.java    From onetwo with Apache License 2.0 5 votes vote down vote up
@Bean
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
@ConditionalOnMissingBean(DefaultUrlSecurityConfigurer.class)
@Autowired
public DefaultUrlSecurityConfigurer defaultSecurityConfigurer(AccessDecisionManager accessDecisionManager){
	return super.defaultSecurityConfigurer(accessDecisionManager);
}
 
Example #7
Source File: DevelopmentConfig.java    From eds-starter6-jpa with Apache License 2.0 5 votes vote down vote up
@Bean
public FilterRegistrationBean<CorsFilter> corsFilterRegistration() {
	FilterRegistrationBean<CorsFilter> filter = new FilterRegistrationBean<>();
	CorsConfiguration config = new CorsConfiguration();
	config.setAllowedOrigins(Collections.singletonList(CorsConfiguration.ALL));
	config.setAllowedMethods(Collections.singletonList(CorsConfiguration.ALL));
	config.setAllowedHeaders(Collections.singletonList(CorsConfiguration.ALL));
	config.setAllowCredentials(true);
	filter.setFilter(new CorsFilter(r -> config));
	filter.setUrlPatterns(Collections.singleton("/*"));
	filter.setOrder(SecurityProperties.DEFAULT_FILTER_ORDER - 1);
	return filter;
}
 
Example #8
Source File: SecurityConfiguration.java    From grpc-spring-security-demo with MIT License 4 votes vote down vote up
@Autowired
public SecurityConfiguration(SecurityProperties securityProperties) {
    this.securityProperties = securityProperties;
}
 
Example #9
Source File: SecurityController.java    From spring-cloud-dashboard with Apache License 2.0 4 votes vote down vote up
public SecurityController(SecurityProperties securityProperties) {
	this.securityProperties = securityProperties;
}
 
Example #10
Source File: DataFlowControllerAutoConfiguration.java    From spring-cloud-dashboard with Apache License 2.0 4 votes vote down vote up
@Bean
public SecurityController securityController(SecurityProperties securityProperties) {
	return new SecurityController(securityProperties);
}
 
Example #11
Source File: InMemoryUserManagementAutoConfiguration.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
InMemoryUserManagementAutoConfiguration(final SecurityProperties securityProperties,
        final MultiUserProperties multiUserProperties) {
    this.securityProperties = securityProperties;
    this.multiUserProperties = multiUserProperties;
}
 
Example #12
Source File: BootMethodBasedSecurityConfig.java    From onetwo with Apache License 2.0 4 votes vote down vote up
@Bean
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
@ConditionalOnMissingBean(DefaultMethodSecurityConfigurer.class)
public DefaultMethodSecurityConfigurer defaultSecurityConfigurer(){
	return super.defaultSecurityConfigurer();
}