Enhancement
Major
#28558
OpenAPI: Enable multiple alternative authentication mechanisms for the same API
If several authentication methods are currently specified for an API, then all of these methods must be fulfilled when accessing the API. However, this is contrary to the OpenAPI specification, which states that if several authentication methods are specified, these are to be considered as possible alternatives.
Improvement
- Several authorization procedures on the server side are alternatives.
- Services can also be offered in the user context via HTTP BasicAuth (mainly for simplified testing of interfaces in the user context).
- Authentication procedures are now pluggable, i.e. they can be defined by the application. Example: com.top_logic.demo.api.CustomAuthentication
Code migration
- In the OpenAPI method registry configuration (if available)
<authentication config:interface="com.top_logic.service.openapi.common.authentication.oauth.WithUserAuthentication" ...
by
<authentication class="com.top_logic.service.openapi.client.authentication.oauth.user.WithUserAuthentication" ...
replace.
Test
Configure the API with several alternative authentication methods and check that access is possible with each method individually.
In tl-demo: API "/whoami", which can be used with two authentication methods.