WLAuthorizationManagerSwift
public class WLAuthorizationManagerSwift
This class manages the OAuth interaction between the client and the authorization server
-
Gets the WLAuthorizationManagerSwift shared instance
Declaration
Swift
public static func sharedInstance() -> WLAuthorizationManagerSwift
Return Value
WLAuthorizationManagerSwift shared instance
-
Obtains an access token for the specified MobileFirst protected resource scope.
Declaration
Swift
public func obtainAccessToken(forScope: String?,onCompletion:@escaping (AccessToken?,Error?)-> Void)
Parameters
forScope
The protected resource scope. ToDo - document the behaviour in case of nil or empty scope.
onCompletion
onCompletion closure with response containing the access token, or error information in case of failure.
-
Check if the WLResponse contains a Gateway Challenge
Declaration
Swift
public func isGatewayResponse(response: WLResponseSwift?) -> Bool
Parameters
response
The incoming response
Return Value
Boolean value.
-
Logout from the specified security check.
Declaration
Swift
public func logout(securityCheck:String,onCompletion: @escaping (Error?) -> Void)
Parameters
securityCheck
The security check to log out from.
onCompletion
Closure with response containing error information in case of failure.
-
Login to the specified security check.
Declaration
Swift
public func login(securityCheck:String,credentials:[AnyHashable:Any],onCompletion:@escaping (Error?) -> Void)
Parameters
securityCheck
The security check to log in to
credentials
The credentials to use for login to the security check.
onCompletion
Closure with response containing error information in case of failure.
-
Checks if the response for a request to a MobileFirst protected resource indicates that authorization is required.
Declaration
Swift
public func isAuthorizationRequired(response: URLResponse) -> Bool
Parameters
response
An URLResponse
Return Value
Boolean value
-
Checks whether the response is a MobileFirst OAuth error.
Declaration
Swift
public func isAuthorizationRequired(status: Int, headers: [AnyHashable : Any]) -> Bool
Parameters
status
HTTP status
headers
Dictionary of response headers
Return Value
Boolean value
-
Returns the resource scope from a response for a request to a MobileFirst protected resource.
Declaration
Swift
public func resourceScope(fromResponse: URLResponse) -> String
Parameters
fromResponse
Response returned for the request to a protected resource.
Return Value
Scope that is returned in the WWW-Authenticate header
-
Clears an invalid Access token from the WLAuthorizationManagerSwift cache
Declaration
Swift
public func clearAccessToken(accessToken: AccessToken)
Parameters
accessToken
Access Token to remove
-
Sets the authorization flow time out. if this value is not set by user, then deault 10s is considered as the default timeout
Declaration
Swift
public func setLoginTimeOut(timeOut: NSNumber)
Parameters
timeOut
Timeout for the authorization
-
Returns the resource scope from a response for a request to a MobileFirst protected resource.
Declaration
Swift
public func resourceScope(responseHeaders: [AnyHashable : Any]) -> String
Parameters
responseHeaders
Response headers returned for the request to a protected resource.
Return Value
Scope that is returned in the WWW-Authenticate header