【问题标题】:Tomcat AD Authentication - Allow all AD usersTomcat AD 身份验证 - 允许所有 AD 用户
【发布时间】:2012-12-05 17:39:40
【问题描述】:

如何允许 AD 中的所有用户登录我的应用程序(强制他们登录)?不只是按组定义。

这是我的 web.xml。

<security-constraint>
    <web-resource-collection>
        <web-resource-name>MyApplication</web-resource-name>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>

</security-constraint>

<security-role>
  <role-name>some-ad-role</role-name>
</security-role>
<security-role>
  <role-name>another-ad-role</role-name>
</security-role>

<!-- Basic Authentication using a JNDIRealm -->
<login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>Login</realm-name>
</login-config>

我仍然想使用 AD 组在我的应用程序中使用 request.isUserInRole() 进行授权,但最初每个人都可以登录应用程序,以便我拥有他们的用户名以进行检查。

【问题讨论】:

  • @Cratylus 这些示例讨论包括在安全约束中使用 将登录限制为仅定义的角色......我的问题略有不同 - 我需要允许所有用户,无论他们是哪个组只要他们在 AD 中,就在其中。
  • 我们在 wiki 上发布了Tomcat And LDAP 应该会有所帮助。

标签: java tomcat active-directory ldap


【解决方案1】:

所以我找不到任何文档,但我似乎通过使用通配符作为角色名称解决了这个问题。

<security-constraint>
    <web-resource-collection>
        <web-resource-name>MyApplication</web-resource-name>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>

    <auth-constraint> 
        <role-name>*</role-name>
    </auth-constraint>

</security-constraint>

<security-role>
  <role-name>some-ad-role</role-name>
</security-role>
<security-role>
  <role-name>another-ad-role</role-name>
</security-role>
<security-role> 
    <role-name>*</role-name>
</security-role>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-07-01
    • 2020-08-26
    • 2017-08-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多