rebuilt
This commit is contained in:
@@ -124,12 +124,12 @@ Header params are supported through a pluggable mechanism in [swagger-js](https:
|
||||
$('#input_apiKey').change(function() {
|
||||
var key = $('#input_apiKey')[0].value;
|
||||
if(key && key.trim() != "") {
|
||||
swaggerUi.api.clientAuthorizations.add("key", new SwaggerClient.ApiKeyAuthorization("api_key", key, "header"));
|
||||
swaggerUi.api.clientAuthorizations.add("auth_name", new SwaggerClient.ApiKeyAuthorization("api_key", key, "header"));
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
This will add header `api_key` with value `key` on every call to the server. You can substitute `query` to send the values as a query param.
|
||||
This will add the header `api_key` with value `key` on calls that have the `auth_name` security scheme as part of their swaggerDefinitions. You can substitute `query` to send the values as a query param.
|
||||
|
||||
### Custom Header Parameters - (For Basic auth etc)
|
||||
If you have some header parameters which you need to send with every request, use the headers as below:
|
||||
|
||||
10
dist/lib/swagger-oauth.js
vendored
10
dist/lib/swagger-oauth.js
vendored
@@ -250,11 +250,19 @@ function clientCredentialsFlow(scopes, tokenUrl, OAuthSchemeKey) {
|
||||
|
||||
window.processOAuthCode = function processOAuthCode(data) {
|
||||
var OAuthSchemeKey = data.state;
|
||||
|
||||
// redirect_uri is required in auth code flow
|
||||
// see https://tools.ietf.org/html/draft-ietf-oauth-v2-31#section-4.1.3
|
||||
var host = window.location;
|
||||
var pathname = location.pathname.substring(0, location.pathname.lastIndexOf("/"));
|
||||
var defaultRedirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html';
|
||||
var redirectUrl = window.oAuthRedirectUrl || defaultRedirectUrl;
|
||||
|
||||
var params = {
|
||||
'client_id': clientId,
|
||||
'code': data.code,
|
||||
'grant_type': 'authorization_code',
|
||||
'redirect_uri': redirect_uri
|
||||
'redirect_uri': redirectUrl
|
||||
};
|
||||
|
||||
if (clientSecret) {
|
||||
|
||||
6
dist/swagger-ui.js
vendored
6
dist/swagger-ui.js
vendored
@@ -434,7 +434,7 @@ this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(dept
|
||||
+ "\" data-sw-translate>Terms of service</a></div>";
|
||||
},"6":function(depth0,helpers,partials,data) {
|
||||
var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
|
||||
return "<div class='info_name' data-sw-translate>Created by "
|
||||
return "<div><div class='info_name' style=\"display: inline\" data-sw-translate>Created by </div> "
|
||||
+ escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), depth0))
|
||||
+ "</div>";
|
||||
},"8":function(depth0,helpers,partials,data) {
|
||||
@@ -19668,6 +19668,10 @@ SwaggerUi.Views.AuthButtonView = Backbone.View.extend({
|
||||
content: this.$authEl
|
||||
};
|
||||
|
||||
// The content of the popup is removed and all events unbound after clicking the 'Cancel' button of the popup.
|
||||
// We'll have to re-render the contents before creating a new popup view.
|
||||
this.render();
|
||||
|
||||
this.popup = new SwaggerUi.Views.PopupView({model: authsModel});
|
||||
this.popup.render();
|
||||
},
|
||||
|
||||
8
dist/swagger-ui.min.js
vendored
8
dist/swagger-ui.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -250,11 +250,19 @@ function clientCredentialsFlow(scopes, tokenUrl, OAuthSchemeKey) {
|
||||
|
||||
window.processOAuthCode = function processOAuthCode(data) {
|
||||
var OAuthSchemeKey = data.state;
|
||||
|
||||
// redirect_uri is required in auth code flow
|
||||
// see https://tools.ietf.org/html/draft-ietf-oauth-v2-31#section-4.1.3
|
||||
var host = window.location;
|
||||
var pathname = location.pathname.substring(0, location.pathname.lastIndexOf("/"));
|
||||
var defaultRedirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html';
|
||||
var redirectUrl = window.oAuthRedirectUrl || defaultRedirectUrl;
|
||||
|
||||
var params = {
|
||||
'client_id': clientId,
|
||||
'code': data.code,
|
||||
'grant_type': 'authorization_code',
|
||||
'redirect_uri': redirect_uri
|
||||
'redirect_uri': redirectUrl
|
||||
};
|
||||
|
||||
if (clientSecret) {
|
||||
|
||||
@@ -39,6 +39,10 @@ SwaggerUi.Views.AuthButtonView = Backbone.View.extend({
|
||||
content: this.$authEl
|
||||
};
|
||||
|
||||
// The content of the popup is removed and all events unbound after clicking the 'Cancel' button of the popup.
|
||||
// We'll have to re-render the contents before creating a new popup view.
|
||||
this.render();
|
||||
|
||||
this.popup = new SwaggerUi.Views.PopupView({model: authsModel});
|
||||
this.popup.render();
|
||||
},
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<a href="{{externalDocs.url}}" target="_blank">{{externalDocs.url}}</a>
|
||||
{{/if}}
|
||||
{{#if info.termsOfServiceUrl}}<div class="info_tos"><a target="_blank" href="{{info.termsOfServiceUrl}}" data-sw-translate>Terms of service</a></div>{{/if}}
|
||||
{{#if info.contact.name}}<div class='info_name' data-sw-translate>Created by {{info.contact.name}}</div>{{/if}}
|
||||
{{#if info.contact.name}}<div><div class='info_name' style="display: inline" data-sw-translate>Created by </div> {{info.contact.name}}</div>{{/if}}
|
||||
{{#if info.contact.url}}<div class='info_url' data-sw-translate>See more at <a href="{{info.contact.url}}">{{info.contact.url}}</a></div>{{/if}}
|
||||
{{#if info.contact.email}}<div class='info_email'><a target="_parent" href="mailto:{{info.contact.email}}?subject={{info.title}}" data-sw-translate>Contact the developer</a></div>{{/if}}
|
||||
{{#if info.license}}<div class='info_license'><a target="_blank" href='{{info.license.url}}'>{{info.license.name}}</a></div>{{/if}}
|
||||
|
||||
Reference in New Issue
Block a user