Class

DeviseAuthenticator

DeviseAuthenticator()

Constructor

# new DeviseAuthenticator()

Authenticator that works with the Ruby gem devise.

As token authentication is not actually part of devise anymore, the server needs to implement some customizations to work with this authenticator - see this gist.

View Source authenticators/devise.js, line 9

Extends

Members

String

# static identificationAttributeName

The identification attribute name. This will be used in the request and also be expected in the server's response.

Properties:
Name Type Description
identificationAttributeName
Default Value:
  • 'email'

View Source authenticators/devise.js, line 67

String

# static resourceName

The devise resource name. This will be used in the request and also be expected in the server's response.

Properties:
Name Type Description
resourceName
Default Value:
  • 'user'

View Source authenticators/devise.js, line 43

String

# static serverTokenEndpoint

The endpoint on the server that the authentication request is sent to.

Properties:
Name Type Description
serverTokenEndpoint
Default Value:
  • '/users/sign_in'

View Source authenticators/devise.js, line 31

String

# static tokenAttributeName

The token attribute name. This will be used in the request and also be expected in the server's response.

Properties:
Name Type Description
tokenAttributeName
Default Value:
  • 'token'

View Source authenticators/devise.js, line 55

Methods

# static authenticate(identification, password) → {Ember.RSVP.Promise}

Authenticates the session with the specified identification and password; the credentials are POSTed to the server. If the credentials are valid the server will responds with a token and identification. If the credentials are valid and authentication succeeds, a promise that resolves with the server's response is returned, otherwise a promise that rejects with the server error is returned.

Parameters:
Name Type Description
identification String

The user's identification

password String

The user's password

View Source authenticators/devise.js, line 88

A promise that when it resolves results in the session becoming authenticated. If authentication fails, the promise will reject with the server response; however, the authenticator reads that response already so if you need to read it again you need to clone the response object first

Ember.RSVP.Promise

# static invalidate() → {Ember.RSVP.Promise}

Does nothing

View Source authenticators/devise.js, line 142

A resolving promise

Ember.RSVP.Promise

# protected static makeRequest(data, options) → {Promise}

Makes a request to the Devise server using ember-fetch.

Parameters:
Name Type Description
data Object

The request data

options Object

request options that are passed to fetch

View Source authenticators/devise.js, line 154

The promise returned by fetch

Promise

# static restore(data) → {Ember.RSVP.Promise}

Restores the session from a session data object; returns a resolving promise when there are non-empty token and identification values in data and a rejecting promise otherwise.

Parameters:
Name Type Description
data Object

The data to restore the session from

View Source authenticators/devise.js, line 69

A promise that when it resolves results in the session becoming or remaining authenticated

Ember.RSVP.Promise