简体   繁体   中英

Glassfish not loading secure page

I've made a basic login on my Glassfish server, when I try it the username and password is recognised and accepted but nothing is loaded, the browser seems to attempt to load something but instead just sits on the initial page.

I have made an account in file realm and the login is successfully recognised.

The link which brings up the login is: <a href="secureUser/secret.xhtml">

In web.xml I have this:

<security-constraint>
        <display-name>UserConstraint</display-name>
        <web-resource-collection>
            <web-resource-name>User</web-resource-name>
            <description/>
            <url-pattern>/secureUser/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <description/>
            <role-name>user</role-name>
        </auth-constraint>
</security-constraint>
<login-config>
        <auth-method>BASIC</auth-method>
        <realm-name>file</realm-name>
</login-config>
<security-role>
        <description/>
        <role-name>user</role-name>
</security-role>

Any ideas as to why it doesn't load secret.xhtml ?

Thanks!

Have you added a security-role-mapping in your sun-web.xml, such like this:

<security-role-mapping>
    <role-name>user</role-name>
    <principal-name>admin</principal-name>
</security-role-mapping>

Replace the content of <principal-name> with the user name of your file realm.

If this doesn't help: You can change the logging of glassfish's security module. Change the log level of the javax.enterprise.system.core.security module to FINEST in the admin console.

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM