I'm pretty new to node.js and have been asked to create an application (website) where users can login with their AD account that has elevated privileges. The goal of the application would then be to launch different PowerShell scripts and other tools with these elevated credentials.
After searching the web it seems we need the following packages:
- jwt and/or jsonwebtoken: allows us to see if a users is who he says he is
- activedirectory: to be able to communicate with AD
- passport or passport-jwt
It seems that it's not a good idea to store the username
and password
in the payload of the jsonwebtoken
. The token is supposed to stay lightweight and only hold a unique identifier for the AD user (this could be his DistinguishedName
I guess).
My questions: Where is the AD password stored for the user? If it can't be in the jsonwebtoken
, the only place left is probably a database? Is this the secure way of doing it? If the database is compromised it seems unsafe too.
And if the database stores the AD password, we will need to request an AD credential object each time the user fires a PowerShell script. Would it be better to store the complete AD credential object in the database and not only the AD password?
I might be over-complicating things, but thank you for clarifying this for me.