1

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

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.

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

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>
Community
  • 1
  • 1
Leonel
  • 28,541
  • 26
  • 76
  • 103

1 Answers1

1

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.

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>
John
  • 96
  • 4
  • Also, it's not immediately obvious, but WebLogic has a default group named "users" which all users belong to by default. It doesn't appear in the Admin Console and it's tricky to find in the documentation, but it's there. If you wanted to restrict access to any user that authenticates, you can create a security role and map it to the "users" group. This way, you won't have to manually add all of your users to a group you define just for this purpose. – Jay Lamont May 08 '14 at 13:58