Adonis JS 5 - Active Directory Login - Manually set auth data #1564
Unanswered
iqlasuddin
asked this question in
Help
Replies: 1 comment
-
You can login the user by calling await auth.login(user) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to integrate Active Directory/LDAP authentication in Adonis JS (Version 5, preview). I'm using npm package
activedirectory
.If the domain controller approves of username and password, the session has to be authenticated.
Below is my code in
AuthController.ts
store()
method is routed through post on/login
and other two methodsattemptLdapLogin()
which verifies the credentials and then,fetchLdapUser()
fetches user details from Active Directory. I am aware theauth.login()
expects parameter of typeApp\Models\User
.So can anyone hint me at how I shall manually authenticate session and have the
auth
helper available all over the app.When username and password fails, i.e., when
attemptLdapLogin()
fails, I expect it to returnresponse.redirect('back')
to/login
but even when wrong username and password is entered, it still processes the next part i.e.,fetchLdapUser()
. Can someone point out what is wrong here.Beta Was this translation helpful? Give feedback.
All reactions