Comment 0 for bug 1541621

Revision history for this message
Guang Yee (guang-yee) wrote : Invalid subject fernet token should result in 404 instead of 401

When a scoped fernet token is no longer valid (i.e. all the roles had been removed from the scope), token validation should result in 404 instead of 401. According to Keystone V3 API spec, 401 is returned only if X-Auth-Token is invalid. Invalid X-Subject-Token should yield 404. Furthermore, auth_token middleware only treat 404 as invalid subject token and cache it accordingly. Improper 401 will cause unnecessary churn as middleware will repeatedly attempt to re-authenticate the service user.

https://github.com/openstack/keystonemiddleware/blob/master/keystonemiddleware/auth_token/_identity.py#L215

To reproduce the problem:

1. get a project scoped token
2. remove all the roles assigned to the user for that project
3. attempt to validate that project-scoped token will result in 401