, http://bitoftech.net/2014/08/25/asp-net-web-api-documentation-using-swagger/ .
, :
1. "SwaggerExtensions", JS "onComplete.js", "Embedded Resource".
2. "onComplete.js" :
$('#input_apiKey').change(function () {
var key = $('#input_apiKey')[0].value;
if (key && key.trim() != "") {
key = "Bearer " + key;
window.authorizations.add("key", new ApiKeyAuthorization("Authorization", key, "header"));
}
});
3. "SwaggerConfig.cs" register :
SwaggerUiConfig.Customize(c =>
{
c.SupportHeaderParams = true;
c.InjectJavaScript(typeof(SwaggerConfig).Assembly, "AngularJSAuthentication.API.SwaggerExtensions.onComplete.js");
});
, .
, , , .