2 Replies Latest reply on Dec 21, 2001 4:41 AM by rgsuresh

    Getting the authenticated user name

    rgsuresh

      hi all,
      I am using Form based Authentication with users.properties, roles.properties. It is working fine
      inside the web-app, when i tried to get the username(using getRemoteUser or getCallerPrinciple), i get "null" as the value.
      I want to know how we can get the Username(entered in i_username) from inside the web app.Is there any JBoss specific methods to get the username?

      thanks in advance
      R.G.Suresh

        • 1. Re: Getting the authenticated user name
          swatkat

          Can you be more specific as what your web.xml looks like ? and i think what you are asking for is BASIC kind of authentication.

          • 2. Re: Getting the authenticated user name
            rgsuresh

            <?xml version="1.0" encoding="ISO-8859-1"?>
            <web-app>

            <servlet-name>Servlet1</servlet-name>
            <servlet-class>Servlet</servlet-class>
            <security-role-ref>
            <role-name>authorizedUser</role-name>
            <role-link>authorizedUser</role-link>
            </security-role-ref>

            <servlet-mapping>
            <servlet-name>Servlet1</servlet-name>
            <url-pattern>/Servlet1</url-pattern>
            </servlet-mapping>
            <welcome-file-list>
            <welcome-file>index.html</welcome-file>
            </welcome-file-list>
            <security-constraint>
            <web-resource-collection>
            <web-resource-name>name</web-resource-name>
            <url-pattern>/protectes/*</url-pattern>
            <http-method>GET</http-method>
            <http-method>POST</http-method>
            </web-resource-collection>
            <auth-constraint>
            <role-name>authorizedUser</role-name>
            </auth-constraint>
            <user-data-constraint>
            <transport-guarantee>NONE</transport-guarantee>
            </user-data-constraint>
            </security-constraint>
            <login-config>
            <auth-method>FORM</auth-method>
            <realm-name>other</realm-name>
            - <form-login-config>
            <form-login-page>/login/login.jsp</form-login-page>
            <form-error-page>/login/error.jsp</form-error-page>
            </form-login-config>
            </login-config>
            <security-role>
            <role-name>authorizedUser</role-name>
            </security-role>
            </web-app>