Browse Source

SEC-256: Contacts sample not displaying localized exceptions correctly.

Ben Alex 19 years ago
parent
commit
21aaf2b9db

+ 9 - 4
core/src/main/java/org/acegisecurity/AcegiMessageSource.java

@@ -1,4 +1,4 @@
-/* Copyright 2004, 2005 Acegi Technology Pty Limited
+/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -23,12 +23,15 @@ import org.springframework.context.support.ResourceBundleMessageSource;
  * The default <code>MessageSource</code> used by Acegi Security.
  * 
  * <p>
- * All Acegi Security classes requiring messge localization will be default use
+ * All Acegi Security classes requiring messge localization will by default use
  * this class. However, all such classes will also implement
  * <code>MessageSourceAware</code> so that the application context can inject
  * an alternative message source. Therefore this class is only used when the
  * deployment environment has not specified an alternative message source.
  * </p>
+ *
+ * @author Ben Alex
+ * @version $Id$
  */
 public class AcegiMessageSource extends ResourceBundleMessageSource {
     //~ Constructors ===========================================================
@@ -36,8 +39,10 @@ public class AcegiMessageSource extends ResourceBundleMessageSource {
     public AcegiMessageSource() {
         setBasename("org.acegisecurity.messages");
     }
-    
+
+    //~ Methods ================================================================
+
     public static MessageSourceAccessor getAccessor() {
-    	return new MessageSourceAccessor(new AcegiMessageSource());
+        return new MessageSourceAccessor(new AcegiMessageSource());
     }
 }

+ 5 - 0
samples/contacts/src/main/webapp/filter/WEB-INF/applicationContext-acegi-security.xml

@@ -149,6 +149,11 @@
 
    <bean id="exceptionTranslationFilter" class="org.acegisecurity.ui.ExceptionTranslationFilter">
       <property name="authenticationEntryPoint"><ref local="authenticationProcessingFilterEntryPoint"/></property>
+      <property name="accessDeniedHandler">
+      	<bean class="org.acegisecurity.ui.AccessDeniedHandlerImpl">
+      		<property name="errorPage" value="/accessDenied.jsp"/>
+      	</bean>
+      </property>
    </bean>
 
    <bean id="authenticationProcessingFilter" class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilter">