1d65f9e41a
* ui: Adds model layer required for SSO 1. oidc-provider ember-data triplet plus repo, plus addition of torii addon 2. Make blocking queries support a Cache-Control: no-cache header 3. Tweaks to the token model layer in preparation for SSO work * Fix up meta related Cache-Control tests * Add tests adapter tests for URL shapes * Reset Cache-Control to the original value, return something from logout
38 lines
1 KiB
JavaScript
38 lines
1 KiB
JavaScript
import Oauth2CodeProvider from 'torii/providers/oauth2-code';
|
|
const NAME = 'oidc-with-url';
|
|
const Provider = Oauth2CodeProvider.extend({
|
|
name: NAME,
|
|
buildUrl: function() {
|
|
return this.baseUrl;
|
|
},
|
|
open: function(options) {
|
|
const name = this.get('name'),
|
|
url = this.buildUrl(),
|
|
responseParams = ['state', 'code'],
|
|
responseType = 'code';
|
|
return this.get('popup')
|
|
.open(url, responseParams, options)
|
|
.then(function(authData) {
|
|
// the same as the parent class but with an authorizationState added
|
|
return {
|
|
authorizationState: authData.state,
|
|
authorizationCode: decodeURIComponent(authData[responseType]),
|
|
provider: name,
|
|
};
|
|
});
|
|
},
|
|
close: function() {
|
|
const popup = this.get('popup.remote') || {};
|
|
if (typeof popup.close === 'function') {
|
|
return popup.close();
|
|
}
|
|
},
|
|
});
|
|
export function initialize(application) {
|
|
application.register(`torii-provider:${NAME}`, Provider);
|
|
}
|
|
|
|
export default {
|
|
initialize,
|
|
};
|