Thursday, January 7, 2016

Validating user domain password in Ax 2012 (AxaptaUserManager)

Hi there!

I think it is time to let you know how you can validate the user domain password in Ax 2012 R3, also it works on Ax 2009.

We need to create an instance of AxaptaUserManager... let's codify

01 static void JC(Args _args)
02 {
03
04      AxaptaUserManager axUserManager;
05      UserInfo userInfo;
06      ;
07
08      userInfo = xUserInfo::find(false, curuserId());
09
10      axUserManager = new AxaptaUserManager();
11
12     if (axUserManager.validatePassword(userInfo.networkAlias , userInfo.NetworkDomain, "4V3rYC0mpl3xPa$$w0rd!!"))
13      {
14        info ("Welcome to the jungle!!!");
15      }
16      else
17      {
18        info ("Intruder");
19      }

20
21}


In the line number 12, the last parameter of the code is a very complex password of the user of the first parameter in the domain specified in the second parameter, return true if the password is correct!


I do not want to insult your intelligence, so I do not profundize on the topic, LOL