Module: Auth

AeroGear. Auth

new Auth(config) → {Object}

Status: Stable
The AeroGear.Auth namespace provides an authentication and enrollment API. Through the use of adapters, this library provides common methods like enroll, login and logout that will just work.
Parameters:
Name Type Argument Description
config String | Array | Object <optional>
A configuration for the modules(s) being created along with the authenticator. If an object or array containing objects is used, the objects can have the following properties:
Properties
Name Type Argument Default Description
name String the name that the module will later be referenced by
type String <optional>
"rest" the type of module as determined by the adapter used
settings Object <optional>
{} the settings to be passed to the adapter. For specific settings, see the documentation for the adapter you are using.
Source:
Returns:
The created authenticator containing any auth modules that may have been created
Type
Object
Example
// Create an empty authenticator
var auth = AeroGear.Auth();

// Create a single module using the default adapter
var auth2 = AeroGear.Auth( "myAuth" );

// Create multiple modules using the default adapter
var auth3 = AeroGear.Auth( [ "someAuth", "anotherAuth" ] );

// Create a single module by passing an object using the default adapter
var auth4 = AeroGear.Auth(
    {
        name: "objectAuth"
    }
);

// Create multiple modules by passing an array of objects using the default adapter
var auth5 = AeroGear.Auth([
    {
        name: "objectAuth"
    },
    {
        name: "objectAuth2",
        settings: { ... }
    }
]);

Members

<static> adapters

The adapters object is provided so that adapters can be added to the AeroGear.Auth namespace dynamically and still be accessible to the add method
Source:

<static> this.collectionName :Object

The name used to reference the collection of authentication module instances created from the adapters
Type:
  • Object
Default Value:
  • modules
Source: