import BaseAuthorizer from 'ember-simple-auth/authorizers/base';

The base class for all authorizers. This serves as a starting point for implementing custom authorizers and must not be used directly.

Authorizers use the session data acquired by an authenticator when authenticating the session to construct authorization data that can, e.g., be injected into outgoing network requests. Depending on the authorization mechanism the authorizer implements, that authorization data might be an HTTP header, query string parameters, a cookie, etc.

The authorizer has to fit the authenticator (see BaseAuthenticator) as it can only use data that the authenticator acquires when authenticating the session.

Methods

source public

authorize(data, block)

Authorizes a block of code. This method will be invoked by the session service's authorize method which will pass the current authenticated session data (see data) and a block. Depending on the mechanism it implements, the authorizer transforms the session data into authorization data and invokes the block with that data.

BaseAuthorizer's implementation does nothing. This method must be overridden in custom authorizers.

Arguments

data: Object

The current authenticated session data

block: Function

The callback to call with the authorization data

Extends

Ember.Object

Methods