This repository has been archived on 2025-03-30. You can view files and clone it, but cannot push or open issues or pull requests.
hymenobacterdotinfo/app/authenticators/jwt-resolved.js
2015-07-16 18:47:12 -08:00

18 lines
567 B
JavaScript

import Ember from 'ember';
import JwtTokenAuthenticator from 'simple-auth-token/authenticators/jwt';
export default JwtTokenAuthenticator.extend({
authenticate: function(token) {
return new Ember.RSVP.Promise(resolve => {
let tokenData = this.getTokenData(token);
let expiresAt = tokenData[this.tokenExpireName];
let response = {};
response[this.tokenPropertyName] = token;
response.expiresAt = expiresAt;
this.scheduleAccessTokenRefresh(expiresAt, token);
resolve(this.getResponseData(response));
});
},
});