From 1f11e40b42d62fefc7818894cd1a7a6b893e42fd Mon Sep 17 00:00:00 2001 From: Matt Raible Date: Sun, 18 Nov 2018 12:53:35 -0700 Subject: [PATCH] Upgrade to Okta Spring Boot Starter 1.0 --- server/pom.xml | 7 +------ .../com/okta/developer/demo/DemoApplication.java | 13 +++++++++++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/server/pom.xml b/server/pom.xml index 983cb52..b588be8 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -44,12 +44,7 @@ com.okta.spring okta-spring-boot-starter - 0.6.1 - - - org.springframework.security.oauth.boot - spring-security-oauth2-autoconfigure - 2.1.0.RELEASE + 1.0.0-SNAPSHOT com.h2database diff --git a/server/src/main/java/com/okta/developer/demo/DemoApplication.java b/server/src/main/java/com/okta/developer/demo/DemoApplication.java index 01e7800..e454fd5 100644 --- a/server/src/main/java/com/okta/developer/demo/DemoApplication.java +++ b/server/src/main/java/com/okta/developer/demo/DemoApplication.java @@ -5,8 +5,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; import org.springframework.core.Ordered; -import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.filter.CorsFilter; @@ -14,7 +16,6 @@ import java.util.Collections; import java.util.stream.Stream; -@EnableResourceServer @SpringBootApplication public class DemoApplication { @@ -22,6 +23,14 @@ public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } + @Configuration + static class OktaOAuth2WebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter { + @Override + protected void configure(HttpSecurity http) throws Exception { + http.oauth2ResourceServer().jwt(); + } + } + @Bean ApplicationRunner init(CarRepository repository) { return args -> {