Replies: 2 comments 11 replies
-
For the sessions issue, try My advice would be to check the database before LDAP authentication, so that you aren't checking passwords if the user isn't valid for the realm anyway. You would need to set I recommend reading the documentation (https://rodauth.jeremyevans.net/documentation.html). Start developing a Roda app just for the authentication, and after that is working, then use the middleware plugin and integrate it into your Hanami app. |
Beta Was this translation helpful? Give feedback.
-
Thanks @jeremyevans. Now I'm a step further. Now I get Loaded :postgres in 0ms SELECT * FROM "users" WHERE ("user_name" = 'testuser') LIMIT 1
PG::UndefinedFunction: ERROR: function rodauth_get_salt(integer) does not exist
LINE 1: SELECT rodauth_get_salt(1) AS "v" LIMIT 1 module Auth
class RodauthApp < Roda
plugin :middleware
plugin :rodauth, json: :only do
enable :login, :logout, :jwt
accounts_table :users
login_route "auth/login"
login_param "username"
login_column :user_name
jwt_secret "your_jwt_secret" # Replace with your secret
# jwt_token_identifier "your_jwt_token_identifier"
end
route do |r|
r.rodauth
rodauth.require_authentication
end
end
end How would you add the check if the user is allowed to login into the realm? Thanks |
Beta Was this translation helpful? Give feedback.
-
Hey 👋 ,
I implement a small auth-server. This should receive login-requests (username, password, realm) and respond with a JWT-token if successful (no refresh-token in the 1st step). The password check should be done via LDAP, so the server does not need to store passwords.
If the LDAP check is successful, only a db query is necessary to check whether the user is authorized for the realm, if so, a successful response with a JWT (I need to set the payload/claims of the token) token should be generated.
There should be 3 endpoints
auth/login
= to login a userauth/userinfo
= userinfo endpoint to get infos about a user (here the JWT token is provided via AUTHORIZATION-headerauth/logout
= for logout I would need to store the jwt-tokens, otherwise no logout is possible. I used redis in the past for this.The AuthServer is only requested from other ruby servers. So I just need a very small set of features.
I think rodauth is the right one here or? I have a user table, do I have to rename it to accounts? Which tables do I need for my use-case?
I started with the following code
At the moment I can't get any further. Can someone please give me a tip/advice? At the moment I get
Why do I need a session handler for my use-case?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions