[auth] Authorize with oauth2

This commit is contained in:
bodnia
2016-03-13 23:37:10 +02:00
parent 0852d70f41
commit 56c5294c22
5 changed files with 10 additions and 14 deletions

View File

@@ -1,13 +1,11 @@
'use strict';
/* global OAuthSchemeKeys */
/* global redirect_uri */
/* global clientId */
/* global scopeSeparator */
/* global additionalQueryStringParams */
/* global clientSecret */
/* global onOAuthComplete */
/* global OAuthSchemeKeys */
/* global realm */
/*jshint unused:false*/
@@ -102,8 +100,8 @@ SwaggerUi.Views.AuthView = Backbone.View.extend({
var scopes = _.map(auth.get('scopes'), function (scope) {
return scope.scope;
});
var OAuthSchemeKeys = [];
var state, dets, ep;
window.OAuthSchemeKey = auth.get('title');
window.enabledScopes = scopes;
var flow = auth.get('flow');
@@ -113,12 +111,12 @@ SwaggerUi.Views.AuthView = Backbone.View.extend({
url = dets.authorizationUrl + '?response_type=' + (flow === 'implicit' ? 'token' : 'code');
window.swaggerUi.tokenName = dets.tokenName || 'access_token';
window.swaggerUi.tokenUrl = (flow === 'accessCode' ? dets.tokenUrl : null);
//state = key;
state = OAuthSchemeKey;
}
else if(auth.get('type') === 'oauth2' && flow && (flow === 'application')) {
dets = auth.attributes;
window.swaggerUi.tokenName = dets.tokenName || 'access_token';
this.clientCredentialsFlow(scopes, dets.tokenUrl, '');
this.clientCredentialsFlow(scopes, dets.tokenUrl, OAuthSchemeKey);
return;
}
else if(auth.get('grantTypes')) {