gs.getSession().impersonate() in scoped application?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2016 02:55 PM
I have a ServiceNow Application which is programatically called from a Windows Application via Processor. Windows Application sends a username and token to impersonate. In global application I used to do this quite easily by validating the username and token and calling this api:
gs.getSession().impersonate(<user_sys_id>);
Now that Scoped GlideSession doesn't expose impersonate, how could I achieve this?
Thanks,
Vipin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2016 06:06 PM
I tried adding an Authorization header but in vain
C#:
Encoding unicode = Encoding.Unicode;
byte[] unicodeBytes = unicode.GetBytes("user:Passw0rd".ToArray());
string buf = "Basic " + Convert.ToBase64String(unicodeBytes);
request.Headers.Add("Authorization", buf);
Thanks,
Vipin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2016 08:55 AM
Hi Vipin,
We have a similar issue: We use gs.impersonate to enable support for e-mail aliases in inbound actions in the Global scope, but we're unable to do this in scoped applications. I'm interested in any workaround you may have found since posting this.
David
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2016 09:41 AM
Hi David,
In my case I had a client application that called into ServiceNow via Processor and we were doing impersonation in script after some validations. Since this is no more supported, one alternative for us is to create a Scripted REST API; the only thing is that now the client application needs to have user credentials.
Hope that helps.
Thanks,
Vipin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2016 09:47 AM
Thanks for you reply, Vipin. Since our code is working purely inside of SN I don't think this will work for us, but thank you again for sharing your solution.
David