How to get the last token of an user

asked 2014-06-25 09:33:34 -0600

guilhermepimentel gravatar image

Hello! Well, I'd like to know how to get the last token for an user to do a script that controlls the last access of an user to any service on openstack.

is it possible to get such "list" ou individual token without create a new token?


edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2014-06-25 16:01:14 -0600

updated 2014-06-25 22:39:00 -0600

You can't get last issued token for an user via API. You can get that from DB by doing an sql query. Also it is not necessary that the user is going to access the service using the last issued token

You can't list out indvidual tokens for a user.

Update 1

You can do it with custom code. Add a colum last_logiin in user table and update the column in issue_token call. This is updated on successful login. If the token is valid for X hours, then you need to disable all the users whose last_login + X + 72 hours is less than current time.. You can even add/edit the rest api to return those users that match this criteria

edit flag offensive delete link more


Thanks! I'll try to do this. As soon as I have news, I'll post here my solution.

guilhermepimentel gravatar imageguilhermepimentel ( 2014-06-27 08:42:11 -0600 )edit

answered 2014-06-25 17:06:28 -0600

guilhermepimentel gravatar image

Thanks for your answer, Haneef.

Basically the main ideia behind my question was that I'd like to have guests in my openstack enviorement and if these guests are inactive more than 72 hours, the account must be deleted. I've been thinking a way to identify the last activity of this guest user through the token, that have an expiration, and with this information I could realize when the guest uses the openstack the lastly.

Any suggestions to solve my problem?

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2014-06-25 09:33:34 -0600

Seen: 135 times

Last updated: Jun 25 '14