SecMan的Shiro领域使用shiro.ini公司
文件。以下设置Shiro没有委托:
shiro.ini公司
[主要]authenticationStrategy=org.apache.cocauseway.extensions.secman.delegated.shiro.realm。SecMan认证策略casewayModuleSecurityRealm=org.apache.causeway.extensions.secman.delegated.shiro.realm。堤道模块ExtSecmanShiroRealmsecurityManager.authenticator.authenticationStrategy=$authenticationStrategsecurityManager.realms=$casewayModuleSecurityRealm[用户][角色]
不过,引入Shiro的主要目的是通过外部机制(如LDAP)引入对身份验证的支持。在本例中,我们将Shiro配置为使用外部领域作为主要领域,而Secman的Shiro领域设置为“委托”领域。我们在shiro.ini公司
文件,并将其“注入”到Secman领域。
shiro.ini公司
[主要]...contextFactory=org.apache.shiro.realm.ldap。JndiLdap上下文工厂(1)contextFactory.url=ldap://localhost:10389(2)contextFactory。systemUsername=uid=admin,ou=系统contextFactory.systemPassword=机密contextFactory.authenticationMechanism=CRAM-MD5ldapRealm=org.apache.shiro.realm.ldap。默认LdapRealm(3)ldapRealm.contextFactory=$contextFactorcasewayModuleSecurityRealm.delegateAuthenticationRealm=$ldapRealm(4)...
1 |
实例化JNDI LDAP上下文 |
2 |
…已配置凭据以查询用户 |
三 |
实例化LDAP领域 |
4 |
指定LDAP领域作为SecMan自己领域的委托领域。 |
然后应该在LDAP服务器中适当地定义用户。例如,如果使用阿帕奇DS服务器:
通过此配置,用户/密码在LDAP中定义,而其用户权限则从SecMan中定义的用户/组/权限中获取。
更简单的LDAP配置
事实上,只需将Shiro配置为使用LDAP领域,而根本不定义secman领域,也可以简化问题。
shiro.ini公司
[主要]contextFactory=org.apache.shiro.realm.ldap。JndiLdap上下文工厂contextFactory.url=ldap://localhost:10389contextFactory.systemUsername=uid=admin,ou=systemcontextFactory.systemPassword=机密contextFactory.authenticationMechanism=CRAM-MD5ldapRealm=org.apache.shiro.realm.ldap。默认LdapRealmldapRealm.contextFactory=$contextFactorsecurityManager.relegis=$ldapRealm
虽然更简单,但这种方法的关键区别在于它不会自动创建应用程序用户
在塞克曼内部;它们必须通过某种单独的方式创建。如果LDAP中有条目,但secman中没有条目,则最终用户可以“登录”,但不能访问任何功能。