Skip to content

Instantly share code, notes, and snippets.

Created November 18, 2014 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/bf14bc80e32c6521e905 to your computer and use it in GitHub Desktop.
Save anonymous/bf14bc80e32c6521e905 to your computer and use it in GitHub Desktop.
python keystoneclient problem
def verify_token(user_token, admin_token, admin_endpoint, tenant):
# Verify a user token via private endpoint.
# Requires the user token to be verified, an admin token and the private admin endpoint.
print 'Verifying token: ' + user_token
admin_client = client.Client(token=admin_token, endpoint=admin_endpoint)
try:
result = admin_client.tokens.authenticate(token=admin_token, tenant_name=tenant)
print 'The result is: ' + result if result else 0
except Unauthorized as u:
print 'Unauthorized: ' + u.message
except Exception as e:
print 'Exception: ' + e.message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment