I am working in a Spring MVC Thymeleaf project where LDAP security with Database and Role-based granted authorities is a must-have requirement from the end-user.
What I need
- Primary authentication should be performed by LDAP
- User Role and granted authorities must be configured in the database along with LDAP user name
example: LDAP user: nahid@test.com Role: Admin Granted Authorities for "Admin" role: permission_x,permission_y etc
Which will be used in web page as "hasAuthority("permission_x")"
- After LDAP Authentication, System will check if User Exist in the database as a white list user
- After the white list check, roles and privileges will be loaded for the user and authorization will be imposed for loaded permissions(not role)
What I found is here:
Spring Security with LDAP and Database roles, which is a bit outdated
https://spring.io/guides/gs/authenticating-ldap/ where only LDAP authentication is shown.
- https://www.baeldung.com/role-and-privilege-for-spring-security-registration Granted Authority example
Now my questions are:
- Do I need to store LDAP Password with LDAP user Name? If yes, is it safe?
- Is there any example that exists for the above scenario?
- Will fine-grained granted authorities work for LDAP users?
How LDAP authentication and jdbc based authorization will work together? Can anybody help?
Thanks in advance