Skip to content

Commit 9818ff2

Browse files
authored
Merge pull request #126 from kalinjul/fix-endsession-post
fix: endsession POST should use form parameters
2 parents 3c8fc3e + 4fb9409 commit 9818ff2

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

oidc-core/src/commonMain/kotlin/org/publicvalue/multiplatform/oidc/DefaultOpenIdConnectClient.kt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,12 @@ class DefaultOpenIdConnectClient(
133133
val endpoint = config.endpoints?.endSessionEndpoint?.trim()
134134
if (!endpoint.isNullOrEmpty()) {
135135
val url = URLBuilder(endpoint)
136-
val response = httpClient.submitForm {
136+
val response = httpClient.submitForm(
137+
formParameters = parameters {
138+
append("id_token_hint", idToken)
139+
}
140+
) {
137141
url(url.build())
138-
parameter("id_token_hint", idToken)
139142
configure?.invoke(this)
140143
}
141144
response.status
@@ -149,11 +152,14 @@ class DefaultOpenIdConnectClient(
149152
val endpoint = config.endpoints?.revocationEndpoint?.trim()
150153
if (!endpoint.isNullOrEmpty()) {
151154
val url = URLBuilder(endpoint)
152-
val response = httpClient.submitForm {
155+
val response = httpClient.submitForm(
156+
formParameters = parameters {
157+
append("token", token)
158+
append("client_id", config.clientId ?: run { throw OpenIdConnectException.InvalidConfiguration("clientId is missing") })
159+
config.clientSecret?.let { append("client_secret", it) }
160+
}
161+
) {
153162
url(url.build())
154-
parameter("token", token)
155-
parameter("client_id", config.clientId ?: run { throw OpenIdConnectException.InvalidConfiguration("clientId is missing") })
156-
config.clientSecret?.let { parameter("client_secret", it) }
157163
configure?.invoke(this)
158164
}
159165
response.status

0 commit comments

Comments
 (0)