[NETCONF-990] Explore swagger authentication feature Created: 12/Apr/23  Updated: 22/Jun/23  Resolved: 19/Apr/23

Status: Resolved
Project: netconf
Component/s: restconf-openapi
Affects Version/s: None
Fix Version/s: 5.0.5

Type: New Feature Priority: Medium
Reporter: Ivan Hrasko Assignee: Ivan Hrasko
Resolution: Done Votes: 0
Labels: pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to NETCONF-1064 OpenApi: Test authentication feature Resolved

 Description   

We can explore swagger authentication feature according to https://swagger.io/docs/specification/authentication/. This way we could be able to make our swagger UI to show Authorize button as seen at https://petstore3.swagger.io/.

We hope that in the future, we can make our swagger UI to be available for browsing without requiring credentials, and credentials will be attached only when user wants to try some requests.



 Comments   
Comment by Ivan Hrasko [ 18/Apr/23 ]

We were able to apply security tag for every example shown by swagger UI (version OpenAPI2 and version ApenAPI3). It makes Authorize button visible and offers basicAuth option. When user authorizes then every request send using swagger UI contains Authorization header with basic auth.

By default when (default ODL) basic shiro filter is used to secure both swagger UI and restconf interface user does not need to be authorized because session cookie is in place. But in situation when other filters are configured to be used (ODL allows to register additional filters) and basic shiro filter is turned off it allows to provide authorization header in the request as potentially required by that 3rd party filter.

This is especially useful when 3rd party filter does not provide login page in case of missing credentials (basic shiro filter prompts for credentials by default). In this case using Authorize button is the only possibility to authorize requests - otherwise they will get 401.

For now we have implemented basicAuth. Later we can add others methods as defined in https://swagger.io/docs/specification/authentication/ as well.

Generated at Wed Feb 07 20:16:24 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.