PredixMobileAuthorizationHandler

open class PredixMobileAuthorizationHandler: AuthorizationHandler

AuthorizationHandler to perform authorization against the PredixMobile authorization service.

Given a valid authenticated user, this class interacts with the Predix Mobile session service to initialize a session, and return user information.

  • URLSessionConfiguration to use for the authentication request. Defaults to URLSessionConfiguration.default.

    Declaration

    Swift

    public var sessionConfiguration = URLSessionConfiguration.default
  • Response status code expected from the server if the authorization request was successful.

    Declaration

    Swift

    public var authorizationSucceededResponseCode = Http.StatusCode.found
  • Response status code expected from the server if the authorization request was unsuccessful.

    Declaration

    Swift

    public var authorizationFailedResponseCode = Http.StatusCode.unauthorized
  • Request headers to add to the authorization request

    Declaration

    Swift

    public var requestHeaders: [String: String] = [:]
  • Authentication payload provided in the authorize method, or nil if authorize has not yet been called.

    Declaration

    Swift

    public var authenticationPayload: [String : Any]?
  • Initializes and returns a PredixMobileAuthorizationHandler object

    Declaration

    Swift

    public init()
  • Starts the authorization process.

    Called by the associated AuthenticationManager when needed.

    Declaration

    Swift

    public func authorize(authenticationPayload: [String : Any], completionHandler: @escaping (_ userInformation: [String : Any]) -> Void)

    Parameters

    authenticationPayload

    the dictionary of information gathered during the authentication process. This information usually contains user-identifying tokens which are exchanged for specific user data during the authentication process.

    completionHandler

    closure called when authorization has completed.

    userInformation

    dictionary of user information retrieved during the authorization process.

  • Not expected to be called from external consumers.

    Subclasses may override to add or remove data from the Authorization user information dictionary just prior to Authorization completion

    Declaration

    Swift

    open func postProcess(userData: [String: Any]) -> [String: Any]

    Parameters

    userData

    the dictionary of user data retrieved during authorization

    Return Value

    The ‘userData’ parameter dictionary, potentially modified.