Skip to content

Commit

Permalink
Add 'authorizedScope' for actual scope authorized by user
Browse files Browse the repository at this point in the history
  • Loading branch information
drdavec committed Apr 7, 2023
1 parent 30f46ad commit e4a5cd2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Sources/Base/OAuth2Base.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ open class OAuth2Base: OAuth2Securable {
set { clientConfig.scope = newValue }
}

/// The scope actually authorized by the endpoint and user.
public final var authorizedScope: String? {
get { return clientConfig.authorizedScope }
set { clientConfig.authorizedScope = newValue }
}

/// The redirect URL string to use.
public final var redirect: String? {
get { return clientConfig.redirect }
Expand Down
6 changes: 6 additions & 0 deletions Sources/Base/OAuth2ClientConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ open class OAuth2ClientConfig {
/// The scope currently in use.
open var scope: String?

/// The scope actrually authorized.
open var authorizedScope: String?

/// The redirect URL string currently in use.
open var redirect: String?

Expand Down Expand Up @@ -186,6 +189,9 @@ open class OAuth2ClientConfig {
if let refresh = json["refresh_token"] as? String {
refreshToken = refresh
}
if let scope = json["scope"] as? String {
authorizedScope = scope
}
}

/**
Expand Down

0 comments on commit e4a5cd2

Please sign in to comment.