# AD Authentication Return in Client

**URL:** <https://forum.inductiveautomation.com/t/ad-authentication-return-in-client/3873>\
**Category:** Ignition\
**Created:** [January 17, 2012, 3:55pm UTC](https://forum.inductiveautomation.com/t/ad-authentication-return-in-client/3873 "2012-01-17T15:55:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [January 17, 2012, 3:55pm UTC](https://forum.inductiveautomation.com/t/ad-authentication-return-in-client/3873/1 "2012-01-17T15:55:59Z")

</div>

Hey guys,

Is there a way to check Active Directory Authentication when a client is already launched, running and logged in an someone?

I have an application where one general user will be logged into the system but when one of the operators (of which there will be many) wants to do something like move a line I would like to check their username and password against Active Directory to make sure they are an actual user. If so then I would like to allow them to do whatever they wanted to do with the button they pressed and log that action with their username in a database.

The only thing I found that is close is the system.security.switchUser function, but since there will be many operators filtering in and out I don’t want to actually switch the user of the entire client multiple times in a session.

Does this make sense?

---

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [January 17, 2012, 5:19pm UTC](https://forum.inductiveautomation.com/t/ad-authentication-return-in-client/3873/2 "2012-01-17T17:19:31Z")

</div>

Try system.security.login(user name,password). it returns a list of roles. If the list is not null or the length of the list is \> 0, then it authenticated fine.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [January 17, 2012, 5:48pm UTC](https://forum.inductiveautomation.com/t/ad-authentication-return-in-client/3873/3 "2012-01-17T17:48:01Z")

</div>

If you wrap it in a try/except test, you can then easily decide what you want to do:

`try:
	x = system.security.login(user,password)
except:
	print "fail"
else:
	print "success"`

---

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [January 17, 2012, 5:59pm UTC](https://forum.inductiveautomation.com/t/ad-authentication-return-in-client/3873/4 "2012-01-17T17:59:58Z")

</div>

Ahhh, yes. That works, thanks guys!

I didn’t see system.security.login in the manual anywhere, is that something new?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [January 17, 2012, 6:08pm UTC](https://forum.inductiveautomation.com/t/ad-authentication-return-in-client/3873/5 "2012-01-17T18:08:27Z")

</div>

I’ll admit it-- I didn’t know about that one. I didn’t find anything in a forum search, either. In fact, I went back to the FPMI docs, just in case. Kyle’s just a genius! 😃

---

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [January 17, 2012, 9:09pm UTC](https://forum.inductiveautomation.com/t/ad-authentication-return-in-client/3873/6 "2012-01-17T21:09:37Z")

</div>

I was playing around in the script playground a while back. I did a print dir(system.security) and found it.

---

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [January 17, 2012, 11:37pm UTC](https://forum.inductiveautomation.com/t/ad-authentication-return-in-client/3873/7 "2012-01-17T23:37:23Z")

</div>

Sweet, thanks for the tip! You learn something new every day… ![:thumb_right:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/2026e28c0c425034352c1b75807edf956adc75f4.gif ":thumb\_right:")
