org.springframework.boot.actuate.autoconfigure.security.reactive.EndpointRequest Java Examples

The following examples show how to use org.springframework.boot.actuate.autoconfigure.security.reactive.EndpointRequest. 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: SpringSecurityWebReactiveEndpointsBootstrap.java    From thinking-in-spring-boot-samples with Apache License 2.0 5 votes vote down vote up
@Bean
public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {
    return http.securityMatcher(EndpointRequest.toAnyEndpoint())
            .authorizeExchange()
            .anyExchange()
            .hasRole("ENDPOINT_ADMIN")
            .and().httpBasic()
            .and().build();
}
 
Example #2
Source File: SpringBootActuatorEndpointsBootstrap.java    From thinking-in-spring-boot-samples with Apache License 2.0 5 votes vote down vote up
/**
 * 由于当前工程依赖 org.springframework.security:spring-security-web 的缘故,
 * BASIC 验证需要显示地关闭
 *
 * @param http {@link ServerHttpSecurity}
 * @return {@link SecurityWebFilterChain}
 */
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {
    return http.securityMatcher(EndpointRequest.toAnyEndpoint())
            .httpBasic().disable() // 关闭 BASIC 验证
            .build();
}
 
Example #3
Source File: SecurityConfiguration.java    From bookstore-service-broker with Apache License 2.0 5 votes vote down vote up
@Bean
public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {
	return http
			.csrf().disable()
			.httpBasic()
			.and().authorizeExchange()
			.pathMatchers("/bookstores/**").authenticated()
			.pathMatchers("/v2/**").hasAuthority(SecurityAuthorities.ADMIN)
			.matchers(EndpointRequest.to("info", "health")).permitAll()
			.matchers(EndpointRequest.toAnyEndpoint()).hasAuthority(SecurityAuthorities.ADMIN)
			.and().build();
}
 
Example #4
Source File: SecurityConfig.java    From syncope with Apache License 2.0 5 votes vote down vote up
@Bean
@Order(0)
public SecurityWebFilterChain actuatorSecurityFilterChain(final ServerHttpSecurity http) {
    ServerWebExchangeMatcher actuatorMatcher = EndpointRequest.toAnyEndpoint();
    return http.securityMatcher(actuatorMatcher).
            authorizeExchange().anyExchange().authenticated().
            and().httpBasic().
            and().csrf().requireCsrfProtectionMatcher(new NegatedServerWebExchangeMatcher(actuatorMatcher)).
            and().build();
}
 
Example #5
Source File: SecurityConfig.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
public SecurityWebFilterChain securitygWebFilterChain(ServerHttpSecurity http) {
    return http.authorizeExchange()
        .pathMatchers("/", "/admin")
        .hasAuthority("ROLE_ADMIN")
        .matchers(EndpointRequest.to(FeaturesEndpoint.class))
        .permitAll()
        .anyExchange()
        .permitAll()
        .and()
        .formLogin()
        .and()
        .csrf()
        .disable()
        .build();
}
 
Example #6
Source File: WebSecurityConfig.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
public SecurityWebFilterChain securitygWebFilterChain(
  ServerHttpSecurity http) {
    return  http
 
        .authorizeExchange()
            .matchers(EndpointRequest.to(
                   FeaturesEndpoint.class
            )).permitAll().anyExchange().permitAll().and().csrf().disable().build();
}