AuthServiceProvider

class AuthServiceProvider : IAuthServiceProvider

Manages requests to the AppAuth framework via the IAuthService object.

  • queue that synchronises access to the authService object

    Declaration

    Swift

    private let authServiceProviderQueue: DispatchQueue
  • group that gives us the ability to wait and return the obtained result

    Declaration

    Swift

    private let group: DispatchGroup
  • object that handles communication with AppAuth framework

    Declaration

    Swift

    private let authService: IAuthService
  • Initialises with the object that handles communication with AppAuth framework

    Declaration

    Swift

    init(_ authService: IAuthService = AuthService())

    Parameters

    authService

    object that performs requests to the AppAuth framework.

  • Performs obtaining service configuration for specified domain.

    Declaration

    Swift

    func discoverServiceConfig(for url: URL) -> (OIDServiceConfiguration?, NSError?)

    Parameters

    url

    Domain for which the configuration should be obtained.

    Return Value

    Service configuration and nil as error on success or nil as configuration and error on failure.

  • Presents authorization request.

    Declaration

    Swift

    func presentAuthRequest(_ request: OIDAuthorizationRequest, viewController: UIViewController) -> (OIDExternalUserAgentSession?, OIDAuthorizationResponse?, NSError?)

    Parameters

    request

    Request to be presented.

    viewController

    The UIViewController to present auth request.

    Return Value

    User session, auth response and nil as error on success or nil as session and response and error on failure.

  • Presents hybrid flow request.

    Declaration

    Swift

    func presentHybridFlowRequest(_ requestUrl: URL, scheme: String?, userAgent: OIDExternalUserAgentIOS) -> (URL?, NSError?)

    Parameters

    requestUrl

    Url which is used in hybrid flow request.

    scheme

    Scheme which is used for hybrid flow request.

    userAgent

    Agent that takes part in hybrd flow request presentation.

    Return Value

    URL and nil as error on success or nil as URL and error on failure.

  • Presents token request.

    Declaration

    Swift

    func performTokenRequest(_ request: OIDTokenRequest) -> (OIDTokenResponse?, NSError?)

    Parameters

    request

    Request to be presented.

    Return Value

    Response and nil as error on success or nil as response and error on failure.

  • Presents end session request.

    Declaration

    Swift

    func presentEndSessionRequest(_ request: OIDEndSessionRequest, externalUserAgent: OIDExternalUserAgent) -> (OIDEndSessionResponse?, OIDExternalUserAgentSession?, NSError?)

    Parameters

    request

    Request to be presented.

    externalUserAgent

    Agent that takes part in end session request.

    Return Value

    Response, session and nil as error on success or nil as response and session and error on failure.