Check if a userName & Password combination is Valid
Import
·
Jul 04, 2020
·
article
Please hit Like or Bookmark this article if it helps.
Use Cases: Where ever there is a need to add extra layer of authentication
Try the below script in your background script.
var userName = gs.getUserName();//Or any username say abel.tuter
var password = "July_4th_2020";
var user = GlideUser;
var authed = user.authenticate(userName, password);
gs.print(authed); //returns true or false (boolean)
Background script Outputs:
If username and password combination fails
Logging event: SNC.Auth.DB.Login.Failed with parm1: user_name=admin and parm2: remoteAddr=45.22.61.251
*** Script: false
If username and password combination is correct.
*** Script: true
Thank you,
Aman Gurram
View original source
https://www.servicenow.com/community/developer-articles/check-if-a-username-password-combination-is-valid/ta-p/2322075