# Authenticate user in module

**URL:** <https://forum.inductiveautomation.com/t/authenticate-user-in-module/18791>\
**Category:** Module Development\
**Created:** [July 11, 2018, 1:00pm UTC](https://forum.inductiveautomation.com/t/authenticate-user-in-module/18791 "2018-07-11T13:00:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![stoycho.atanasov.3xs](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@stoycho.atanasov.3xs](https://forum.inductiveautomation.com/u/stoycho.atanasov.3xs)\
**Post date:** [July 11, 2018, 1:00pm UTC](https://forum.inductiveautomation.com/t/authenticate-user-in-module/18791/1 "2018-07-11T13:00:02Z")

</div>

Hello everybody,  
I’m trying to authenticate a user through my module. In Python i use `system.security.validateUser(user,password,userSource)`  
I need to find the same functionality in Java.

Thank you.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [July 11, 2018, 1:22pm UTC](https://forum.inductiveautomation.com/t/authenticate-user-in-module/18791/2 "2018-07-11T13:22:44Z")

</div>

What scope do you need to do this from? (Gateway or Client)

---

<div class="post-metadata">

**Author:** ![stoycho.atanasov.3xs](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@stoycho.atanasov.3xs](https://forum.inductiveautomation.com/u/stoycho.atanasov.3xs)\
**Post date:** [July 11, 2018, 1:31pm UTC](https://forum.inductiveautomation.com/t/authenticate-user-in-module/18791/3 "2018-07-11T13:31:42Z")

</div>

I need Gateway scope

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [July 11, 2018, 3:41pm UTC](https://forum.inductiveautomation.com/t/authenticate-user-in-module/18791/4 "2018-07-11T15:41:15Z")

</div>

From `GatewayContext` you can get the `UserSourceManager`, from which you can get a `UserSourceProfile`, which has an `authenticate(AuthChallenge)` method.

---

<div class="post-metadata">

**Author:** ![stoycho.atanasov.3xs](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@stoycho.atanasov.3xs](https://forum.inductiveautomation.com/u/stoycho.atanasov.3xs)\
**Post date:** [July 16, 2018, 2:27pm UTC](https://forum.inductiveautomation.com/t/authenticate-user-in-module/18791/5 "2018-07-16T14:27:09Z")

</div>

Thank you Kevin, finally I managed to log in and retrieve user’s info.
