Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// import OAuth2Bearer from 'ember-simple-auth/authorizers/oauth2-bearer';
// export default OAuth2Bearer.extend();
import BaseAuthorizer from 'ember-simple-auth/authorizers/base'
export default BaseAuthorizer.extend({
// serverTokenEndpoint: `${config.apiHost}/Users/login`,
// serverTokenRevocationEndpoint: `${config.apiHost}/Users/logout`
authorize(data, block) {
// console.log('authorize', data, block)
block('Authorization', data.token)
}
});
import Base from 'ember-simple-auth/authorizers/base';
import Configuration from '../configuration';
/**
Authorizer that works with token-based authentication like JWT
by sending the `token` properties from the session in the `Authorization` header.
_The factory for this authorizer is registered as
`'authorizer:token'` in Ember's container._
@class Token
@namespace SimpleAuth.Authorizers
@module ember-simple-auth-token/authorizers/token
@extends Base
*/
export default Base.extend({
session: Ember.inject.service('session'),
/**
The prefix used in the value of the Authorization header.
This value can be configured via
[`SimpleAuth.Configuration.Token#authorizationPrefix`](#SimpleAuth-Configuration-Token-authorizationPrefix).
@property authorizationPrefix
@type String
@default 'Bearer '
*/
authorizationPrefix: 'Bearer ',
/**
The name of the property in session that contains token used for authorization.
import Base from 'ember-simple-auth/authorizers/base';
export default Base.extend({
authorize(data, block) {
const authData = data.token;
block('Authorization', `Token ${authData}`);
}
});
import Base from 'ember-simple-auth/authorizers/base';
/**
* @module ember-osf-web
* @submodule authorizers
*/
/**
* Ember-simple-auth compatible authorizer based on OAuth2 bearer tokens.
*
* Intended to be used with the authenticator of the same name.
*
* @class OsfTokenAuthorizer
* @extends ember-simple-auth/BaseAuthorizer
*/
export default Base.extend({
authorize(sessionData, setHeader) {
setHeader('Authorization', `Bearer ${sessionData.attributes.accessToken}`);
},
});
import { get } from '@ember/object';
import { isEmpty } from '@ember/utils';
import Authorizer from 'ember-simple-auth/authorizers/base';
export default Authorizer.extend({
authorize(rawSession, block) {
const accessToken = get(rawSession, 'data.meta.token');
if (!isEmpty(accessToken)) {
block('Authorization', `Bearer ${accessToken}`);
}
}
});
import Base from 'ember-simple-auth/authorizers/base';
export default Base.extend({
authorize(data, callback) {
callback(data.api_key, data.admin_auth_token);
},
});
import Base from 'ember-simple-auth/authorizers/base';
/**
* @module ember-osf
* @submodule authorizers
*/
/**
* Ember-simple-auth compatible authorizer based on OAuth2 bearer tokens.
*
* Intended to be used with the authenticator of the same name.
*
* @class OsfTokenAuthorizer
* @extends ember-simple-auth/BaseAuthorizer
*/
export default Base.extend({
authorize(sessionData, setHeader) {
setHeader('Authorization', `Bearer ${sessionData.attributes.accessToken}`);
}
});
import Base from 'ember-simple-auth/authorizers/base';
import Ember from 'ember';
export default Base.extend({
session: Ember.inject.service(),
authorize(data, block) {
if (Ember.testing) {
block('Authorization', 'Bearer beyonce');
}
const { token } = data
if (this.get('session.isAuthenticated') && token) {
block('Authorization', `Bearer ${token}`);
}
}
});
import Ember from 'ember';
import Base from 'ember-simple-auth/authorizers/base';
const { isEmpty } = Ember;
export default Base.extend({
authorize(user, block) {
if (user && user.token && !isEmpty(user.token)) {
block('Authorization', `Token ${user.token}`);
}
}
});
import { inject as service } from '@ember/service';
import Base from "ember-simple-auth/authorizers/base";
export default Base.extend({
session: service(),
authorize: function(jqXHR, requestOptions) {
var session = this.get("session");
if (!session.isAuthenticated) {
return;
}
var auth_token = session.content.auth_token;
if (requestOptions.headers === undefined) {
requestOptions.headers = {};
}
requestOptions.headers["Authentication-Token"] = auth_token;
}
});