[auth] Authorize with oauth2
This commit is contained in:
2
dist/lib/swagger-oauth.js
vendored
2
dist/lib/swagger-oauth.js
vendored
@@ -331,7 +331,7 @@ window.onOAuthComplete = function onOAuthComplete(token,OAuthSchemeKey) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
window.swaggerUi.api.clientAuthorizations.add(OAuthSchemeKey, new SwaggerClient.ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header'));
|
window.swaggerUi.api.clientAuthorizations.add(window.OAuthSchemeKey, new SwaggerClient.ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
8
dist/swagger-ui.js
vendored
8
dist/swagger-ui.js
vendored
@@ -19472,14 +19472,12 @@ SwaggerUi.Views.AuthsCollectionView = Backbone.View.extend({
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/* global OAuthSchemeKeys */
|
|
||||||
/* global redirect_uri */
|
/* global redirect_uri */
|
||||||
/* global clientId */
|
/* global clientId */
|
||||||
/* global scopeSeparator */
|
/* global scopeSeparator */
|
||||||
/* global additionalQueryStringParams */
|
/* global additionalQueryStringParams */
|
||||||
/* global clientSecret */
|
/* global clientSecret */
|
||||||
/* global onOAuthComplete */
|
/* global onOAuthComplete */
|
||||||
/* global OAuthSchemeKeys */
|
|
||||||
/* global realm */
|
/* global realm */
|
||||||
/*jshint unused:false*/
|
/*jshint unused:false*/
|
||||||
|
|
||||||
@@ -19574,8 +19572,8 @@ SwaggerUi.Views.AuthView = Backbone.View.extend({
|
|||||||
var scopes = _.map(auth.get('scopes'), function (scope) {
|
var scopes = _.map(auth.get('scopes'), function (scope) {
|
||||||
return scope.scope;
|
return scope.scope;
|
||||||
});
|
});
|
||||||
var OAuthSchemeKeys = [];
|
|
||||||
var state, dets, ep;
|
var state, dets, ep;
|
||||||
|
window.OAuthSchemeKey = auth.get('title');
|
||||||
|
|
||||||
window.enabledScopes = scopes;
|
window.enabledScopes = scopes;
|
||||||
var flow = auth.get('flow');
|
var flow = auth.get('flow');
|
||||||
@@ -19585,12 +19583,12 @@ SwaggerUi.Views.AuthView = Backbone.View.extend({
|
|||||||
url = dets.authorizationUrl + '?response_type=' + (flow === 'implicit' ? 'token' : 'code');
|
url = dets.authorizationUrl + '?response_type=' + (flow === 'implicit' ? 'token' : 'code');
|
||||||
window.swaggerUi.tokenName = dets.tokenName || 'access_token';
|
window.swaggerUi.tokenName = dets.tokenName || 'access_token';
|
||||||
window.swaggerUi.tokenUrl = (flow === 'accessCode' ? dets.tokenUrl : null);
|
window.swaggerUi.tokenUrl = (flow === 'accessCode' ? dets.tokenUrl : null);
|
||||||
//state = key;
|
state = OAuthSchemeKey;
|
||||||
}
|
}
|
||||||
else if(auth.get('type') === 'oauth2' && flow && (flow === 'application')) {
|
else if(auth.get('type') === 'oauth2' && flow && (flow === 'application')) {
|
||||||
dets = auth.attributes;
|
dets = auth.attributes;
|
||||||
window.swaggerUi.tokenName = dets.tokenName || 'access_token';
|
window.swaggerUi.tokenName = dets.tokenName || 'access_token';
|
||||||
this.clientCredentialsFlow(scopes, dets.tokenUrl, '');
|
this.clientCredentialsFlow(scopes, dets.tokenUrl, OAuthSchemeKey);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if(auth.get('grantTypes')) {
|
else if(auth.get('grantTypes')) {
|
||||||
|
|||||||
4
dist/swagger-ui.min.js
vendored
4
dist/swagger-ui.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -331,7 +331,7 @@ window.onOAuthComplete = function onOAuthComplete(token,OAuthSchemeKey) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
window.swaggerUi.api.clientAuthorizations.add(OAuthSchemeKey, new SwaggerClient.ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header'));
|
window.swaggerUi.api.clientAuthorizations.add(window.OAuthSchemeKey, new SwaggerClient.ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/* global OAuthSchemeKeys */
|
|
||||||
/* global redirect_uri */
|
/* global redirect_uri */
|
||||||
/* global clientId */
|
/* global clientId */
|
||||||
/* global scopeSeparator */
|
/* global scopeSeparator */
|
||||||
/* global additionalQueryStringParams */
|
/* global additionalQueryStringParams */
|
||||||
/* global clientSecret */
|
/* global clientSecret */
|
||||||
/* global onOAuthComplete */
|
/* global onOAuthComplete */
|
||||||
/* global OAuthSchemeKeys */
|
|
||||||
/* global realm */
|
/* global realm */
|
||||||
/*jshint unused:false*/
|
/*jshint unused:false*/
|
||||||
|
|
||||||
@@ -102,8 +100,8 @@ SwaggerUi.Views.AuthView = Backbone.View.extend({
|
|||||||
var scopes = _.map(auth.get('scopes'), function (scope) {
|
var scopes = _.map(auth.get('scopes'), function (scope) {
|
||||||
return scope.scope;
|
return scope.scope;
|
||||||
});
|
});
|
||||||
var OAuthSchemeKeys = [];
|
|
||||||
var state, dets, ep;
|
var state, dets, ep;
|
||||||
|
window.OAuthSchemeKey = auth.get('title');
|
||||||
|
|
||||||
window.enabledScopes = scopes;
|
window.enabledScopes = scopes;
|
||||||
var flow = auth.get('flow');
|
var flow = auth.get('flow');
|
||||||
@@ -113,12 +111,12 @@ SwaggerUi.Views.AuthView = Backbone.View.extend({
|
|||||||
url = dets.authorizationUrl + '?response_type=' + (flow === 'implicit' ? 'token' : 'code');
|
url = dets.authorizationUrl + '?response_type=' + (flow === 'implicit' ? 'token' : 'code');
|
||||||
window.swaggerUi.tokenName = dets.tokenName || 'access_token';
|
window.swaggerUi.tokenName = dets.tokenName || 'access_token';
|
||||||
window.swaggerUi.tokenUrl = (flow === 'accessCode' ? dets.tokenUrl : null);
|
window.swaggerUi.tokenUrl = (flow === 'accessCode' ? dets.tokenUrl : null);
|
||||||
//state = key;
|
state = OAuthSchemeKey;
|
||||||
}
|
}
|
||||||
else if(auth.get('type') === 'oauth2' && flow && (flow === 'application')) {
|
else if(auth.get('type') === 'oauth2' && flow && (flow === 'application')) {
|
||||||
dets = auth.attributes;
|
dets = auth.attributes;
|
||||||
window.swaggerUi.tokenName = dets.tokenName || 'access_token';
|
window.swaggerUi.tokenName = dets.tokenName || 'access_token';
|
||||||
this.clientCredentialsFlow(scopes, dets.tokenUrl, '');
|
this.clientCredentialsFlow(scopes, dets.tokenUrl, OAuthSchemeKey);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if(auth.get('grantTypes')) {
|
else if(auth.get('grantTypes')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user