From 78065ba47c78b2ba3422604524398d57731e2129 Mon Sep 17 00:00:00 2001 From: Luke Taylor Date: Sat, 15 Nov 2008 03:38:49 +0000 Subject: [PATCH] Fixed up contacts sample: removed casfailed page, corrected debug.jsp errors and fixed incorrect bean reference in context files. --- .../WEB-INF/applicationContext-security.xml | 2 +- .../contacts/src/main/webapp/casfailed.jsp | 17 ------- .../contacts/src/main/webapp/secure/debug.jsp | 48 ++++++++++++------- .../applicationContext-contacts-test.xml | 4 +- 4 files changed, 33 insertions(+), 38 deletions(-) delete mode 100644 samples/contacts/src/main/webapp/casfailed.jsp diff --git a/samples/contacts/src/main/webapp/WEB-INF/applicationContext-security.xml b/samples/contacts/src/main/webapp/WEB-INF/applicationContext-security.xml index f84d64e30c..20866363d8 100644 --- a/samples/contacts/src/main/webapp/WEB-INF/applicationContext-security.xml +++ b/samples/contacts/src/main/webapp/WEB-INF/applicationContext-security.xml @@ -47,7 +47,7 @@ - + diff --git a/samples/contacts/src/main/webapp/casfailed.jsp b/samples/contacts/src/main/webapp/casfailed.jsp deleted file mode 100644 index 787045c376..0000000000 --- a/samples/contacts/src/main/webapp/casfailed.jsp +++ /dev/null @@ -1,17 +0,0 @@ -<%@ page import="org.springframework.security.AuthenticationException" %> - - - - Login to CAS failed! - - - -

Login to CAS failed!

- - - Your CAS credentials were rejected.

- Reason: <%= ((AuthenticationException) session.getAttribute(org.springframework.security.ui.AbstractProcessingFilter.SPRING_SECURITY_LAST_EXCEPTION_KEY)).getMessage() %> -
- - - diff --git a/samples/contacts/src/main/webapp/secure/debug.jsp b/samples/contacts/src/main/webapp/secure/debug.jsp index e154ee0e6b..9ed2819af3 100644 --- a/samples/contacts/src/main/webapp/secure/debug.jsp +++ b/samples/contacts/src/main/webapp/secure/debug.jsp @@ -1,28 +1,40 @@ <%@ page import="org.springframework.security.context.SecurityContextHolder" %> <%@ page import="org.springframework.security.Authentication" %> <%@ page import="org.springframework.security.GrantedAuthority" %> -<%@ page import="org.springframework.security.adapters.AuthByAdapter" %> + + + +Security Debug Information + + + +

Security Debug Information

<% - Authentication auth = SecurityContextHolder.getContext().getAuthentication(); - if (auth != null) { %> - Authentication object is of type: <%= auth.getClass().getName() %>

- Authentication object as a String: <%= auth.toString() %>

+ Authentication auth = SecurityContextHolder.getContext().getAuthentication(); + if (auth != null) { %> +

+ Authentication object is of type: <%= auth.getClass().getName() %> +

+

+ Authentication object as a String:

<%= auth.toString() %> +

- Authentication object holds the following granted authorities:

-<% GrantedAuthority[] granted = auth.getAuthorities(); - for (int i = 0; i < granted.length; i++) { %> - <%= granted[i].toString() %> (getAuthority(): <%= granted[i].getAuthority() %>)
+ Authentication object holds the following granted authorities:

+<% + for (GrantedAuthority authority : auth.getAuthorities()) { %> + <%= authority %> (getAuthority(): <%= authority.getAuthority() %>)
<% } +%> - if (auth instanceof AuthByAdapter) { %> -
SUCCESS! Your container adapter appears to be properly configured!

-<% } else { %> -
SUCCESS! Your web filters appear to be properly configured!
-<% } - - } else { %> - Authentication object is null.
- This is an error and your Acegi Security application will not operate properly until corrected.

+

Success! Your web filters appear to be properly configured!

+<% + } else { +%> + Authentication object is null.
+ This is an error and your Spring Security application will not operate properly until corrected.

<% } %> + + + diff --git a/samples/contacts/src/test/resources/applicationContext-contacts-test.xml b/samples/contacts/src/test/resources/applicationContext-contacts-test.xml index cf9cce13fe..79936fcc35 100644 --- a/samples/contacts/src/test/resources/applicationContext-contacts-test.xml +++ b/samples/contacts/src/test/resources/applicationContext-contacts-test.xml @@ -14,7 +14,7 @@ http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.5.xsd"> - + @@ -24,7 +24,7 @@ - +