WebLogic 简单领域(如 tomcat-users.xml) [英] WebLogic simple realm (like tomcat-users.xml)

查看:51
本文介绍了WebLogic 简单领域(如 tomcat-users.xml)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个家伙,我正在尝试将 Tomcat 应用程序移植到 WebLogic.

Like this fellow here, I'm trying to port a Tomcat application to WebLogic.

我在 web.xml 中有一些受安全规则保护的资源.我使用的是 FORM 身份验证而不是 BASIC,但这应该无关紧要.

I have a few resources protected by security rules in web.xml. Instead of BASIC, I'm using FORM authentication, but that should be irrelevant.

在Tomcat中,通过编辑conf/tomcat-users.xml,很容易建立一个简单的安全领域.

In Tomcat, it's very easy to set up a simple security realm, by editing conf/tomcat-users.xml.

如何在 Weblogic 中设置简单的安全领域?我想要的只是让用户输入他的用户名和密码并让容器对其进行身份验证.

How do I set up a simple security realm in Weblogic ? All I want is to have the user to input his username and password and have it authenticated by the container.

<security-constraint>
    <web-resource-collection>
        <web-resource-name>basic-auth security</web-resource-name>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>HELLO_USER</role-name>
    </auth-constraint>
    <user-data-constraint>NONE</user-data-constraint>
</security-constraint>
<login-config>
    <auth-method>FORM</auth-method>
    <realm-name>somerealm</realm-name>
    <form-login-config>
        <form-login-page>login.jsp</form-login-page>
        <form-error-page>error.jsp</form-error-page>
    </form-login-config>
</login-config>
<security-role>
    <role-name>HELLO_USER</role-name>
</security-role>

推荐答案

有一个默认的 weblogic 领域叫做myrealm".使用 weblogic Web 控制台在那里创建用户.还要创建一个组(即 HELLO_GROUP)并将您的用户分配到该组.

there is a default weblogic realm called "myrealm". Create the user(s) there using the weblogic web console. Also create a group (i.e. HELLO_GROUP) and assign your user(s) to that group.

创建一个 weblogic.xml 文件并将 HELLO_USER 角色映射到 HELLO_GROUP,结构如下:

Create a weblogic.xml file and map the HELLO_USER role onto the HELLO_GROUP with a structure like:

<weblogic-web-app>
...
<security-role-assignment>
<role-name>HELLO_USER</role-name>
<principal-name>HELLO_GROUP</principal-name>
</security-role-assignment>
...
</weblogic-web-app>

这篇关于WebLogic 简单领域(如 tomcat-users.xml)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆