-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement prompt for re-login/consent
- Loading branch information
1 parent
735c180
commit cf70a70
Showing
7 changed files
with
132 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// Copyright © Uber Technologies, Inc. All rights reserved. | ||
// | ||
|
||
|
||
import Foundation | ||
|
||
/// | ||
/// A type defining values that specify whether the Authorization Server prompts the End-User for reauthentication and consent. | ||
/// Current supported values are `login` and `consent` | ||
|
||
/// See OpedID standards for more information. | ||
/// https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest | ||
/// | ||
public struct Prompt: OptionSet { | ||
|
||
public let rawValue: Int | ||
|
||
public init(rawValue: Int) { | ||
self.rawValue = rawValue | ||
} | ||
|
||
/// The Authorization Server SHOULD prompt the End-User for reauthentication. | ||
/// If it cannot reauthenticate the End-User, it MUST return an error, typically `login_required`. | ||
public static let login = Prompt(rawValue: 1 << 0) | ||
|
||
/// The Authorization Server SHOULD prompt the End-User for consent before returning information to the Client. | ||
/// If it cannot obtain consent, it MUST return an error, typically `consent_required`. | ||
public static let consent = Prompt(rawValue: 1 << 1) | ||
|
||
/// Creates a space seperated string containing the values in the option set | ||
var stringValue: String { | ||
var values: [String] = [] | ||
if contains(.login) { values.append("login") } | ||
if contains(.consent) { values.append("consent") } | ||
return values.joined(separator: " ") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters