Nswag: OpenIdConnect and cookie

Created on 15 May 2018  路  5Comments  路  Source: RicoSuter/NSwag

As of OpenAPI Specification 3.0 it is possible to use more authentication methods, in ASP.NET Core it is easy to AddAuthentication with OpenIdConnect and AddCookie. As swashbuckle is not supporting 3.0 I'm looking at NSwag. Is it possible to use NSwag and use cookie-authentication?

https://swagger.io/docs/specification/authentication/
https://swagger.io/docs/specification/authentication/cookie-authentication/

and use OpenIdConnect discovery?
https://swagger.io/docs/specification/authentication/openid-connect-discovery/

help wanted NSwag.AspNet bug

Most helpful comment

The answer before is just to change the spec for your needs. Maybe we also have to add more settings to configure the Swagger UI for that...,

All 5 comments

ATM auth support is limited, but you can add the required settings in PostProcess or with an own processor: https://github.com/RSuter/NSwag/wiki/Document-Processors-and-Operation-Processors

The answer before is just to change the spec for your needs. Maybe we also have to add more settings to configure the Swagger UI for that...,

I think I'll spend some time into NSwag and see how far I can get with it. With "we" you mean that there is no own processor or custom html template to use as override as in "me" to do so in the UI? :)

I'm not sure if the cookie authentication even works on swagger-ui by OAS v3 itself looking at this issue https://github.com/swagger-api/swagger-js/issues/1163

Was this page helpful?
0 / 5 - 0 ratings