diff --git a/OAuth2-Authorization-Server-Tests.postman_collection.json b/OAuth2-Authorization-Server-Tests.postman_collection.json index 6a375b6..1013ed6 100644 --- a/OAuth2-Authorization-Server-Tests.postman_collection.json +++ b/OAuth2-Authorization-Server-Tests.postman_collection.json @@ -94,13 +94,13 @@ } ], "url": { - "raw": "{{base_url}}/.well-known/openid_configuration", + "raw": "{{base_url}}/.well-known/openid-configuration", "host": [ "{{base_url}}" ], "path": [ ".well-known", - "openid_configuration" + "openid-configuration" ] }, "description": "Get OpenID Connect configuration" @@ -369,6 +369,19 @@ { "name": "Exchange Code for Token", "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "const code = pm.environment.get('authorization_code');", + "if (!code || code.trim() === '') {", + " console.log('Skipping Exchange Code for Token - authorization_code not set. Complete browser login first.');", + " pm.execution.skipRequest();", + "}" + ], + "type": "text/javascript" + } + }, { "listen": "test", "script": { @@ -466,6 +479,19 @@ { "name": "Refresh Access Token", "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "const token = pm.environment.get('refresh_token');", + "if (!token || token.trim() === '') {", + " console.log('Skipping Refresh Access Token - refresh_token not set. Run Exchange Code for Token first.');", + " pm.execution.skipRequest();", + "}" + ], + "type": "text/javascript" + } + }, { "listen": "test", "script": { diff --git a/src/main/java/com/example/config/RegisteredClientConfig.java b/src/main/java/com/example/config/RegisteredClientConfig.java index 9b0f43e..8a9e604 100644 --- a/src/main/java/com/example/config/RegisteredClientConfig.java +++ b/src/main/java/com/example/config/RegisteredClientConfig.java @@ -49,13 +49,14 @@ public ApplicationRunner seedClients(RegisteredClientRepository registeredClient .authorizationGrantType(AuthorizationGrantType.CLIENT_CREDENTIALS) .redirectUri("http://localhost:9000/login/oauth2/code/test-client") .redirectUri("http://localhost:9000/authorized") + .redirectUri("https://oauth.pstmn.io/v1/callback") .scope(OidcScopes.OPENID) .scope(OidcScopes.PROFILE) .scope("read") .scope("write") .clientSettings(ClientSettings.builder() .requireAuthorizationConsent(true) - .requireProofKey(true) + .requireProofKey(false) .build()) .tokenSettings(TokenSettings.builder() .accessTokenTimeToLive(Duration.ofHours(1))