Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8913973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:36:05+00:00 2026-06-15T04:36:05+00:00

I have a small web application that use jdbcRealm for authentification/authorisation. The authorisation works

  • 0

I have a small web application that use jdbcRealm for authentification/authorisation.
The authorisation works only if I put the user name in the glassfish-web.xml

<glassfish-web-app error-url="">
    <class-loader delegate="true"/>
    <jsp-config>
        <property name="keepgenerated" value="true">
            <description>Keep a copy of the generated servlet class' java code.</description>
        </property>
    </jsp-config>
    <security-role-mapping>
        <role-name>connexion</role-name>
        <principal-name>test</principal-name>
        <group-name>connexion</group-name>
    </security-role-mapping>
</glassfish-web-app>

web.xml

<!--other stuff-->
     <security-constraint>
            <web-resource-collection>
                <web-resource-name>secure</web-resource-name>
                <url-pattern>/Downloader</url-pattern>
                <url-pattern>/start.html</url-pattern>  
            </web-resource-collection>
            <auth-constraint>
                <role-name>connexion</role-name>
            </auth-constraint>
            <user-data-constraint>
                <transport-guarantee>CONFIDENTIAL</transport-guarantee>
            </user-data-constraint>
        </security-constraint>
        <login-config>
            <auth-method>FORM</auth-method>
            <realm-name>my_realm</realm-name>
            <form-login-config>
                <form-login-page>/login.html</form-login-page>
                <form-error-page>/error.html</form-error-page>
            </form-login-config>
        </login-config>

        <security-role>

            <role-name>connexion</role-name>
        </security-role>
<!--other stuff-->

If I remove the principal from the glassfish-web I get a 403 error acces denied .
Is there any solution to avoid adding principals in xml file ?
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T04:36:07+00:00Added an answer on June 15, 2026 at 4:36 am

    Yes, there is. In your security realm (from the content of web.xml, that is my_realm) associate the username you are logging in with the appropriate group – in your case that is connexion. In other words, every user that belongs to the group connexion will have the access to the protected resource and therefore you don’t have to enumerate the principals – that’s the purpose of groups.

    Reference & further reading: Java EE 6 tutorial

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small web application that is currently running on Sinatra . It
I have created small test web application which makes use of LINQ to SQL.
I have a visualization web application (small project) that creates charts and graphs from
I have a small web application based on asp.net 2010 that manages invoices. After
I have a small WinForms application that sends notification emails. It works fine with
Say I have a page in my web application that lets a user update
I have a small web application that has multi-language support (en, de, it, fr,
I'm trying to optimize a small web application's use of JavaScript variables. I have
We have a small .NET web application (aspx & ascx) that is used inside
I have a small web application with ASP.NET AJAX running well under the Cassini

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.