AuthStateProvider

class AuthStateProvider : IAuthStateProvider

Manages current authorization state which is used inside [AuthClient] object.

  • represents current authorization state

    Declaration

    Swift

    private var authState: OIDAuthState?
  • Sets auth state directly using the OIDAuthState object

    Declaration

    Swift

    func setAuthState(_ state: OIDAuthState?)

    Parameters

    state

    Authorization state to be set as current the value of the state can be nil, in this case the authorization state is reset

  • Sets auth state obtained from the OIDAuthorizationResponse and OIDTokenResponse

    Declaration

    Swift

    func setAuthState(_ authResponse: OIDAuthorizationResponse, tokenResponse: OIDTokenResponse?)

    Parameters

    state

    Auth response used for auth state creation

    tokenResponse

    Token response used for auth state creation

  • Returns token exchange request obtained from current auth state.

    Declaration

    Swift

    func getTokenExchangeRequest() -> OIDTokenRequest?

    Return Value

    OIDTokenRequest object on success or nil on failure.

  • Performs auth state update using the token response.

    Declaration

    Swift

    func update(_ tokenResponse: OIDTokenResponse?, error: NSError?)

    Parameters

    tokenResponse

    Token response to update current auth state.

    error

    Error which could be occured when token response has been obtained.

  • Provides current auth state.

    Declaration

    Swift

    func getAuthState() -> AnyObject?

    Return Value

    auth state

  • Provides id token string obtained from current auth state or nil if there is no one id token stored.

    Declaration

    Swift

    func getIdToken() -> String?

    Return Value

    id token string