AGAuthorizer Class Reference
Inherits from | NSObject |
Declared in | AGAuthorizer.h AGAuthorizer.m |
Overview
AGAuthorizer manages different AGAuthzModule implementations. It is basically a factory that hides the concrete instantiation of a specific AGAuthzModule implementation. The class offers simple APIs to add, remove, or get access to a ‘authorization module’.
Creating an Authorizer with an Authorizer module
Below is an example that creates an Authorizer for OAuth2 implementation.
AGAuthorizer* authorizer = [AGAuthorizer authorizer];
_restAuthzModule = [authorizer authz:^(id<AGAuthzConfig> config) {
config.name = @"restAuthMod";
config.baseURL = [[NSURL alloc] initWithString:@"https://accounts.google.com"];
config.authzEndpoint = @"/o/oauth2/auth";
config.accessTokenEndpoint = @"/o/oauth2/token";
config.clientId = @"XXXXX";
config.redirectURL = @"org.aerogear.GoogleDrive:/oauth2Callback";
config.scopes = @[@"https://www.googleapis.com/auth/drive"];
}];;
Class Methods
authorizer
A factory method to instantiate an empty AGAuthorizer.
+ (id)authorizer
Return Value
the AGAuthenticator object
Discussion
A factory method to instantiate an empty AGAuthorizer.
Declared In
AGAuthorizer.h
Instance Methods
authz:
Adds a new AGAuthzModule object, based on the given configuration object.
- (id<AGAuthzModule>)authz:(void ( ^ ) ( id<AGAuthzConfig> config ))config
Parameters
- config
A block object which passes in an implementation of the AGAuthzConfig protocol. the object is used to configure the AGAuthzModule object.
Return Value
the newly created AGAuthzModule object
Discussion
Adds a new AGAuthzModule object, based on the given configuration object.
Declared In
AGAuthorizer.h
authzModuleWithName:
Loads a given AGAuthzModule implementation, based on the given moduleName argument.
- (id<AGAuthzModule>)authzModuleWithName:(NSString *)moduleName
Parameters
- moduleName
The name of the actual authz module object.
Discussion
Loads a given AGAuthzModule implementation, based on the given moduleName argument.
Declared In
AGAuthorizer.h
remove:
Removes a AGAuthzModule implementation from the AGAuthorizer. The authz module, to be removed is determined by the moduleName argument.
- (id<AGAuthzModule>)remove:(NSString *)moduleName
Parameters
- moduleName
The name of the actual auth module object.
Discussion
Removes a AGAuthzModule implementation from the AGAuthorizer. The authz module, to be removed is determined by the moduleName argument.
Declared In
AGAuthorizer.h