Authorization über access token eingebaut
This commit is contained in:
@@ -20,6 +20,8 @@ Public Class SwaggerConfig
|
||||
|
||||
GlobalConfiguration.Configuration.EnableSwagger(Function(c)
|
||||
'c.SingleApiVersion("v1", descr)
|
||||
|
||||
|
||||
c.PrettyPrint()
|
||||
c.MultipleApiVersions(Function(apiDesc, targetApiVersion) ResolveVersionSupportByRouteConstraint(apiDesc, targetApiVersion), Function(vc)
|
||||
|
||||
@@ -27,18 +29,24 @@ Public Class SwaggerConfig
|
||||
vc.Version("v2", descr & " V2")
|
||||
vc.Version("v3", descr & " V3")
|
||||
End Function)
|
||||
c.ApiKey("apiKey").Description("API Key Authentication").Name("apiKey").In("header")
|
||||
|
||||
|
||||
'c.OAuth2("oauth2").Description("OAuth2 Implicit Grant").Flow("implicit").AuthorizationUrl("http://petstore.swagger.wordnik.com/api/oauth/dialog").Scopes(Function(scopes)
|
||||
' scopes.Add("read", "Read access to protected resources")
|
||||
' scopes.Add("write", "Write access to protected resources")
|
||||
' End Function)
|
||||
c.BasicAuth("basic").Description("Basic HTTP Authentication")
|
||||
c.OperationFilter(Of AddAuthorizationHeaderParameterOperationFilter)()
|
||||
|
||||
|
||||
'c.IncludeXmlComments($"{AppDomain.CurrentDomain.BaseDirectory}\bin\MyApi.XML")
|
||||
'c.RootUrl(Function(req) "http://localhost:58452/")
|
||||
|
||||
End Function).EnableSwaggerUi(Function(c)
|
||||
c.DocumentTitle(descr)
|
||||
c.EnableDiscoveryUrlSelector()
|
||||
c.DocExpansion(DocExpansion.List)
|
||||
c.EnableApiKeySupport("apiKey", "header")
|
||||
c.DocExpansion(DocExpansion.Full)
|
||||
|
||||
'c.EnableOAuth2Support(clientId:="test-client-id", clientSecret:=Nothing, realm:="test-realm", appName:="Swagger UI", additionalQueryStringParams:=New Dictionary(Of String, String)() From {
|
||||
' {"foo", "bar"}
|
||||
'})
|
||||
|
||||
Reference in New Issue
Block a user