Inherits from NSObject
Declared in AGAuthenticator.h
AGAuthenticator.m

Overview

AGAuthenticator manages different AGAuthenticationModule implementations. It is basically a factory that hides the concrete instantiation of a specific AGAuthenticationModule implementation. The class offers simple APIs to add, remove, or get access to a ‘authentication module’.

Creating an Authenticator with an Authentication module

Below is an example that creates an Authenticator that points to the remote AeroGear TODO server application.

// create an authenticator object
AGAuthenticator* authenticator = [AGAuthenticator authenticator];

// the base URL of the application we want to authenticate to
NSString* baseURL = @"http://todo-aerogear.rhcloud.com/todo-server/";

// add a new auth module and the required 'base URL':
id<AGAuthenticationModule> myMod = [authenticator auth:^(id<AGAuthConfig> config) {
    [config setName:@"authMod"];
    [config setBaseURL:[NSURL URLWithString:baseURL]];
}];

Class Methods

authenticator

A factory method to instantiate an empty AGAuthenticator.

+ (id)authenticator

Return Value

the AGAuthenticator object

Discussion

A factory method to instantiate an empty AGAuthenticator.

Declared In

AGAuthenticator.h

Instance Methods

auth:

Adds a new AGAuthenticationModule object, based on the given configuration object.

- (id<AGAuthenticationModule>)auth:(void ( ^ ) ( id<AGAuthConfig> config ))config

Parameters

config

A block object which passes in an implementation of the AGAuthConfig protocol. the object is used to configure the AGAuthenticationModule object.

Return Value

the newly created AGAuthenticationModule object

Discussion

Adds a new AGAuthenticationModule object, based on the given configuration object.

Declared In

AGAuthenticator.h

authModuleWithName:

Loads a given AGAuthenticationModule implementation, based on the given moduleName argument.

- (id<AGAuthenticationModule>)authModuleWithName:(NSString *)moduleName

Parameters

moduleName

The name of the actual auth module object.

Discussion

Loads a given AGAuthenticationModule implementation, based on the given moduleName argument.

Declared In

AGAuthenticator.h

remove:

Removes a AGAuthenticationModule implementation from the AGAuthenticator. The auth module, to be removed is determined by the moduleName argument.

- (id<AGAuthenticationModule>)remove:(NSString *)moduleName

Parameters

moduleName

The name of the actual auth module object.

Discussion

Removes a AGAuthenticationModule implementation from the AGAuthenticator. The auth module, to be removed is determined by the moduleName argument.

Declared In

AGAuthenticator.h