Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

No password expiration date

Hi all,

I am working on a web service in order to modify the password expiration date.

In particular, they requested me to set password never expires at user's creation moment.

I wrote something like this:

uacc = UMFactory.getUserAccountFactory().newUserAccount(susUserName, newUser.getUniqueID());

uacc.setPassword(susUserPassword);

uacc.setPasswordChangeRequired(false);

but users continue to be created with the usual password expiration date.

I tried to search something in my library that could help me, but with no luck. In particular, I tried using the method setPasswodExpirationDate of ISecurityPolicy and of class SecurityPolicy, but I cannot find a method to link this methods to user account. I have also seen that changing the security policy to "Technical User" I may overcome the problem, but the method setSecurityPolicy is not implemented in the libraries on server.

Could you please give me some advices on this topic? I really do not have anymore ideas.

Best Regards,

Francesco Macaluso

Former Member
replied

Use the below code to set your user as technical user.


    		IUserAccountFactory uaFactory= UMFactory.getUserAccountFactory();
    		IUserAccount userAccount=uaFactory.getUserAccountByLogonId("<userID");
    		IUserAccount mutableUserAccount=uaFactory.getMutableUserAccount(userAccount.getUniqueID());
    		mutableUserAccount.setAttribute("com.sap.security.core.usermanagement","SecurityPolicy",new String[]{IUserAccount.SECURITY_POLICY_TYPE_TECHNICAL});    		
    		mutableUserAccount.commit();

Thanks

Prashant

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question