+

Search Tips | Advanced Search


WLAuthorizationManager Class Reference

Inherits from NSObject
Declared in WLAuthorizationManager.h

This class manages the OAuth interaction between the client and the authorization server


Tasks

        authorizationServerURL
      	
      	property
      	
      
      	
      		

        + sharedInstance
        	
        	
        	
        
        	
        		

          – obtainAccessTokenForScope:withCompletionHandler:
          	
          	
          	
          
          	
          		

            – isGatewayResponse:
            	
            	
            	
            
            	
            		

              – logout:withCompletionHandler:
              	
              	
              	
              
              	
              		

                – login:withCredentials:withCompletionHandler:
                	
                	
                	
                
                	
                		

                  – isAuthorizationRequiredForResponse:
                  	
                  	
                  	
                  
                  	
                  		

                    – isAuthorizationRequiredForResponseWithStatus:headers:
                    	
                    	
                    	
                    
                    	
                    		

                      – resourceScopeFromResponse:
                      	
                      	
                      	
                      
                      	
                      		

                        – clearAccessToken:
                        	
                        	
                        	
                        
                        	
                        		

                          – setAuthorizationServerURL:
                          	
                          	
                          	
                          
                          	
                          		


                          Properties


                          authorizationServerURL

                          Returns the authorization server URL, if this was not set, the default MFP Authorization URL is returned

                            @property (atomic) NSURL *authorizationServerURL
                            
                                
                            	
                            	
                            	
                            	
                            	
                            	
                            	
                            	
                            	
                            	
                            	
                            	
                            	
                            	
                            


                            Declared In

                            WLAuthorizationManager.h


                            Class Methods


                            sharedInstance

                            Gets the

                              WLAuthorizationManager shared instance
                              			
                              	
                                  
                              
                              	
                              

                                + (WLAuthorizationManager *)sharedInstance
                                
                                    
                                	
                                	
                                	
                                	
                                


                                Return Value

                                  WLAuthorizationManager shared instance
                                  	
                                  	
                                  	
                                  	
                                  	
                                  	
                                  	
                                  	
                                  	
                                  	
                                  	
                                  	
                                  	
                                  


                                  Declared In

                                  WLAuthorizationManager.h


                                  Instance Methods


                                  clearAccessToken:

                                  Clears an invalid Access token from the WLAuthorizationManager cache

                                    - (void)clearAccessToken:(AccessToken *)accessToken
                                    
                                        
                                    	
                                    	
                                    


                                    Parameters

                                      AccessToken

                                      to remove


                                    Declared In

                                    WLAuthorizationManager.h


                                    isAuthorizationRequiredForResponse:

                                    Checks if the response for a request to a MobileFirst protected resource indicates that authorization is required.

                                      - (BOOL)isAuthorizationRequiredForResponse:(NSURLResponse *)response
                                      
                                          
                                      	
                                      	
                                      


                                      Parameters

                                        NSURLResponse

                                        response.


                                      Return Value

                                      true if MobileFirst authorization is required, false otherwise.


                                      Declared In

                                      WLAuthorizationManager.h


                                      isAuthorizationRequiredForResponseWithStatus:headers:

                                      Checks whether the response is a MobileFirst OAuth error.

                                        - (BOOL)isAuthorizationRequiredForResponseWithStatus:(NSInteger)status headers:(NSDictionary *)headers
                                        
                                            
                                        	
                                        	
                                        


                                        Parameters

                                          status

                                          HTTP status

                                          headers

                                            NSDictionary of response headers


                                        Return Value

                                        true if the response is a MobileFirst OAuth error, or false otherwise.


                                        Declared In

                                        WLAuthorizationManager.h


                                        isGatewayResponse:

                                        Check if the WLResponse contains a Gateway Challenge

                                          - (BOOL)isGatewayResponse:(WLResponse *)wlResponse
                                          
                                              
                                          	
                                          	
                                          


                                          Parameters

                                            wlResponse

                                            The incoming response


                                          Declared In

                                          WLAuthorizationManager.h


                                          login:withCredentials:withCompletionHandler:

                                          Login to the specified security check.

                                            - (void)login:(NSString *)securityCheck withCredentials:(NSDictionary *)credentials withCompletionHandler:(void ( ^ ) ( NSError *error ))completionHandler
                                            
                                                
                                            	
                                            	
                                            


                                            Parameters

                                              completionHandler

                                              Completion handler containing the error information in case of failure.

                                              NSString

                                              • The security check to log in to.

                                              NSDictionary

                                              • The credentials to use for login to the security check.


                                            Declared In

                                            WLAuthorizationManager.h


                                            logout:withCompletionHandler:

                                            Logout from the specified security check.

                                              - (void)logout:(NSString *)securityCheck withCompletionHandler:(void ( ^ ) ( NSError *error ))completionHandler
                                              
                                                  
                                              	
                                              	
                                              


                                              Parameters

                                                completionHandler

                                                Completion handler with response containing error information in case of failure.

                                                NSString

                                                • The security check to log out from.


                                              Declared In

                                              WLAuthorizationManager.h


                                              obtainAccessTokenForScope:withCompletionHandler:

                                              Obtains an access token for the specified MobileFirst protected resource scope.

                                                - (void)obtainAccessTokenForScope:(NSString *)scope withCompletionHandler:(void ( ^ ) ( AccessToken *accessToken , NSError *error ))completionHandler
                                                
                                                    
                                                	
                                                	
                                                


                                                Parameters

                                                  scope

                                                  The protected resource scope. ToDo - document the behaviour in case of nil or empty scope

                                                  completionHandler

                                                  Completion handler with response containing the access token, or error information in case of failure.


                                                Declared In

                                                WLAuthorizationManager.h


                                                resourceScopeFromResponse:

                                                Returns the resource scope from a response for a request to a MobileFirst protected resource.

                                                  - (NSString *)resourceScopeFromResponse:(NSURLResponse *)response
                                                  
                                                      
                                                  	
                                                  	
                                                  


                                                  Parameters

                                                    response

                                                    Response returned for the request to a protected resource.


                                                  Return Value

                                                  Scope that is returned in the

                                                    WWW-Authenticate header
                                                    	
                                                    	
                                                    	
                                                    	
                                                    	
                                                    	
                                                    	
                                                    	
                                                    	
                                                    	
                                                    	
                                                    	
                                                    	
                                                    


                                                    Declared In

                                                    WLAuthorizationManager.h


                                                    resourceScopeFromResponseHeaders:

                                                    Returns the resource scope from a response for a request to a MobileFirst protected resource.

                                                      - (NSString *)resourceScopeFromResponseHeaders:(NSDictionary *)headers
                                                      
                                                          
                                                      	
                                                      	
                                                      


                                                      Parameters

                                                        NSDictionary

                                                        Response headers returned for the request to a protected resource.


                                                      Return Value

                                                      Scope that is returned in the

                                                        WWW-Authenticate header
                                                        	
                                                        	
                                                        	
                                                        	
                                                        	
                                                        	
                                                        	
                                                        	
                                                        	
                                                        	
                                                        	
                                                        	
                                                        	
                                                        


                                                        Declared In

                                                        WLAuthorizationManager.h


                                                        setAuthorizationServerURL:

                                                        Sets the authorization server URL If this field is not set, the default MFP Authorization server URL is used

                                                          - (void)setAuthorizationServerURL:(NSURL *)url
                                                          
                                                              
                                                          	
                                                          	
                                                          


                                                          Parameters

                                                            the

                                                            context root of the authorization server


                                                          Declared In

                                                          WLAuthorizationManager.h


                                                          © Copyright IBM Corp. 2017