Fix muti-tenancy whitespace
This commit is contained in:
@@ -20,6 +20,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* OAuth Resource Server application.
|
||||
*
|
||||
* @author Josh Cummings
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@@ -28,4 +29,5 @@ public class OAuth2ResourceServerApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(OAuth2ResourceServerApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,13 +23,15 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* A controller demonstrating OAuth2 Resource server.
|
||||
*
|
||||
* @author Josh Cummings
|
||||
*/
|
||||
@RestController
|
||||
public class OAuth2ResourceServerController {
|
||||
|
||||
@GetMapping("/{tenantId}")
|
||||
public String index(@AuthenticationPrincipal OAuth2AuthenticatedPrincipal token, @PathVariable("tenantId") String tenantId) {
|
||||
public String index(@AuthenticationPrincipal OAuth2AuthenticatedPrincipal token,
|
||||
@PathVariable("tenantId") String tenantId) {
|
||||
String subject = token.getAttribute("sub");
|
||||
return String.format("Hello, %s for %s!", subject, tenantId);
|
||||
}
|
||||
@@ -38,4 +40,5 @@ public class OAuth2ResourceServerController {
|
||||
public String message(@PathVariable("tenantId") String tenantId) {
|
||||
return String.format("secret message for %s", tenantId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.springframework.security.oauth2.server.resource.introspection.OpaqueT
|
||||
|
||||
/**
|
||||
* OAuth Resource Security configuration.
|
||||
*
|
||||
* @author Josh Cummings
|
||||
*/
|
||||
@EnableWebSecurity
|
||||
@@ -93,9 +94,9 @@ public class OAuth2ResourceServerSecurityConfiguration extends WebSecurityConfig
|
||||
}
|
||||
|
||||
AuthenticationManager opaque() {
|
||||
OpaqueTokenIntrospector introspectionClient =
|
||||
new NimbusOpaqueTokenIntrospector(this.introspectionUri,
|
||||
this.introspectionClientId, this.introspectionClientSecret);
|
||||
OpaqueTokenIntrospector introspectionClient = new NimbusOpaqueTokenIntrospector(this.introspectionUri,
|
||||
this.introspectionClientId, this.introspectionClientSecret);
|
||||
return new OpaqueTokenAuthenticationProvider(introspectionClient)::authenticate;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,16 +22,15 @@ import org.springframework.core.env.ConfigurableEnvironment;
|
||||
|
||||
/**
|
||||
* Adds {@link MockWebServerPropertySource} to the environment.
|
||||
*
|
||||
* @author Rob Winch
|
||||
*/
|
||||
public class MockWebServerEnvironmentPostProcessor
|
||||
implements EnvironmentPostProcessor, DisposableBean {
|
||||
public class MockWebServerEnvironmentPostProcessor implements EnvironmentPostProcessor, DisposableBean {
|
||||
|
||||
private final MockWebServerPropertySource propertySource = new MockWebServerPropertySource();
|
||||
|
||||
@Override
|
||||
public void postProcessEnvironment(ConfigurableEnvironment environment,
|
||||
SpringApplication application) {
|
||||
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
|
||||
environment.getPropertySources().addFirst(this.propertySource);
|
||||
}
|
||||
|
||||
@@ -39,4 +38,5 @@ public class MockWebServerEnvironmentPostProcessor
|
||||
public void destroy() throws Exception {
|
||||
this.propertySource.destroy();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,10 +38,10 @@ import org.springframework.http.MediaType;
|
||||
|
||||
/**
|
||||
* Adds the mock server url.
|
||||
*
|
||||
* @author Rob Winch
|
||||
*/
|
||||
public class MockWebServerPropertySource extends PropertySource<MockWebServer> implements
|
||||
DisposableBean {
|
||||
public class MockWebServerPropertySource extends PropertySource<MockWebServer> implements DisposableBean {
|
||||
|
||||
// introspection endpoint
|
||||
|
||||
|
||||
Reference in New Issue
Block a user