Skip to content

Commit a02a8f7

Browse files
author
Matt Raible
committed
Add configureResourceServer401ResponseBody example
1 parent 871be5a commit a02a8f7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

spring-cloud-gateway/car-service/src/main/java/com/example/carservice/SecurityConfiguration.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.example.carservice;
22

3+
import com.okta.spring.boot.oauth.Okta;
34
import org.springframework.context.annotation.Bean;
45
import org.springframework.security.config.annotation.method.configuration.EnableReactiveMethodSecurity;
56
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
@@ -21,6 +22,10 @@ public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {
2122
.and()
2223
.oauth2ResourceServer()
2324
.jwt();
25+
26+
// Uncomment to prevent redirect and only act as a resource server
27+
// Okta.configureResourceServer401ResponseBody(http);
28+
2429
return http.build();
2530
// @formatter:on
2631
}

0 commit comments

Comments
 (0)