|
| 1 | +diff --git a/pom.xml b/pom.xml |
| 2 | +index 3b477f5..24ab1aa 100644 |
| 3 | +--- a/pom.xml |
| 4 | ++++ b/pom.xml |
| 5 | +@@ -14,7 +14,7 @@ |
| 6 | + <parent> |
| 7 | + <groupId>org.springframework.boot</groupId> |
| 8 | + <artifactId>spring-boot-starter-parent</artifactId> |
| 9 | +- <version>2.0.3.RELEASE</version> |
| 10 | ++ <version>2.0.4.BUILD-SNAPSHOT</version> |
| 11 | + <relativePath/> <!-- lookup parent from repository --> |
| 12 | + </parent> |
| 13 | + |
| 14 | +@@ -25,6 +25,7 @@ |
| 15 | + <frontend-maven-plugin.version>1.6</frontend-maven-plugin.version> |
| 16 | + <node.version>v10.6.0</node.version> |
| 17 | + <yarn.version>v1.8.0</yarn.version> |
| 18 | ++ <spring-security.version>5.1.0.BUILD-SNAPSHOT</spring-security.version> |
| 19 | + </properties> |
| 20 | + |
| 21 | + <dependencies> |
| 22 | +@@ -45,6 +46,18 @@ |
| 23 | + <artifactId>spring-security-oauth2-autoconfigure</artifactId> |
| 24 | + <version>2.0.1.RELEASE</version> |
| 25 | + </dependency> |
| 26 | ++ <dependency> |
| 27 | ++ <groupId>org.springframework.security</groupId> |
| 28 | ++ <artifactId>spring-security-config</artifactId> |
| 29 | ++ </dependency> |
| 30 | ++ <dependency> |
| 31 | ++ <groupId>org.springframework.security</groupId> |
| 32 | ++ <artifactId>spring-security-oauth2-client</artifactId> |
| 33 | ++ </dependency> |
| 34 | ++ <dependency> |
| 35 | ++ <groupId>org.springframework.security</groupId> |
| 36 | ++ <artifactId>spring-security-oauth2-jose</artifactId> |
| 37 | ++ </dependency> |
| 38 | + <dependency> |
| 39 | + <groupId>com.h2database</groupId> |
| 40 | + <artifactId>h2</artifactId> |
| 41 | +@@ -175,4 +188,22 @@ |
| 42 | + </properties> |
| 43 | + </profile> |
| 44 | + </profiles> |
| 45 | ++ |
| 46 | ++ <pluginRepositories> |
| 47 | ++ <pluginRepository> |
| 48 | ++ <id>spring-snapshots</id> |
| 49 | ++ <name>Spring Snapshots</name> |
| 50 | ++ <url>https://repo.spring.io/snapshot</url> |
| 51 | ++ <snapshots> |
| 52 | ++ <enabled>true</enabled> |
| 53 | ++ </snapshots> |
| 54 | ++ </pluginRepository> |
| 55 | ++ </pluginRepositories> |
| 56 | ++ <repositories> |
| 57 | ++ <repository> |
| 58 | ++ <id>spring-snapshots</id> |
| 59 | ++ <name>Spring Snapshot Repository</name> |
| 60 | ++ <url>http://repo.spring.io/snapshot</url> |
| 61 | ++ </repository> |
| 62 | ++ </repositories> |
| 63 | + </project> |
| 64 | +diff --git a/src/main/java/com/okta/developer/jugtours/web/UserController.java b/src/main/java/com/okta/developer/jugtours/web/UserController.java |
| 65 | +index eee3fde..17c1464 100644 |
| 66 | +--- a/src/main/java/com/okta/developer/jugtours/web/UserController.java |
| 67 | ++++ b/src/main/java/com/okta/developer/jugtours/web/UserController.java |
| 68 | +@@ -22,8 +22,8 @@ public class UserController { |
| 69 | + |
| 70 | + private final UserInfoRestTemplateFactory templateFactory; |
| 71 | + |
| 72 | +- @Value("${security.oauth2.client.access-token-uri}") |
| 73 | +- String accessTokenUri; |
| 74 | ++ @Value("${spring.security.oauth2.client.provider.okta.issuer}") |
| 75 | ++ String issuerUri; |
| 76 | + |
| 77 | + public UserController(UserInfoRestTemplateFactory templateFactory) { |
| 78 | + this.templateFactory = templateFactory; |
| 79 | +@@ -62,8 +62,7 @@ public class UserController { |
| 80 | + OAuth2RestTemplate oauth2RestTemplate = this.templateFactory.getUserInfoRestTemplate(); |
| 81 | + String idToken = (String) oauth2RestTemplate.getAccessToken().getAdditionalInformation().get("id_token"); |
| 82 | + |
| 83 | +- // logout URI can be derived from accessTokenUri |
| 84 | +- String logoutUrl = accessTokenUri.replace("token", "logout"); |
| 85 | ++ String logoutUrl = issuerUri + "/v1/logout"; |
| 86 | + |
| 87 | + Map<String, String> logoutDetails = new HashMap<>(); |
| 88 | + logoutDetails.put("logoutUrl", logoutUrl); |
| 89 | +diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml |
| 90 | +index 18ddd91..e14e090 100644 |
| 91 | +--- a/src/main/resources/application.yml |
| 92 | ++++ b/src/main/resources/application.yml |
| 93 | +@@ -1,13 +1,14 @@ |
| 94 | +-security: |
| 95 | +- oauth2: |
| 96 | +- client: |
| 97 | +- access-token-uri: https://dev-158606.oktapreview.com/oauth2/default/v1/token |
| 98 | +- user-authorization-uri: https://dev-158606.oktapreview.com/oauth2/default/v1/authorize |
| 99 | +- client-id: 0oafqwenodi6cPzSC0h7 |
| 100 | +- client-secret: FLuPvd9Gf87Wu17Q6CAAFqK6WaIlPDdcKwQ9XplM |
| 101 | +- scope: openid email profile |
| 102 | +- resource: |
| 103 | +- user-info-uri: https://dev-158606.oktapreview.com/oauth2/default/v1/userinfo |
| 104 | + spring: |
| 105 | + profiles: |
| 106 | +- active: @spring.profiles.active@ |
| 107 | +\ No newline at end of file |
| 108 | ++ active: @spring.profiles.active@ |
| 109 | ++ security: |
| 110 | ++ oauth2: |
| 111 | ++ client: |
| 112 | ++ registration: |
| 113 | ++ okta: |
| 114 | ++ client-id: 0oafqwenodi6cPzSC0h7 |
| 115 | ++ client-secret: FLuPvd9Gf87Wu17Q6CAAFqK6WaIlPDdcKwQ9XplM |
| 116 | ++ scope: openid email profile |
| 117 | ++ provider: |
| 118 | ++ okta: |
| 119 | ++ issuer: https://dev-158606.oktapreview.com/oauth2/default |
| 120 | +\ No newline at end of file |
0 commit comments