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.ts, line 13

Extends

Members

String

# 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.ts, line 230

String

# 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.ts, line 208

String

# 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.ts, line 197

String

# 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.ts, line 219

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.ts, line 68

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.ts, line 46

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.ts, line 35

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.ts, line 57

Methods

# static authenticate(identification, password) → {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.ts, line 246

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

Promise

# static invalidate() → {Promise}

Does nothing

View Source authenticators/devise.ts, line 266

A resolving promise

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.ts, line 275

The promise returned by fetch

Promise

# static restore(data) → {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.ts, line 231

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

Promise