Best practice for token revocation (web clients)
Problem
I am using the oidc-client in my web application to communicate with IdSvr4. I can login successfully and obtain the user profile and access token.
I am encountering a 400 error when calling Oidc.UserManager.signoutRedirect():

The post is failing because the server is expecting a client secret:

Question
Storing a secret in a web client doesn't make sense, and although setting RequireClientSecret = false in the Client definition on the server solves the problem this seems like a security vulnerability... but I am not sure.
What is the "proper" way to configure the signout?
Yes, it sounds strange, but if the grant type is configured properly (implicit in this case) then the client will not be allowed to access the token endpoint (which is the other place the RequireClientSecret=false would be applicable).
We can review to either cleanup the names, and/or ensure there's no vulnerable configuration.
The grant type is set to Implicit (see below for Client definition). What I am confused about is why the javascript oidc-client checks to see if the current access token needs to be revoked. Should the server not handle revoking any active tokens when a signout occurs ?
Setting RequireClientSecret to false seems dangerous because it exposes the revocation endpoint to anybody.
Maybe I should post this in the oidc-client repo... ?
new Client
{
ClientName = "Test Website",
ClientId = "testwebclient",
AccessTokenType = AccessTokenType.Reference,
AllowedGrantTypes = GrantTypes.Implicit,
AllowAccessTokensViaBrowser = true,
// TODO: without RequireClientSecret = false
// Oidc.UserManager.signoutRedirect() throws an
// error when logging out (400 because no secret
// is passed). Is this a security vulnerability?
RequireClientSecret = false,
RedirectUris = new List<string>
{
"https://localhost:44335",
"https://localhost:44335/silent_renew.html",
},
PostLogoutRedirectUris = new List<string>
{
"https://localhost:44335"
},
AllowedScopes = new List<string>
{
StandardScopes.OpenId.Name,
StandardScopes.Profile.Name,
"webapi"
}
}
Should the server not handle revoking any active tokens when a signout occurs ?
It does not automatically, no.
Setting RequireClientSecret to false seems dangerous because it exposes the revocation endpoint to anybody.
Only if they have a valid access token for that client, which should only be your JS client.
Maybe I should post this in the oidc-client repo
Perhaps there should be a flag in the UserManagerSettings to not use the revocation endpoint automatically. But... if you're signing out, and it's a reference token... then revoking it seems like a good idea to me.
Don't forget that IdSvr4 is still a work in progress. For this workflow we might relax that configuration setting. If we can infer this scenario securely, then I'd like to make it work.
If we can infer this scenario securely, then I'd like to make it work.
Agreed, this would be ideal.
Don't forget that IdSvr4 is still a work in progress.
Thank you for the great work you guys do! I'm looking forward to this projects continuing development.
For this workflow we might relax that configuration setting. If we can infer this scenario securely, then I'd like to make it work.
Done: For clients that only have the implicit grant type, we allow using revocation endpoint without credentials.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.