IdentityProvider

public protocol IdentityProvider : AnyObject

Encapsulates interface requirements for an external identity provider to register and authenticate an identity within Sudo platform ecosystem.

  • Registers a new identity (user) against the identity provider.

    Declaration

    Swift

    func register(
        uid: String,
        parameters: [String: String]
    ) async throws -> String

    Parameters

    uid

    ID of the identity (user).

    parameters

    The registration parameters.

    Return Value

    User ID of the newly registered user.

  • Deregisters an identity (user) from the identity provider.

    Declaration

    Swift

    func deregister(
        uid: String,
        accessToken: String
    ) async throws -> String

    Parameters

    uid

    ID of the identity (user).

    accessToken

    Access token used to authenticate and authorize the request.

    Return Value

    User ID of the deregistered user.

  • Sign into the identity provider.

    Declaration

    Swift

    func signIn(
        uid: String,
        parameters: [String: Any]
    ) async throws -> AuthenticationTokens

    Parameters

    uid

    ID of the identity (user) to sign in.

    parameters

    Sign in parameters.

    Return Value

    Authentication tokens.

  • Refresh the access and ID tokens using the refresh token.

    Declaration

    Swift

    func refreshTokens(
        refreshToken: String
    ) async throws -> AuthenticationTokens

    Parameters

    refreshToken

    Refresh token.

    Return Value

    Authentication tokens.

  • signOut(refreshToken:) Asynchronous

    Signs out the user from this device only.

    Declaration

    Swift

    func signOut(refreshToken: String) async throws
  • Signs out the user from all devices.

    Declaration

    Swift

    func globalSignOut(
        accessToken: String
    ) async throws

    Parameters

    accessToken

    Access token used to authorize the request.