We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

ARG645
Tera Guru

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

Comments
Gia
Kilo Contributor

Hi Aman,
How can i use method GlideUser.authenticate in scoped applications ? it keep showing an error

find_real_file.png

ARG645
Tera Guru

Gia,

The method is only available in Global Scope. You can write a function in a script include (in Global Scope) that uses the GlideUser.authenticate and call it from your custom scope. 

Thank you,

Aman Gurram

Version history
Last update:
‎07-04-2020 11:19 AM
Updated by: