Structure
Authenticator
public struct Authenticator
A struct defining an instance capable of
starting the authentication flow for a given user.
Relationships
Nested Types
Authenticator.ErrorAn
enumlisting some authentication-specific errors.Authenticator.KeyA
classdefining an instance used forSecretmanagement.Authenticator.KeysA
classdefining an instance used forSecrets management.Authenticator.GroupAn
enumlisting all authentication implementations.
Initializers
init(storage:)
public init<S: Storage>(storage: S) where S.Item == Secret
Init.
Parameters
| Name | Type | Description |
|---|---|---|
| storage | S |
A valid |
| client | A valid |
Properties
userDefaults
static var userDefaults: Authenticator
The default user defaults-backed Authenticator.
Methods
secret(_:)
func secret(_ label: String) -> Key
Return a specific Secret manager.
Parameters
| Name | Type | Description |
|---|---|---|
| label | String |
A valid |
Returns
A valid Key.
secret(_:)
func secret(_ secret: Secret) -> Key
Return a specific Secret manager.
Parameters
| Name | Type | Description |
|---|---|---|
| secret | Secret |
A valid |
Returns
A valid Key.
secrets(_:)
func secrets<C: Collection>(_ labels: C) -> Keys where C.Element == String
Return some specific Secrets manager.
Parameters
| Name | Type | Description |
|---|---|---|
| labels | C |
A collection of |
Returns
Some valid Keys.
secrets(_:)
func secrets<C: Collection>(_ secrets: C) -> Keys where C.Element == Secret
Return some specific Secrets manager.
Parameters
| Name | Type | Description |
|---|---|---|
| secrets | C |
A collection of |
Returns
Some valid Keys.
userDefaults(_:)
static func userDefaults(_ userDefaultsStorage: UserDefaultsStorage<Secret>) -> Authenticator
A user defaults-backed Authenticator with a specific Client.
Parameters
| Name | Type | Description |
|---|---|---|
| userDefaultsStorage | UserDefaultsStorage<Secret> |
A valid |
Returns
A valid Authenticator.
visual(_:)
func visual(_ transformer: @escaping (_ webView: WKWebView, _ completion: @escaping () -> Void) -> Void) -> Group.Visual
Authenticate using a WKWebView.
You're responsibile for adding the web view to your view hierarchy and
calling the completion handler.
Parameters
| Name | Type | Description |
|---|---|---|
| transformer | @escaping (_ webView: WKWebView, _ completion: @escaping () -> Void) -> Void |
A valid web view transformer. |
Returns
A valid Group.Visual.
visual(_:)
func visual(_ transformer: @escaping (_ webView: WKWebView) -> Void) -> Group.Visual
Authenticate using a WKWebView.
You're responsible for adding the web view to your view hierarchy.
Parameters
| Name | Type | Description |
|---|---|---|
| transformer | @escaping (_ webView: WKWebView) -> Void |
A valid web view transformer. |
Returns
A valid Group.Visual.
visual(filling:)
func visual(filling superview: UIView) -> Group.Visual
Authenticate using a WKWebView.
The web view will be added as a child of superview.
Parameters
| Name | Type | Description |
|---|---|---|
| superview | UIView |
A valid |
Returns
A valid Group.Visual.
keychain(_:)
static func keychain(_ keychainStorage: KeychainStorage<Secret>) -> Authenticator
A keychain-backed Authenticator.
Parameters
| Name | Type | Description |
|---|---|---|
| keychain | A valid |
Returns
A valid Authenticator.
basic(username:password:)
func basic(username: String, password: String) -> Group.Basic
Authenticate using username and password.
2FA is supported in code and it will be handled as an Error
in the authentication stream, returning a TwoFactorComposer
authenticator.
Parameters
| Name | Type | Description |
|---|---|---|
| username | String |
A valid |
| password | String |
A valid |
Returns
A valid Group.Basic.