cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the Last Password Successful Logn Date using code

susmita_panigrahi
Active Participant
0 Kudos

Hi

In User admin role if we search for the user we can see account information of the user in the Account Information tab.

In this tab one field is there with name Last Password Successful Logon Date. Details from Account information tab is displaying from the WDJ application sap.com~tc~sec~ume~wd~umeadmin .

Can you please provide me the below information?

1. What the portal data base table name and the filed name used for displaying the date in the Last Password Successful Logon Date field of Account Information tab in User Admin role?

So that using SQL query to the table we can extract the date value.

2.Is there any method available in UME API to get the Last Password Successful Logon Date value?

We are using SAP 7.0 portal.

Thanks & Regards,

Susmita

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Susmita,

to your second question: Please see the following thread: It may help you.

Regards,

Artem

susmita_panigrahi
Active Participant
0 Kudos

Hi Artem,

We have the code to fetch the Last logon date.

If a user account is locked. That user is trying to logon to portal, user will get Account Locked message. But in the background that is in User Admin role->Account information tab of user the field Last Password Successful Logon date is showing the latest date the user tried to logon to portal.

If the Logon to portal is successful then only the field Last Logon Date is updating.We are using 7.0 portal.

Can you please provide us the information the field Last Successful Password Logon Date and the field Last Logon date is same?

Thanks & Regards,

Susmita

Former Member
0 Kudos

Hi Susmita,

sorry I misunderstood your question. I'm not sure concerning the WebDynpro UI, but there are two attributes maintained in the 7.0 UME API implementation:

  • "lastsuccessfullogon"
  • "lastsuccessfulpasswordcheck"

You can try to check the values of these attributes with

IPrincipall.getAttribute(IPrincipal.DEFAULT_NAMESPACE, <attribute>)

and compare, whether the values correspond to the values displaying in the UI

Regards,

Artem

susmita_panigrahi
Active Participant
0 Kudos

Hi Artem,

I have checked the below URL for IPrincipal interface.

http://help.sap.com/javadocs/nwce/current/se/com.sap.se/com/sap/security/api/IPrincipal.html

Can you please provide us the information what value I ned to provide for the parameter "attribute" statement you have mentioned:

IPrincipall.getAttribute(IPrincipal.DEFAULT_NAMESPACE, <attribute>)

If I am using like for an example IPrincipal.getAttribute(IPrincipal.DEFAULT_NAMESPACE, mutableUserAccount.getHashedPassword());

Then I am getting error message "The method getAttribute() is not static from the type IPrincipal"

Thanks & Regards,

Susmita

Former Member
0 Kudos

Hi Susmita,

you should obtain the user first, like this:

IUser user = mutableUserAccount.getAssignedUser();

Then (since the IUser object extends IPrincipal object) you can use:

String[] lastSuccessfulLogon = Sucuser.getAttribute(IPrincipal.DEFAULT_NAMESPACE, "lastsuccessfullogon")

or

String[] lastSuccessfulPasswordCheck = Sucuser.getAttribute(IPrincipal.DEFAULT_NAMESPACE, "lastsuccessfulpasswordcheck")

to obtain attribute values

Regards,

Artem



susmita_panigrahi
Active Participant
0 Kudos

Hi Artem,

I am getting error message for the word Sucuser that is "Sucuser  can not be resolved"

Will the code suggested by you will work in 7.0 portal version?

I am using the below code to get the user id from portal.

IUserFactory userFactory = UMFactory.getUserFactory();

IUserSearchFilter userFilter = userFactory.getUserSearchFilter();

ISearchResult result = userFactory.searchUsers(userFilter);

while(result.hasNext())

{

String uniqueid = result.next().toString();

IUser user = userFactory.getUser(uniqueid);

String userid = user.getUniqueName();

}

Thanks & Regards,

Susmita

Former Member
0 Kudos

Hi Susmita,

"Sucuser" was a typing mistake. It should be only "user". Sorry for that.

To retrieve a user you can also use your code. You don't need the user id, but user instance from this line:

IUser user = userFactory.getUser(uniqueid);

Then use the getAttribute method to retrieve the values

Regards,

Artem