hi,

I've implemented spring security (2.0.3) using BasicAuthentication. This
seems to work fine. I'm however facing a strange problem when trying to use
the authentication tag to display the name of the user that logged in:
nothing is displayed. 
When debugging this tag I see that
SecurityContextHolder.getContext().getAuthentication() is null.

Also, following simply outputs null in the browser:
<%= SecurityContextHolder.getContext().getAuthentication() %>

So, it looked like maybe the authentication wasn't working as well as I
thought but if I debug a random controller and check the value of
SecurityContextHolder.getContext().getAuthentication() there, then it does
contain the expected principal.

Some of the possibly related information:

JSP

<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags";
%>
...
<sec:authentication property="principal.username"/>


Pom.xml
<dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-taglibs</artifactId>
        <version>2.0.3</version>
        <exclusions>
                <exclusion>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-context</artifactId>
                </exclusion>
                <exclusion>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-core</artifactId>
                </exclusion>
                <exclusion>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-aop</artifactId>
                </exclusion>
                <exclusion>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-support</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework.security</groupId>
                    <artifactId>spring-security-acl</artifactId>
                </exclusion>
        </exclusions>
</dependency>


I've attached the spring-security config: 
http://www.nabble.com/file/p25341903/talking-ccare-security.xml
talking-ccare-security.xml 

thanks for any help!

Stijn
-- 
View this message in context: 
http://www.nabble.com/SecurityContext-authentication-null-in-jsp---not-null-in-controller-tp25341903p25341903.html
Sent from the acegisecurity-developer mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Home: http://acegisecurity.org
Acegisecurity-developer mailing list
Acegisecurity-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer

Reply via email to