Is there a standard HTTP Authentication scheme which is appropriate to use with OpenID Connect? The scenario I have in mind is as follows:
An HTTP Service requires authentication of users. One of the possible authentication methods is to use a federated identity from a 3rd party OpenID Provider. The Service is registered with the 3rd party OpenID Provider as a confidential client, and possesses a client_id and a client secret.
When a user tries to access the HTTP Service, the server responds with a 401 Unauthorized
and a WWW-Authenticate
header containing information about how to initiate an authentication request with the OpenID Provider:
WWW-Authenticate: OpenIDConnect realm="MyService", client_id="1234-5678", authorization_url="https://provider/authorize"
The client contacts the authorization endpoint, authenticates, and then obtains an authorization code. The code is then specified in a subsequent request to the Service via the Authorization
header, e.g.:
GET / HTTP/1.1
Authorization: OpenIDConnect client_id="1234-5678", code="AAABAAA..."
The Service will use the code to obtain an ID Token from the OpenID Provider and establish an authenticated session with the client, e.g. by setting a cookie or returning a new set of credentials to use for subsequent requests.
The OpenIDConnect
scheme is something I made up for this example. I have tried searching for a standard way to do something similar, and the absence of results has left me with the following possible answers:
- I have not searched hard enough.
- What I am trying to do is misguided and wrong.
- Everybody implements their own custom authentication schemes for this purpose