Skip to content

Commit c960757

Browse files
committed
nimbus no longer permits scope param in token requests
1 parent a2106d0 commit c960757

File tree

11 files changed

+16
-26
lines changed

11 files changed

+16
-26
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
44
val assertjVersion = "3.25.2"
55
val kotlinLoggingVersion = "3.0.5"
66
val logbackVersion = "1.4.14"
7-
val nimbusSdkVersion = "11.9.1"
7+
val nimbusSdkVersion = "11.7"
88
val mockWebServerVersion = "4.12.0"
99
val jacksonVersion = "2.16.1"
1010
val nettyVersion = "4.1.106.Final"

src/main/kotlin/no/nav/security/mock/oauth2/debugger/SessionManager.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class SessionManager {
6666
null
6767
},
6868
)
69+
6970
companion object {
7071
const val DEBUGGER_SESSION_COOKIE = "debugger-session"
7172
}

src/main/kotlin/no/nav/security/mock/oauth2/http/OAuth2HttpServer.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,12 @@ MockWebServerWrapper
102102

103103
override fun port(): Int = mockWebServer.port
104104

105-
override fun url(path: String): HttpUrl = mockWebServer
106-
.url(path)
107-
.newBuilder()
108-
.host(address?.hostName ?: mockWebServer.hostName)
109-
.build()
105+
override fun url(path: String): HttpUrl =
106+
mockWebServer
107+
.url(path)
108+
.newBuilder()
109+
.host(address?.hostName ?: mockWebServer.hostName)
110+
.build()
110111

111112
override fun sslConfig(): Ssl? = ssl
112113

src/test/kotlin/no/nav/security/mock/oauth2/e2e/InteractiveLoginIntegrationTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ class InteractiveLoginIntegrationTest {
9090
"client_id" to "client1",
9191
"client_secret" to "secret",
9292
"grant_type" to "authorization_code",
93-
"scope" to "openid scope1",
9493
"redirect_uri" to "http://mycallback",
9594
"code" to authCode,
9695
),

src/test/kotlin/no/nav/security/mock/oauth2/e2e/MockOAuth2ServerIntegrationTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ class MockOAuth2ServerIntegrationTest {
115115
"client_id" to "client1",
116116
"client_secret" to "secret",
117117
"grant_type" to "authorization_code",
118-
"scope" to "openid scope1",
119118
"redirect_uri" to "http://mycallback",
120119
"code" to "1234",
121120
),

src/test/kotlin/no/nav/security/mock/oauth2/e2e/OidcAuthorizationCodeGrantIntegrationTest.kt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,15 @@ class OidcAuthorizationCodeGrantIntegrationTest {
5656
"client_id" to "client1",
5757
"client_secret" to "secret",
5858
"grant_type" to "authorization_code",
59-
"scope" to "openid scope1",
6059
"redirect_uri" to "http://mycallback",
6160
"code" to code,
6261
),
6362
).toTokenResponse().asClue {
6463
it.accessToken shouldNotBe null
6564
it.idToken shouldNotBe null
6665
it.expiresIn shouldBeGreaterThan 0
67-
it.scope shouldBe "openid scope1"
6866
it.idToken?.audience shouldContainExactly listOf("client1")
69-
it.accessToken?.audience shouldContainExactly listOf("scope1")
67+
it.accessToken?.audience shouldContainExactly listOf("default")
7068
}
7169
}
7270

@@ -90,17 +88,15 @@ class OidcAuthorizationCodeGrantIntegrationTest {
9088
"client_id" to "client1",
9189
"client_secret" to "secret",
9290
"grant_type" to "authorization_code",
93-
"scope" to "openid scope1",
9491
"redirect_uri" to "http://mycallback",
9592
"code" to code,
9693
),
9794
).toTokenResponse().asClue {
9895
it.accessToken shouldNotBe null
9996
it.idToken shouldNotBe null
10097
it.expiresIn shouldBeGreaterThan 0
101-
it.scope shouldBe "openid scope1"
10298
it.idToken?.audience shouldContainExactly listOf("client1")
103-
it.accessToken?.audience shouldContainExactly listOf("scope1")
99+
it.accessToken?.audience shouldContainExactly listOf("default")
104100
it.idToken?.subject shouldBe "foo"
105101
}
106102
server.shutdown()
@@ -152,7 +148,6 @@ class OidcAuthorizationCodeGrantIntegrationTest {
152148
"client_id" to "client1",
153149
"client_secret" to "secret",
154150
"grant_type" to "authorization_code",
155-
"scope" to "openid scope1",
156151
"redirect_uri" to "http://mycallback",
157152
"code" to code,
158153
).apply {

src/test/kotlin/no/nav/security/mock/oauth2/e2e/RefreshTokenGrantIntegrationTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ class RefreshTokenGrantIntegrationTest {
5050
"code" to authorizationCode,
5151
"client_id" to "id",
5252
"client_secret" to "secret",
53-
"scope" to "openid",
5453
"redirect_uri" to "http://something",
5554
),
5655
).toTokenResponse()

src/test/kotlin/no/nav/security/mock/oauth2/e2e/RevocationIntegrationTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ class RevocationIntegrationTest {
7171
"code" to authorizationCode,
7272
"client_id" to "id",
7373
"client_secret" to "secret",
74-
"scope" to "openid",
7574
"redirect_uri" to "http://something",
7675
),
7776
).toTokenResponse()

src/test/kotlin/no/nav/security/mock/oauth2/examples/openidconnect/ExampleAppWithOpenIdConnect.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class ExampleAppWithOpenIdConnect(oidcDiscoveryUrl: String) : AbstractExampleApp
3232
.post(
3333
FormBody.Builder()
3434
.add("client_id", "client1")
35-
.add("scope", authenticationRequest().scope.toString())
3635
.add("code", code)
3736
.add("redirect_uri", exampleApp.url("/callback").toString())
3837
.add("grant_type", "authorization_code")

src/test/kotlin/no/nav/security/mock/oauth2/grant/AuthorizationCodeHandlerTest.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ internal class AuthorizationCodeHandlerTest {
122122
private fun tokenRequest(
123123
code: String,
124124
redirectUri: String = "http://redirect",
125-
scope: String = "openid",
126125
): OAuth2HttpRequest {
127126
return OAuth2HttpRequest(
128127
headers = Headers.headersOf("Content-Type", "application/x-www-form-urlencoded"),
@@ -133,8 +132,7 @@ internal class AuthorizationCodeHandlerTest {
133132
"client_id=client1&" +
134133
"client_secret=secret&" +
135134
"code=$code&" +
136-
"redirect_uri=$redirectUri&" +
137-
"scope=$scope",
135+
"redirect_uri=$redirectUri&"
138136
)
139137
}
140138
}

0 commit comments

Comments
 (0)