You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Yogesh Shankarappa <yo...@gmail.com> on 2011/09/19 03:23:13 UTC

get UserPrincipal() is null on Tomcat v6.0.33

Hello All,


          I am unable to get request.getUserPrincipal() or
request.getRemoteUser() after successful external authentication.
I would greatly appreciate if you could let me know of any configuration on
tomcat server to be looked at to get the user principal.
Below is the implementation details:

I have a sample app deployed on Tomcat v6.0.33. J2EE Policy Agent 3.0.3 is
also installed on the same server. I have configured
to have external authentication using the J2EE agent and accomplished using
OpenAM Enterprise Server. The tomcat container
is protected using this authentication implementation. When I try the sample
app URL, I am redirected to the OpenAM server
where the user is authentication and redirected back to the application.
Using the request object, I am able to get all the user
information like uid, givenname, sn, cn etc. but request.getUserPrincipal()
or request. getRemoteUser() is null.
I tried adding the following code to web.xml either on the application or
tomcat container itself, still I am unable to get the user
principal. I would greatly appreciate if you could let me know of any
configuration I should be looking at on tomcat server.
Thanks in advance.


<filter>
     <filter-name>Agent</filter-name>

<filter-class>com.sun.identity.agents.filter.AmAgentFilter</filter-class>
</filter>
<filter-mapping>
     <filter-name>Agent</filter-name>
     <url-pattern>/*</url-pattern>
     <dispatcher>REQUEST</dispatcher>
     <dispatcher>INCLUDE</dispatcher>
     <dispatcher>FORWARD</dispatcher>
     <dispatcher>ERROR</dispatcher>
</filter-mapping>
<security-constraint>
     <display-name>Example Security Constraint</display-name>
     <web-resource-collection>
          <web-resource-name>Entire Application</web-resource-name>
          <url-pattern>/*</url-pattern>
     </web-resource-collection>
</security-constraint>



Thanks
Yogesh

Re: get UserPrincipal() is null on Tomcat v6.0.33

Posted by Yogesh Shankarappa <yo...@gmail.com>.
Chris, thanks for your response. I realized later and added it. It works now
:-)



On Mon, Sep 19, 2011 at 4:04 PM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Yogesh,
>
> On 9/18/2011 9:23 PM, Yogesh Shankarappa wrote:
> > <security-constraint> <display-name>Example Security
> > Constraint</display-name> <web-resource-collection>
> > <web-resource-name>Entire Application</web-resource-name>
> > <url-pattern>/*</url-pattern> </web-resource-collection>
> > </security-constraint>
>
> What, no <auth-constraint>?
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk53oDEACgkQ9CaO5/Lv0PC8jwCgt9vYHxgUy2ySJnSo3MJCscRs
> 43cAnR5PIg6FmqJHzDQynHHp9gpx3+Lp
> =qcDc
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: get UserPrincipal() is null on Tomcat v6.0.33

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yogesh,

On 9/18/2011 9:23 PM, Yogesh Shankarappa wrote:
> <security-constraint> <display-name>Example Security
> Constraint</display-name> <web-resource-collection> 
> <web-resource-name>Entire Application</web-resource-name> 
> <url-pattern>/*</url-pattern> </web-resource-collection> 
> </security-constraint>

What, no <auth-constraint>?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk53oDEACgkQ9CaO5/Lv0PC8jwCgt9vYHxgUy2ySJnSo3MJCscRs
43cAnR5PIg6FmqJHzDQynHHp9gpx3+Lp
=qcDc
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org