mirror of https://github.com/abpframework/abp.git
19 changed files with 41 additions and 34 deletions
@ -1,14 +0,0 @@ |
|||||
function AbpSwaggerUIBundle(configObject) { |
|
||||
configObject.requestInterceptor = function (request) { |
|
||||
var token = abp.auth.getToken(); |
|
||||
request.headers.Authorization = token ? "Bearer " + token : null; |
|
||||
var antiForgeryToken = abp.security.antiForgery.getToken(); |
|
||||
if (antiForgeryToken) { |
|
||||
request.headers[abp.security.antiForgery.tokenHeaderName] = antiForgeryToken; |
|
||||
} |
|
||||
return request; |
|
||||
}; |
|
||||
|
|
||||
return SwaggerUIBundle(configObject); |
|
||||
} |
|
||||
|
|
||||
@ -1,16 +1,16 @@ |
|||||
using Volo.Abp.Modularity; |
using Volo.Abp.Modularity; |
||||
using Volo.Abp.VirtualFileSystem; |
using Volo.Abp.VirtualFileSystem; |
||||
|
|
||||
namespace Volo.Abp |
namespace Volo.Abp.Swashbuckle |
||||
{ |
{ |
||||
[DependsOn(typeof(AbpVirtualFileSystemModule))] |
[DependsOn(typeof(AbpVirtualFileSystemModule))] |
||||
public class AbpSwaggerModule : AbpModule |
public class AbpSwashbuckleModule : AbpModule |
||||
{ |
{ |
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
{ |
{ |
||||
Configure<AbpVirtualFileSystemOptions>(options => |
Configure<AbpVirtualFileSystemOptions>(options => |
||||
{ |
{ |
||||
options.FileSets.AddEmbedded<AbpSwaggerModule>(); |
options.FileSets.AddEmbedded<AbpSwashbuckleModule>(); |
||||
}); |
}); |
||||
} |
} |
||||
} |
} |
||||
@ -1,6 +1,6 @@ |
|||||
using System.IO; |
using System.IO; |
||||
|
|
||||
namespace Volo.Abp |
namespace Volo.Abp.Swashbuckle |
||||
{ |
{ |
||||
public interface ISwaggerHtmlResolver |
public interface ISwaggerHtmlResolver |
||||
{ |
{ |
||||
@ -0,0 +1,17 @@ |
|||||
|
var abp = abp || {}; |
||||
|
|
||||
|
(function () { |
||||
|
abp.SwaggerUIBundle = function (configObject) { |
||||
|
configObject.requestInterceptor = function (request) { |
||||
|
var token = abp.auth.getToken(); |
||||
|
request.headers.Authorization = token ? "Bearer " + token : null; |
||||
|
var antiForgeryToken = abp.security.antiForgery.getToken(); |
||||
|
if (antiForgeryToken) { |
||||
|
request.headers[abp.security.antiForgery.tokenHeaderName] = antiForgeryToken; |
||||
|
} |
||||
|
return request; |
||||
|
}; |
||||
|
|
||||
|
return SwaggerUIBundle(configObject); |
||||
|
} |
||||
|
})(); |
||||
Loading…
Reference in new issue