IDKit

public class IDKit : IDKitProtocol

Undocumented

  • Sets up IDKit with the passed configuration.

    Declaration

    Swift

    public static func setup(with configuration: OIDConfiguration, cacheSession: Bool = true, presentingViewController: UIViewController? = nil)

    Parameters

    configuration

    The current OIDConfiguration.

    cacheSession

    If set to true the session will be persisted by IDKit to improve the chance of not having to resign in again. Defaults to true.

    presentingViewControllerl

    The view controller to present the authorization’s view on. Can be passed at a later point in time.

  • Swaps the current presenting view controller with a new one without having to call setup(with configuration: OIDConfiguration, presentingViewController: UIViewController? = nil) again.

    Declaration

    Swift

    public static func swapPresentingViewController(with newViewController: UIViewController)

    Parameters

    newViewController

    The new presenting view controller.

Discovery

  • Performs a discovery to retrieve an OID configuration.

    Declaration

    Swift

    static func discoverConfiguration(issuerUrl: String, _ completion: @escaping ((String?, String?, IDKitError?) -> Void))

    Parameters

    issueUrl

    The issuer url.

    completion

    The block to be called when the discovery is complete either including the authorizationEndpoint and tokenEndpoint or an error.

Token / Session handling

  • Performs an OID authorization request.

    Declaration

    Swift

    static func authorize(_ completion: @escaping ((String?, IDKitError?) -> Void))

    Parameters

    completion

    The block to be called when the request is complete including either a valid accessToken or an error.

  • Refreshes the current access token if needed.

    Declaration

    Swift

    static func refreshToken(force: Bool = false, _ completion: @escaping ((String?, IDKitError?) -> Void))

    Parameters

    force

    Forces a refresh even if the current accessToken is still valid. Defaults to false.

    completion

    The block to be called when the request is complete including either a new valid accessToken or an error.

  • Cancels the authorization flow and invokes the authorize completion block with a cancelled error. Has no effect when calling multiple times.

    Declaration

    Swift

    static func cancelAuthorizationFlow(_ completion: (() -> Void)? = nil)

    Parameters

    completion

    The block to be called when the cancellation is complete.

  • Resets the current session.

    Declaration

    Swift

    static func resetSession(_ completion: (() -> Void)? = nil)

    Parameters

    completion

    The block to be called when the reset is complete.

  • Checks the current authorization state. Returning true does not mean that the access is fresh - just that it was valid the last time it was used.

    Declaration

    Swift

    static func isAuthorizationValid() -> Bool

    Return Value

    The current state of the authorization.

  • Returns the latest received access token of the current session.

    Declaration

    Swift

    static func latestAccessToken() -> String?

    Return Value

    The latest access token.

User

  • Retrieves the currently authorized user’s information.

    Declaration

    Swift

    static func userInfo(completion: @escaping (UserInfo?, IDKitError?) -> Void)

    Parameters

    completion

    The block to be called when the request is complete including either valid userInfo or an error.

  • Undocumented

    See more

    Declaration

    Swift

    enum IDKitError : Error, CustomStringConvertible
  • Undocumented

    See more

    Declaration

    Swift

    struct OIDConfiguration
  • Undocumented

    See more

    Declaration

    Swift

    struct UserInfo : Decodable