0

I have configured an Application User named "sven" on my WildFly 8.2 Application Server. I am trying to implement basic security using the BASIC method. After attempting to access the protected resource (secret/infidels.xhtml), I am prompted with a login-dialog. After filling in the user-details for "sven", I receive a Forbidden-page.

enter image description here

After changing the server-log level to TRACE, the log confirms that "sven" was authenticated correctly:
13:45:09,481 TRACE [org.wildfly.extension.undertow] (default task-3) User: org.wildfly.extension.undertow.security.AccountImpl$AccountPrincipal@360e4c is authenticated


Project Structure:

src
└── main
    ├── resources
    └── webapp
        ├── WEB-INF
        │   ├── faces-config.xml
        │   ├── jboss-web.xml
        │   └── web.xml
        ├── index.xhtml
        └── secret
            └── infidels.xhtml


web.xml

<web-app>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <welcome-file>index.xhtml</welcome-file>
    </welcome-file-list>

    <security-constraint>
        <web-resource-collection>
            <web-resource-name>MySecret</web-resource-name>
            <url-pattern>/secret/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <role-name>sven</role-name>
        </auth-constraint>
    </security-constraint>
    <login-config>
        <auth-method>BASIC</auth-method>
        <realm-name>PG6100</realm-name>
    </login-config>
    <security-role>
        <role-name>sven</role-name>
    </security-role>
</web-app>


jboss-web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 5.0//EN"
    "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
<jboss-web>
    <security-domain>other</security-domain>
</jboss-web>

In short, even after authentication, user "sven" is unable to access the protected resource. Am I missing some configuration somewhere?

krystah
  • 3,587
  • 2
  • 25
  • 43

1 Answers1

3

Solved it. I mistakenly thought the name specified in

<role-name>sven</role-name>

was the name of a registered application user itself. It turns out it's supposed to be the name of a group, which in hindsight makes the initial idea of registering each single user seem like a mad man's game.

krystah
  • 3,587
  • 2
  • 25
  • 43