import BaseAuthenticator from './base'; export type NestedRecord = Record>; /** Authenticator that works with the Ruby gem [devise](https://github.com/plataformatec/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](https://gist.github.com/josevalim/fb706b1e933ef01e4fb6). @class DeviseAuthenticator @extends BaseAuthenticator @public */ export default class DeviseAuthenticator extends BaseAuthenticator { /** The endpoint on the server that the authentication request is sent to. @memberof DeviseAuthenticator @property serverTokenEndpoint @type String @default '/users/sign_in' @public */ serverTokenEndpoint: string; /** The devise resource name. __This will be used in the request and also be expected in the server's response.__ @memberof DeviseAuthenticator @property resourceName @type String @default 'user' @public */ resourceName: string; /** The token attribute name. __This will be used in the request and also be expected in the server's response.__ @memberof DeviseAuthenticator @property tokenAttributeName @type String @default 'token' @public */ tokenAttributeName: string; /** The identification attribute name. __This will be used in the request and also be expected in the server's response.__ @memberof DeviseAuthenticator @property identificationAttributeName @type String @default 'email' @public */ identificationAttributeName: string; /** Restores the session from a session data object; __returns a resolving promise when there are non-empty [token]{@linkplain DeviseAuthenticator.tokenAttributeName} and [identification]{@linkplain DeviseAuthenticator.identificationAttributeName} values in `data`__ and a rejecting promise otherwise. @memberof DeviseAuthenticator @method restore @param {Object} data The data to restore the session from @return {Promise} A promise that when it resolves results in the session becoming or remaining authenticated @public */ restore(data: Record): Promise>; /** Authenticates the session with the specified `identification` and `password`; the credentials are `POST`ed to the [server]{@linkplain DeviseAuthenticator.serverTokenEndpoint}. If the credentials are valid the server will responds with a [token]{@linkplain DeviseAuthenticator.tokenAttributeName} and [identification]{@linkplain DeviseAuthenticator.identificationAttributeName}. __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. @memberof DeviseAuthenticator @method authenticate @param {String} identification The user's identification @param {String} password The user's password @return {Promise} 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 @public */ authenticate(identification: string, password: string): Promise; /** Does nothing @memberof DeviseAuthenticator @method invalidate @return {Promise} A resolving promise @public */ invalidate(): Promise; /** Makes a request to the Devise server using [ember-fetch](https://github.com/stefanpenner/ember-fetch). @memberof DeviseAuthenticator @method makeRequest @param {Object} data The request data @param {Object} options request options that are passed to `fetch` @return {Promise} The promise returned by `fetch` @protected */ makeRequest(data: NestedRecord, options?: { url?: string; }): Promise; _validate(data: Record): boolean; }