Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last Login Time Stamp returns the Current Login Timestamp #1593

Open
anitasharma2492 opened this issue May 25, 2018 · 1 comment
Open

Last Login Time Stamp returns the Current Login Timestamp #1593

anitasharma2492 opened this issue May 25, 2018 · 1 comment

Comments

@anitasharma2492
Copy link

We are trying to retrieve user last Login timestamp and display in UI. For this, we are getting the last login timestamp from user claims. However, after user logs in to their account the timestamp gets updated and the token generated after login returns the current login time.

We need the last login timestamp and not the current one.
Is this the expected behavior?
If yes, how do we achieve the last one and not the current one (Is there different claim for it?).
If no, what did we miss?

@M0nikaSharma
Copy link
Contributor

Hi,
I am facing the same issue. lastlogin timestamp return the current login timestamp value.And i have observe that last login timestamp value is return when we have added below last login custom component jar file in the dropin folder of wso2 identity server"org.wso2.carbon.custom.user.operation.event.listener-1.0.0.jar" If we remove this file from dropin folder then last login timestamp value is not return.In this jar code I have found that lastlogin timestamp logic is return in the doPostAuthenticate method which is as below:

	long lastLoginTimestamp = System.currentTimeMillis();

            Map<String, String> claimMap = new HashMap<String, String>();

            claimMap.put(LAST_LOGIN_TIMESTAMP_CLAIM, Long.toString(lastLoginTimestamp));

In this logic we have saved the current system time in the lastLoginTimestamp variable. so it is return the current login timestamp.which should not be the lastLoginTimestamp because lastLoginTimestamp should be displayed as previous login time of user.
So let me know is it required to add org.wso2.carbon.custom.user.operation.event.listener-1.0.0.jar in wso2 dropin folder to retrieve the Lastlogin timestamp.This jar code is written in 2015 can you provide me the latest code for this jar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants