Fixed up contacts sample: removed casfailed page, corrected debug.jsp errors and fixed incorrect bean reference in context files.

This commit is contained in:
Luke Taylor 2008-11-15 03:38:49 +00:00
parent 5c1f4e60e3
commit 78065ba47c
4 changed files with 33 additions and 38 deletions

View File

@ -47,7 +47,7 @@
<b:property name="targetUrl" value="/secure/index.htm"/>
</b:bean>
<b:bean id="expressionhandler" class="org.springframework.security.expression.support.DefaultSecurityExpressionHandler">
<b:bean id="expressionHandler" class="org.springframework.security.expression.support.DefaultSecurityExpressionHandler">
<b:property name="permissionEvaluator" ref="permissionEvaluator" />
</b:bean>

View File

@ -1,17 +0,0 @@
<%@ page import="org.springframework.security.AuthenticationException" %>
<html>
<head>
<title>Login to CAS failed!</title>
</head>
<body>
<h1>Login to CAS failed!</h1>
<font color="red">
Your CAS credentials were rejected.<BR><BR>
Reason: <%= ((AuthenticationException) session.getAttribute(org.springframework.security.ui.AbstractProcessingFilter.SPRING_SECURITY_LAST_EXCEPTION_KEY)).getMessage() %>
</font>
</body>
</html>

View File

@ -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" %>
<html>
<head>
<title>Security Debug Information</title>
</head>
<body>
<h3>Security Debug Information</h3>
<%
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
if (auth != null) { %>
Authentication object is of type: <%= auth.getClass().getName() %><BR><BR>
Authentication object as a String: <%= auth.toString() %><BR><BR>
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
if (auth != null) { %>
<p>
Authentication object is of type: <em><%= auth.getClass().getName() %></em>
</p>
<p>
Authentication object as a String: <br/><br/><%= auth.toString() %>
</p>
Authentication object holds the following granted authorities:<BR><BR>
<% GrantedAuthority[] granted = auth.getAuthorities();
for (int i = 0; i < granted.length; i++) { %>
<%= granted[i].toString() %> (getAuthority(): <%= granted[i].getAuthority() %>)<BR>
Authentication object holds the following granted authorities:<br /><br />
<%
for (GrantedAuthority authority : auth.getAuthorities()) { %>
<%= authority %> (<em>getAuthority()</em>: <%= authority.getAuthority() %>)<br />
<% }
%>
if (auth instanceof AuthByAdapter) { %>
<BR><B>SUCCESS! Your container adapter appears to be properly configured!</B><BR><BR>
<% } else { %>
<BR><B>SUCCESS! Your web filters appear to be properly configured!</B><BR>
<% }
} else { %>
Authentication object is null.<BR>
This is an error and your Acegi Security application will not operate properly until corrected.<BR><BR>
<p><b>Success! Your web filters appear to be properly configured!</b></p>
<%
} else {
%>
Authentication object is null.<br />
This is an error and your Spring Security application will not operate properly until corrected.<br /><br />
<% }
%>
</body>
</html>

View File

@ -14,7 +14,7 @@
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.5.xsd">
<global-method-security expression-annotations="enabled">
<expression-handler ref="expressionhandler"/>
<expression-handler ref="expressionHandler"/>
</global-method-security>
<!-- ======================== AUTHENTICATION ======================= -->
@ -24,7 +24,7 @@
<jdbc-user-service data-source-ref="dataSource"/>
</authentication-provider>
<b:bean id="expressionhandler" class="org.springframework.security.expression.support.DefaultSecurityExpressionHandler">
<b:bean id="expressionHandler" class="org.springframework.security.expression.support.DefaultSecurityExpressionHandler">
<b:property name="permissionEvaluator" ref="permissionEvaluator" />
</b:bean>