New token always returned

Bug #919335 reported by Liem Nguyen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Invalid
Medium
Unassigned

Bug Description

Branch: Master

Doing a POST /tokens for joeuser (user 061110baf07c4fa6aa3acdfe7ab4e33c (tenant: c8c8e3ea89834869b5060bbc6dd02da4)) generates a new token every time (even when the old token hasn't expired). It appears we cannot find the token from the DB (sqlalchemy)...

2012-01-20 10:07:49 DEBUG [keystone.frontends.d5_compat] Entering D5AuthProtocol.__call__
2012-01-20 10:07:49 DEBUG [routes.middleware] Matched POST /tokens
2012-01-20 10:07:49 DEBUG [routes.middleware] Route path: '/tokens', defaults: {'action': u'authenticate', 'controller': <keystone.controllers.token.TokenController object at 0x2bcf7d0>}
2012-01-20 10:07:49 DEBUG [routes.middleware] Match dict: {'action': u'authenticate', 'controller': <keystone.controllers.token.TokenController object at 0x2bcf7d0>}
2012-01-20 10:07:49 DEBUG [keystone.logic.service] Authenticating with passwordCredentials
2012-01-20 10:07:49 DEBUG [keystone.logic.service] Authenticating user 061110baf07c4fa6aa3acdfe7ab4e33c (tenant: c8c8e3ea89834869b5060bbc6dd02da4)
2012-01-20 10:07:49 DEBUG [keystone.logic.service] Token was not found or expired. Creating a new token for the user
2012-01-20 10:07:49 DEBUG [keystone.logic.service] User 061110baf07c4fa6aa3acdfe7ab4e33c failed check - did not have role 2
2012-01-20 10:07:49 DEBUG [keystone.logic.service] User 061110baf07c4fa6aa3acdfe7ab4e33c failed check - did not have role 1
2012-01-20 10:07:49 DEBUG [eventlet.wsgi.server] 127.0.0.1 - - [20/Jan/2012 10:07:49] "POST /v2.0/tokens HTTP/1.1" 200 1858 0.146559
2012-01-20 10:07:55 WARNING [keystone.frontends.normalizer] Falling back to `webob` v1.1 and older support. Check your version of webob
2012-01-20 10:07:55 DEBUG [keystone.frontends.normalizer] */* header could not be matched
2012-01-20 10:07:55 DEBUG [keystone.frontends.legacy_token_auth] Entering AuthProtocol.__call__
2012-01-20 10:07:55 DEBUG [keystone.frontends.legacy_token_auth] Not a v1.0/v1.1 call, so passing downstream
2012-01-20 10:07:55 DEBUG [keystone.frontends.d5_compat] Entering D5AuthProtocol.__call__
2012-01-20 10:07:55 DEBUG [routes.middleware] Matched POST /tokens
2012-01-20 10:07:55 DEBUG [routes.middleware] Route path: '/tokens', defaults: {'action': u'authenticate', 'controller': <keystone.controllers.token.TokenController object at 0x2bcf7d0>}
2012-01-20 10:07:55 DEBUG [routes.middleware] Match dict: {'action': u'authenticate', 'controller': <keystone.controllers.token.TokenController object at 0x2bcf7d0>}
2012-01-20 10:07:55 DEBUG [keystone.logic.service] Authenticating with passwordCredentials
2012-01-20 10:07:55 DEBUG [keystone.logic.service] Authenticating user 061110baf07c4fa6aa3acdfe7ab4e33c (tenant: c8c8e3ea89834869b5060bbc6dd02da4)
2012-01-20 10:07:55 DEBUG [keystone.logic.service] Token was not found or expired. Creating a new token for the user
2012-01-20 10:07:55 DEBUG [keystone.logic.service] User 061110baf07c4fa6aa3acdfe7ab4e33c failed check - did not have role 2
2012-01-20 10:07:55 DEBUG [keystone.logic.service] User 061110baf07c4fa6aa3acdfe7ab4e33c failed check - did not have role 1
2012-01-20 10:07:55 DEBUG [eventlet.wsgi.server] 127.0.0.1 - - [20/Jan/2012 10:07:55] "POST /v2.0/tokens HTTP/1.1" 200 1858 0.110892

Revision history for this message
Liem Nguyen (liemmn) wrote :

This is a change in behavior from essex-2... So, please confirm if this is intended or indeed a bug...

Revision history for this message
Dolph Mathews (dolph) wrote :

This is definitely not the intended behavior.

Changed in keystone:
assignee: nobody → Dolph Mathews (dolph)
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

Fix proposed to branch: master
Review: https://review.openstack.org/3424

Changed in keystone:
status: New → In Progress
Revision history for this message
Dolph Mathews (dolph) wrote :

I wrote a pair of tests for the following scenarios:

    1) authenticating for an unscoped token twice
    2) authenticating for a scoped token twice

Both tests already pass in master - marking this bug as invalid for now, unless you have a more specific scenario? If so, a failing test would be helpful! Thanks, Liem!

Changed in keystone:
status: In Progress → Invalid
Revision history for this message
Jesse Andrews (anotherjesse) wrote :

I'm confused what a token is if a new token shouldn't be generated each time you authenticate?

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/3424
Committed: http://github.com/openstack/keystone/commit/2efd3117bd8103f16bf561873deaa5210db257cb
Submitter: Jenkins
Branch: master

commit 2efd3117bd8103f16bf561873deaa5210db257cb
Author: Dolph Mathews <email address hidden>
Date: Wed Jan 25 13:53:23 2012 -0600

    Test coverage for issue described in bug 919335

    Change-Id: I5608968ba287e732216da9c883a32a16b2b15523

Changed in keystone:
status: Invalid → Fix Committed
Revision history for this message
Dolph Mathews (dolph) wrote :

Jesse, is there a business case to support one behavior over the other?

Revision history for this message
Jesse Andrews (anotherjesse) wrote :

I'm thinking of the security model.

What does a token represent? In some (all?) token systems, a token represents an authentication session. So if the same token is returned for every auth request (eg, every session) then you don't have the potential to revoke for a given context.

Revision history for this message
Ziad Sawalha (ziad-sawalha) wrote : Re: [Bug 919335] Re: New token always returned
Download full text (4.7 KiB)

The token represents access granted for a specific time period. Think of it as a 'handle' to the set of data describing the access granted. It is not associated with a session. Returning the same token for the same credentials has significant scalability benefits, and is perfectly sound if you're not associating the concept of a token with a session.

Where is the need for multiple tokens coming from? Can you describe the use case more? There's nothing in the spec forcing the current behaviour; just our experience at scale. For low volume deployments, we could enable a config that returns new tokens for each Auth request.

On Jan 26, 2012, at 2:32 PM, "anotherjesse" <email address hidden> wrote:

> I'm thinking of the security model.
>
> What does a token represent? In some (all?) token systems, a token
> represents an authentication session. So if the same token is returned
> for every auth request (eg, every session) then you don't have the
> potential to revoke for a given context.
>
> --
> You received this bug notification because you are a member of Keystone
> Bugs, which is subscribed to Keystone.
> https://bugs.launchpad.net/bugs/919335
>
> Title:
> New token always returned
>
> Status in OpenStack Identity (Keystone):
> Fix Committed
>
> Bug description:
> Branch: Master
>
> Doing a POST /tokens for joeuser (user
> 061110baf07c4fa6aa3acdfe7ab4e33c (tenant:
> c8c8e3ea89834869b5060bbc6dd02da4)) generates a new token every time
> (even when the old token hasn't expired). It appears we cannot find
> the token from the DB (sqlalchemy)...
>
> 2012-01-20 10:07:49 DEBUG [keystone.frontends.d5_compat] Entering D5AuthProtocol.__call__
> 2012-01-20 10:07:49 DEBUG [routes.middleware] Matched POST /tokens
> 2012-01-20 10:07:49 DEBUG [routes.middleware] Route path: '/tokens', defaults: {'action': u'authenticate', 'controller': <keystone.controllers.token.TokenController object at 0x2bcf7d0>}
> 2012-01-20 10:07:49 DEBUG [routes.middleware] Match dict: {'action': u'authenticate', 'controller': <keystone.controllers.token.TokenController object at 0x2bcf7d0>}
> 2012-01-20 10:07:49 DEBUG [keystone.logic.service] Authenticating with passwordCredentials
> 2012-01-20 10:07:49 DEBUG [keystone.logic.service] Authenticating user 061110baf07c4fa6aa3acdfe7ab4e33c (tenant: c8c8e3ea89834869b5060bbc6dd02da4)
> 2012-01-20 10:07:49 DEBUG [keystone.logic.service] Token was not found or expired. Creating a new token for the user
> 2012-01-20 10:07:49 DEBUG [keystone.logic.service] User 061110baf07c4fa6aa3acdfe7ab4e33c failed check - did not have role 2
> 2012-01-20 10:07:49 DEBUG [keystone.logic.service] User 061110baf07c4fa6aa3acdfe7ab4e33c failed check - did not have role 1
> 2012-01-20 10:07:49 DEBUG [eventlet.wsgi.server] 127.0.0.1 - - [20/Jan/2012 10:07:49] "POST /v2.0/tokens HTTP/1.1" 200 1858 0.146559
> 2012-01-20 10:07:55 WARNING [keystone.frontends.normalizer] Falling back to `webob` v1.1 and older support. Check your version of webob
> 2012-01-20 10:07:55 DEBUG [keystone.frontends.normalizer] */* header could not be matched
> 2012-01-20 10:07:55 DEBUG [keystone.frontends.legacy_tok...

Read more...

Revision history for this message
Ziad Sawalha (ziad-sawalha) wrote :
Download full text (3.9 KiB)

Scale has had us opt for returning the same token. Tokens should not be used as a browser session identifier.

On Jan 26, 2012, at 10:37 AM, "Dolph Mathews" <email address hidden> wrote:

> Jesse, is there a business case to support one behavior over the other?
>
> --
> You received this bug notification because you are a member of Keystone
> Bugs, which is subscribed to Keystone.
> https://bugs.launchpad.net/bugs/919335
>
> Title:
> New token always returned
>
> Status in OpenStack Identity (Keystone):
> Fix Committed
>
> Bug description:
> Branch: Master
>
> Doing a POST /tokens for joeuser (user
> 061110baf07c4fa6aa3acdfe7ab4e33c (tenant:
> c8c8e3ea89834869b5060bbc6dd02da4)) generates a new token every time
> (even when the old token hasn't expired). It appears we cannot find
> the token from the DB (sqlalchemy)...
>
> 2012-01-20 10:07:49 DEBUG [keystone.frontends.d5_compat] Entering D5AuthProtocol.__call__
> 2012-01-20 10:07:49 DEBUG [routes.middleware] Matched POST /tokens
> 2012-01-20 10:07:49 DEBUG [routes.middleware] Route path: '/tokens', defaults: {'action': u'authenticate', 'controller': <keystone.controllers.token.TokenController object at 0x2bcf7d0>}
> 2012-01-20 10:07:49 DEBUG [routes.middleware] Match dict: {'action': u'authenticate', 'controller': <keystone.controllers.token.TokenController object at 0x2bcf7d0>}
> 2012-01-20 10:07:49 DEBUG [keystone.logic.service] Authenticating with passwordCredentials
> 2012-01-20 10:07:49 DEBUG [keystone.logic.service] Authenticating user 061110baf07c4fa6aa3acdfe7ab4e33c (tenant: c8c8e3ea89834869b5060bbc6dd02da4)
> 2012-01-20 10:07:49 DEBUG [keystone.logic.service] Token was not found or expired. Creating a new token for the user
> 2012-01-20 10:07:49 DEBUG [keystone.logic.service] User 061110baf07c4fa6aa3acdfe7ab4e33c failed check - did not have role 2
> 2012-01-20 10:07:49 DEBUG [keystone.logic.service] User 061110baf07c4fa6aa3acdfe7ab4e33c failed check - did not have role 1
> 2012-01-20 10:07:49 DEBUG [eventlet.wsgi.server] 127.0.0.1 - - [20/Jan/2012 10:07:49] "POST /v2.0/tokens HTTP/1.1" 200 1858 0.146559
> 2012-01-20 10:07:55 WARNING [keystone.frontends.normalizer] Falling back to `webob` v1.1 and older support. Check your version of webob
> 2012-01-20 10:07:55 DEBUG [keystone.frontends.normalizer] */* header could not be matched
> 2012-01-20 10:07:55 DEBUG [keystone.frontends.legacy_token_auth] Entering AuthProtocol.__call__
> 2012-01-20 10:07:55 DEBUG [keystone.frontends.legacy_token_auth] Not a v1.0/v1.1 call, so passing downstream
> 2012-01-20 10:07:55 DEBUG [keystone.frontends.d5_compat] Entering D5AuthProtocol.__call__
> 2012-01-20 10:07:55 DEBUG [routes.middleware] Matched POST /tokens
> 2012-01-20 10:07:55 DEBUG [routes.middleware] Route path: '/tokens', defaults: {'action': u'authenticate', 'controller': <keystone.controllers.token.TokenController object at 0x2bcf7d0>}
> 2012-01-20 10:07:55 DEBUG [routes.middleware] Match dict: {'action': u'authenticate', 'controller': <keystone.controllers.token.TokenController object at 0x2bcf7d0>}
> 2012-01-20 10:07:55 DEBUG [keystone.logic.ser...

Read more...

Revision history for this message
Dolph Mathews (dolph) wrote :

Recommend this topic be introduced as a blueprint if there is still interest in changing/discussing this behavior.

Changed in keystone:
assignee: Dolph Mathews (dolph) → nobody
status: Fix Committed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.