gpt4 book ai didi

java - Waffle JAAS 认证

转载 作者:行者123 更新时间:2023-11-28 22:01:05 25 4
gpt4 key购买 nike

我正在尝试整合 waffle在我的网络应用程序项目 (jsp) 中。我想从 Active 目录(遵循 Kerberos 协议(protocol))为我的 webapp 验证用户。

每当用户提示 url 时,tomcat 服务器首先从 Active Directory 服务器对用户进行身份验证,身份验证后用户可以使用我的 Web 应用程序(jsp)。

这是我为实现 waffle 而遵循的设置。当我在成功登录后点击 url 弹出窗口进行验证时,它显示

HTTP 状态 403 - 拒绝访问请求的资源

上下文.xml

    <Context>
<Realm className="org.apache.catalina.realm.JAASRealm"
appName="Jaas"
userClassNames="waffle.jaas.UserPrincipal"
roleClassNames="waffle.jaas.RolePrincipal"
useContextClassLoader="false"
debug="true" />
</Context>

网络.xml

      <login-config>
<auth-method>BASIC</auth-method>
<realm-name>Jaas</realm-name>
</login-config>

<security-role>
<role-name>Everyone</role-name>
</security-role>


<security-constraint>
<display-name>Waffle Security Constraint</display-name>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>Everyone</role-name>
</auth-constraint>
</security-constraint>

登录配置文件

    Jaas {
waffle.jaas.WindowsLoginModule sufficient;
};

jaas.policy

    grant Principal * * {
permission java.security.AllPermission "/*";
};

最佳答案

我尝试了以下配置,它对我有用。

<security-role>
<role-name>*</role-name>
</security-role>

<security-constraint>
<display-name>Waffle Security Constraint</display-name>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>*</role-name>
</auth-constraint>
</security-constraint>

关于java - Waffle JAAS 认证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48168218/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com