My requirement is to read user and permission information from the database to complete authentication and authorization. Shiro provides JdbcRealm implementation, but there is no MongoDB realm implementation.
Could you please:
Is MongoDB implemented as a Shiro realm?
If possible, how to write the specific configuration? (Google found a specific implementation code, but the relevant configuration files are missing)
Thank you for the invitation, you just need to implement your own Realm, for example:
Then add your own
Realm
设置到RealmSecurityManager
, for example:Then just add this
SecurityManager
设置到ShiroFilter
, for example: