Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Issue on OAuth2 tokens validation
  • Loading branch information
federicofdez committed May 9, 2016
1 parent 086105f commit b78fed7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions keystone/contrib/roles/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# under the License.

import itertools
import datetime

from keystone import exception
from keystone.common import controller
Expand Down Expand Up @@ -414,6 +415,9 @@ def validate_oauth2_token(self, context, token_id):
# We validate the token but no user info is provided
return {
}

if not token['valid'] or datetime.datetime.strptime(token['expires_at'], '%Y-%m-%d %H:%M:%S') < datetime.datetime.today():
raise exception.Unauthorized

user = self.identity_api.get_user(token['authorizing_user_id'])

Expand Down

0 comments on commit b78fed7

Please sign in to comment.