Skip to content

Commit

Permalink
Request all required OIDC scopes + grant_types (#154)
Browse files Browse the repository at this point in the history
* Request all required OIDC scopes on auth
* User real TOS and Policy URLs for OIDC
* Request refresh_token grant type when registering client
* Use unstable OIDC scope prefixes
  • Loading branch information
hughns authored Aug 11, 2022
1 parent 4349b8f commit 207cbde
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class AuthenticationServiceProxy: AuthenticationServiceProxyProtocol {
let registationResponse = try await oidcService.registerClient(metadata: configuration)
let authResponse = try await oidcService.presentWebAuthentication(metadata: configuration,
clientID: registationResponse.clientID,
scope: "urn:matrix:device:\(deviceID)",
scope: "openid urn:matrix:org.matrix.msc2967.client:api:* urn:matrix:org.matrix.msc2967.client:device:\(deviceID)",
userAgent: userAgent)
let tokenResponse = try await oidcService.redeemCodeForTokens(authResponse: authResponse)

Expand Down
6 changes: 3 additions & 3 deletions ElementX/Sources/Services/Authentication/OIDCService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ class OIDCService {
let extraParams = [
"client_name": "ElementX iOS",
"client_uri": "https://element.io",
"tos_uri": "https://example.com/tos",
"policy_uri": "https://example.com/policy"
"tos_uri": "https://element.io/user-terms-of-service",
"policy_uri": "https://element.io/privacy"
]

let nonTemplatizedRequest = OIDRegistrationRequest(
configuration: metadata,
redirectURIs: [redirectURI],
responseTypes: nil,
grantTypes: [OIDGrantTypeAuthorizationCode],
grantTypes: [OIDGrantTypeAuthorizationCode, OIDGrantTypeRefreshToken],
subjectType: nil,
tokenEndpointAuthMethod: "none",
additionalParameters: extraParams
Expand Down
1 change: 1 addition & 0 deletions changelog.d/pr-154.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use unstable MSC2967 values for OIDC scopes + client registration metadata updates.

0 comments on commit 207cbde

Please sign in to comment.