SEC-56: Further improvements to localization.
This commit is contained in:
parent
d45f9a0560
commit
2c28ff4fd1
|
@ -34,6 +34,7 @@
|
|||
<targetPath>/</targetPath>
|
||||
<includes>
|
||||
<include>*.xsl</include>
|
||||
<include>**/*.properties</include>
|
||||
</includes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
/* Copyright 2004, 2005 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.acegisecurity;
|
||||
|
||||
import org.springframework.context.support.MessageSourceAccessor;
|
||||
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
|
||||
* 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>
|
||||
*/
|
||||
public class AcegiMessageSource extends ResourceBundleMessageSource {
|
||||
//~ Constructors ===========================================================
|
||||
|
||||
public AcegiMessageSource() {
|
||||
setBasename("org.acegisecurity.messages");
|
||||
}
|
||||
|
||||
public static MessageSourceAccessor getAccessor() {
|
||||
return new MessageSourceAccessor(new AcegiMessageSource());
|
||||
}
|
||||
}
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
package org.acegisecurity.adapters;
|
||||
|
||||
import org.acegisecurity.AcegiMessageSource;
|
||||
import org.acegisecurity.Authentication;
|
||||
import org.acegisecurity.AuthenticationException;
|
||||
import org.acegisecurity.BadCredentialsException;
|
||||
|
@ -49,7 +50,7 @@ public class AuthByAdapterProvider implements InitializingBean,
|
|||
AuthenticationProvider, MessageSourceAware {
|
||||
//~ Instance fields ========================================================
|
||||
|
||||
protected MessageSourceAccessor messages;
|
||||
protected MessageSourceAccessor messages = AcegiMessageSource.getAccessor();
|
||||
private String key;
|
||||
|
||||
//~ Methods ================================================================
|
||||
|
|
|
@ -15,29 +15,25 @@
|
|||
|
||||
package org.acegisecurity.afterinvocation;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.acegisecurity.AccessDeniedException;
|
||||
import org.acegisecurity.AcegiMessageSource;
|
||||
import org.acegisecurity.Authentication;
|
||||
import org.acegisecurity.ConfigAttribute;
|
||||
import org.acegisecurity.ConfigAttributeDefinition;
|
||||
|
||||
import org.acegisecurity.acl.AclEntry;
|
||||
import org.acegisecurity.acl.AclManager;
|
||||
import org.acegisecurity.acl.basic.BasicAclEntry;
|
||||
import org.acegisecurity.acl.basic.SimpleAclEntry;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceAware;
|
||||
import org.springframework.context.support.MessageSourceAccessor;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -101,7 +97,7 @@ public class BasicAclEntryAfterInvocationProvider
|
|||
//~ Instance fields ========================================================
|
||||
|
||||
private AclManager aclManager;
|
||||
protected MessageSourceAccessor messages;
|
||||
protected MessageSourceAccessor messages = AcegiMessageSource.getAccessor();
|
||||
private String processConfigAttribute = "AFTER_ACL_READ";
|
||||
private int[] requirePermission = {SimpleAclEntry.READ};
|
||||
|
||||
|
|
|
@ -15,15 +15,13 @@
|
|||
|
||||
package org.acegisecurity.concurrent;
|
||||
|
||||
import org.acegisecurity.AcegiMessageSource;
|
||||
import org.acegisecurity.Authentication;
|
||||
import org.acegisecurity.AuthenticationException;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceAware;
|
||||
import org.springframework.context.support.MessageSourceAccessor;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
|
@ -41,7 +39,7 @@ public class ConcurrentSessionControllerImpl
|
|||
MessageSourceAware {
|
||||
//~ Instance fields ========================================================
|
||||
|
||||
protected MessageSourceAccessor messages;
|
||||
protected MessageSourceAccessor messages = AcegiMessageSource.getAccessor();
|
||||
private SessionRegistry sessionRegistry = new SessionRegistryImpl();
|
||||
private boolean exceptionIfMaximumExceeded = false;
|
||||
private int maximumSessions = 1;
|
||||
|
|
|
@ -15,8 +15,13 @@
|
|||
|
||||
package org.acegisecurity.intercept;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import org.acegisecurity.AccessDecisionManager;
|
||||
import org.acegisecurity.AccessDeniedException;
|
||||
import org.acegisecurity.AcegiMessageSource;
|
||||
import org.acegisecurity.AfterInvocationManager;
|
||||
import org.acegisecurity.Authentication;
|
||||
import org.acegisecurity.AuthenticationCredentialsNotFoundException;
|
||||
|
@ -25,33 +30,22 @@ import org.acegisecurity.AuthenticationManager;
|
|||
import org.acegisecurity.ConfigAttribute;
|
||||
import org.acegisecurity.ConfigAttributeDefinition;
|
||||
import org.acegisecurity.RunAsManager;
|
||||
|
||||
import org.acegisecurity.context.SecurityContextHolder;
|
||||
|
||||
import org.acegisecurity.event.authorization.AuthenticationCredentialsNotFoundEvent;
|
||||
import org.acegisecurity.event.authorization.AuthorizationFailureEvent;
|
||||
import org.acegisecurity.event.authorization.AuthorizedEvent;
|
||||
import org.acegisecurity.event.authorization.PublicInvocationEvent;
|
||||
|
||||
import org.acegisecurity.runas.NullRunAsManager;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.context.ApplicationEventPublisherAware;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceAware;
|
||||
import org.springframework.context.support.MessageSourceAccessor;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
/**
|
||||
* Abstract class that implements security interception for secure objects.
|
||||
|
@ -151,7 +145,7 @@ public abstract class AbstractSecurityInterceptor implements InitializingBean,
|
|||
private AfterInvocationManager afterInvocationManager;
|
||||
private ApplicationEventPublisher eventPublisher;
|
||||
private AuthenticationManager authenticationManager;
|
||||
protected MessageSourceAccessor messages;
|
||||
protected MessageSourceAccessor messages = AcegiMessageSource.getAccessor();
|
||||
private RunAsManager runAsManager = new NullRunAsManager();
|
||||
private boolean alwaysReauthenticate = false;
|
||||
private boolean rejectPublicInvocations = false;
|
||||
|
|
|
@ -15,8 +15,15 @@
|
|||
|
||||
package org.acegisecurity.providers;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.acegisecurity.AbstractAuthenticationManager;
|
||||
import org.acegisecurity.AccountExpiredException;
|
||||
import org.acegisecurity.AcegiMessageSource;
|
||||
import org.acegisecurity.Authentication;
|
||||
import org.acegisecurity.AuthenticationException;
|
||||
import org.acegisecurity.AuthenticationServiceException;
|
||||
|
@ -24,11 +31,9 @@ import org.acegisecurity.BadCredentialsException;
|
|||
import org.acegisecurity.CredentialsExpiredException;
|
||||
import org.acegisecurity.DisabledException;
|
||||
import org.acegisecurity.LockedException;
|
||||
|
||||
import org.acegisecurity.concurrent.ConcurrentLoginException;
|
||||
import org.acegisecurity.concurrent.ConcurrentSessionController;
|
||||
import org.acegisecurity.concurrent.NullConcurrentSessionController;
|
||||
|
||||
import org.acegisecurity.event.authentication.AbstractAuthenticationEvent;
|
||||
import org.acegisecurity.event.authentication.AuthenticationFailureBadCredentialsEvent;
|
||||
import org.acegisecurity.event.authentication.AuthenticationFailureConcurrentLoginEvent;
|
||||
|
@ -40,30 +45,18 @@ import org.acegisecurity.event.authentication.AuthenticationFailureProviderNotFo
|
|||
import org.acegisecurity.event.authentication.AuthenticationFailureProxyUntrustedEvent;
|
||||
import org.acegisecurity.event.authentication.AuthenticationFailureServiceExceptionEvent;
|
||||
import org.acegisecurity.event.authentication.AuthenticationSuccessEvent;
|
||||
|
||||
import org.acegisecurity.providers.cas.ProxyUntrustedException;
|
||||
import org.acegisecurity.userdetails.UsernameNotFoundException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.context.ApplicationEventPublisherAware;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceAware;
|
||||
import org.springframework.context.support.MessageSourceAccessor;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
|
||||
/**
|
||||
* Iterates an {@link Authentication} request through a list of {@link
|
||||
|
@ -118,7 +111,7 @@ public class ProviderManager extends AbstractAuthenticationManager
|
|||
private ApplicationEventPublisher applicationEventPublisher;
|
||||
private ConcurrentSessionController sessionController = new NullConcurrentSessionController();
|
||||
private List providers;
|
||||
protected MessageSourceAccessor messages;
|
||||
protected MessageSourceAccessor messages = AcegiMessageSource.getAccessor();
|
||||
private Properties exceptionMappings;
|
||||
|
||||
//~ Methods ================================================================
|
||||
|
|
|
@ -15,21 +15,17 @@
|
|||
|
||||
package org.acegisecurity.providers.anonymous;
|
||||
|
||||
import org.acegisecurity.AcegiMessageSource;
|
||||
import org.acegisecurity.Authentication;
|
||||
import org.acegisecurity.AuthenticationException;
|
||||
import org.acegisecurity.BadCredentialsException;
|
||||
|
||||
import org.acegisecurity.providers.AuthenticationProvider;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceAware;
|
||||
import org.springframework.context.support.MessageSourceAccessor;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
|
@ -51,7 +47,7 @@ public class AnonymousAuthenticationProvider implements AuthenticationProvider,
|
|||
|
||||
//~ Instance fields ========================================================
|
||||
|
||||
protected MessageSourceAccessor messages;
|
||||
protected MessageSourceAccessor messages = AcegiMessageSource.getAccessor();
|
||||
private String key;
|
||||
|
||||
//~ Methods ================================================================
|
||||
|
|
|
@ -15,25 +15,20 @@
|
|||
|
||||
package org.acegisecurity.providers.cas;
|
||||
|
||||
import org.acegisecurity.AcegiMessageSource;
|
||||
import org.acegisecurity.Authentication;
|
||||
import org.acegisecurity.AuthenticationException;
|
||||
import org.acegisecurity.BadCredentialsException;
|
||||
|
||||
import org.acegisecurity.providers.AuthenticationProvider;
|
||||
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
|
||||
|
||||
import org.acegisecurity.ui.cas.CasProcessingFilter;
|
||||
import org.acegisecurity.userdetails.UserDetails;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceAware;
|
||||
import org.springframework.context.support.MessageSourceAccessor;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
|
@ -60,7 +55,7 @@ public class CasAuthenticationProvider implements AuthenticationProvider,
|
|||
|
||||
private CasAuthoritiesPopulator casAuthoritiesPopulator;
|
||||
private CasProxyDecider casProxyDecider;
|
||||
protected MessageSourceAccessor messages;
|
||||
protected MessageSourceAccessor messages = AcegiMessageSource.getAccessor();
|
||||
private StatelessTicketCache statelessTicketCache;
|
||||
private String key;
|
||||
private TicketValidator ticketValidator;
|
||||
|
|
|
@ -15,22 +15,19 @@
|
|||
|
||||
package org.acegisecurity.providers.cas.proxy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.acegisecurity.AcegiMessageSource;
|
||||
import org.acegisecurity.providers.cas.CasProxyDecider;
|
||||
import org.acegisecurity.providers.cas.ProxyUntrustedException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceAware;
|
||||
import org.springframework.context.support.MessageSourceAccessor;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Accepts proxied requests if the closest proxy is named in the
|
||||
|
@ -50,7 +47,7 @@ public class NamedCasProxyDecider implements CasProxyDecider, InitializingBean,
|
|||
//~ Instance fields ========================================================
|
||||
|
||||
private List validProxies;
|
||||
protected MessageSourceAccessor messages;
|
||||
protected MessageSourceAccessor messages = AcegiMessageSource.getAccessor();
|
||||
|
||||
//~ Methods ================================================================
|
||||
|
||||
|
|
|
@ -15,22 +15,19 @@
|
|||
|
||||
package org.acegisecurity.providers.cas.proxy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.acegisecurity.AcegiMessageSource;
|
||||
import org.acegisecurity.providers.cas.CasProxyDecider;
|
||||
import org.acegisecurity.providers.cas.ProxyUntrustedException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceAware;
|
||||
import org.springframework.context.support.MessageSourceAccessor;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Accepts no proxied requests.
|
||||
|
@ -48,7 +45,7 @@ public class RejectProxyTickets implements CasProxyDecider, MessageSourceAware,
|
|||
|
||||
//~ Instance fields ========================================================
|
||||
|
||||
protected MessageSourceAccessor messages;
|
||||
protected MessageSourceAccessor messages = AcegiMessageSource.getAccessor();
|
||||
|
||||
//~ Methods ================================================================
|
||||
|
||||
|
|
|
@ -16,24 +16,21 @@
|
|||
package org.acegisecurity.providers.dao;
|
||||
|
||||
import org.acegisecurity.AccountExpiredException;
|
||||
import org.acegisecurity.AcegiMessageSource;
|
||||
import org.acegisecurity.Authentication;
|
||||
import org.acegisecurity.AuthenticationException;
|
||||
import org.acegisecurity.CredentialsExpiredException;
|
||||
import org.acegisecurity.DisabledException;
|
||||
import org.acegisecurity.LockedException;
|
||||
|
||||
import org.acegisecurity.providers.AuthenticationProvider;
|
||||
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
|
||||
import org.acegisecurity.providers.dao.cache.NullUserCache;
|
||||
import org.acegisecurity.userdetails.UserDetailsService;
|
||||
import org.acegisecurity.userdetails.UserDetails;
|
||||
|
||||
import org.acegisecurity.userdetails.UserDetailsService;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceAware;
|
||||
import org.springframework.context.support.MessageSourceAccessor;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
|
@ -73,7 +70,7 @@ public abstract class AbstractUserDetailsAuthenticationProvider
|
|||
implements AuthenticationProvider, InitializingBean, MessageSourceAware {
|
||||
//~ Instance fields ========================================================
|
||||
|
||||
protected MessageSourceAccessor messages;
|
||||
protected MessageSourceAccessor messages = AcegiMessageSource.getAccessor();
|
||||
private UserCache userCache = new NullUserCache();
|
||||
private boolean forcePrincipalAsString = false;
|
||||
|
||||
|
|
|
@ -15,21 +15,17 @@
|
|||
|
||||
package org.acegisecurity.providers.rememberme;
|
||||
|
||||
import org.acegisecurity.AcegiMessageSource;
|
||||
import org.acegisecurity.Authentication;
|
||||
import org.acegisecurity.AuthenticationException;
|
||||
import org.acegisecurity.BadCredentialsException;
|
||||
|
||||
import org.acegisecurity.providers.AuthenticationProvider;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceAware;
|
||||
import org.springframework.context.support.MessageSourceAccessor;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
|
@ -51,7 +47,7 @@ public class RememberMeAuthenticationProvider implements AuthenticationProvider,
|
|||
|
||||
//~ Instance fields ========================================================
|
||||
|
||||
protected MessageSourceAccessor messages;
|
||||
protected MessageSourceAccessor messages = AcegiMessageSource.getAccessor();
|
||||
private String key;
|
||||
|
||||
//~ Methods ================================================================
|
||||
|
|
|
@ -15,27 +15,23 @@
|
|||
|
||||
package org.acegisecurity.providers.x509;
|
||||
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
import org.acegisecurity.AcegiMessageSource;
|
||||
import org.acegisecurity.Authentication;
|
||||
import org.acegisecurity.AuthenticationException;
|
||||
import org.acegisecurity.BadCredentialsException;
|
||||
|
||||
import org.acegisecurity.providers.AuthenticationProvider;
|
||||
import org.acegisecurity.providers.x509.cache.NullX509UserCache;
|
||||
import org.acegisecurity.userdetails.UserDetails;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceAware;
|
||||
import org.springframework.context.support.MessageSourceAccessor;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
|
||||
/**
|
||||
* Processes an X.509 authentication request.
|
||||
|
@ -53,7 +49,7 @@ public class X509AuthenticationProvider implements AuthenticationProvider,
|
|||
|
||||
//~ Instance fields ========================================================
|
||||
|
||||
protected MessageSourceAccessor messages;
|
||||
protected MessageSourceAccessor messages = AcegiMessageSource.getAccessor();
|
||||
private X509AuthoritiesPopulator x509AuthoritiesPopulator;
|
||||
private X509UserCache userCache = new NullX509UserCache();
|
||||
|
||||
|
|
|
@ -15,28 +15,28 @@
|
|||
|
||||
package org.acegisecurity.providers.x509.populator;
|
||||
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
import org.acegisecurity.AcegiMessageSource;
|
||||
import org.acegisecurity.AuthenticationException;
|
||||
import org.acegisecurity.BadCredentialsException;
|
||||
|
||||
import org.acegisecurity.providers.x509.X509AuthoritiesPopulator;
|
||||
import org.acegisecurity.userdetails.UserDetailsService;
|
||||
import org.acegisecurity.userdetails.UserDetails;
|
||||
|
||||
import org.acegisecurity.userdetails.UserDetailsService;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.apache.oro.text.regex.*;
|
||||
|
||||
import org.apache.oro.text.regex.MalformedPatternException;
|
||||
import org.apache.oro.text.regex.MatchResult;
|
||||
import org.apache.oro.text.regex.Pattern;
|
||||
import org.apache.oro.text.regex.PatternMatcher;
|
||||
import org.apache.oro.text.regex.Perl5Compiler;
|
||||
import org.apache.oro.text.regex.Perl5Matcher;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceAware;
|
||||
import org.springframework.context.support.MessageSourceAccessor;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
|
||||
/**
|
||||
* Populates the X509 authorities via an {@link
|
||||
|
@ -51,7 +51,7 @@ public class DaoX509AuthoritiesPopulator implements X509AuthoritiesPopulator,
|
|||
//~ Instance fields ========================================================
|
||||
|
||||
private UserDetailsService userDetailsService;
|
||||
protected MessageSourceAccessor messages;
|
||||
protected MessageSourceAccessor messages = AcegiMessageSource.getAccessor();
|
||||
private Pattern subjectDNPattern;
|
||||
private String subjectDNRegex = "CN=(.*?),";
|
||||
|
||||
|
|
|
@ -15,18 +15,15 @@
|
|||
|
||||
package org.acegisecurity.runas;
|
||||
|
||||
import org.acegisecurity.AcegiMessageSource;
|
||||
import org.acegisecurity.Authentication;
|
||||
import org.acegisecurity.AuthenticationException;
|
||||
import org.acegisecurity.BadCredentialsException;
|
||||
|
||||
import org.acegisecurity.providers.AuthenticationProvider;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceAware;
|
||||
import org.springframework.context.support.MessageSourceAccessor;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
|
@ -49,7 +46,7 @@ public class RunAsImplAuthenticationProvider implements InitializingBean,
|
|||
AuthenticationProvider, MessageSourceAware {
|
||||
//~ Instance fields ========================================================
|
||||
|
||||
protected MessageSourceAccessor messages;
|
||||
protected MessageSourceAccessor messages = AcegiMessageSource.getAccessor();
|
||||
private String key;
|
||||
|
||||
//~ Methods ================================================================
|
||||
|
|
|
@ -15,32 +15,7 @@
|
|||
|
||||
package org.acegisecurity.ui;
|
||||
|
||||
import org.acegisecurity.Authentication;
|
||||
import org.acegisecurity.AuthenticationException;
|
||||
import org.acegisecurity.AuthenticationManager;
|
||||
|
||||
import org.acegisecurity.context.SecurityContextHolder;
|
||||
|
||||
import org.acegisecurity.event.authentication.InteractiveAuthenticationSuccessEvent;
|
||||
|
||||
import org.acegisecurity.ui.rememberme.NullRememberMeServices;
|
||||
import org.acegisecurity.ui.rememberme.RememberMeServices;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.context.ApplicationEventPublisherAware;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceAware;
|
||||
import org.springframework.context.support.MessageSourceAccessor;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
|
@ -52,6 +27,24 @@ import javax.servlet.ServletResponse;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.acegisecurity.AcegiMessageSource;
|
||||
import org.acegisecurity.Authentication;
|
||||
import org.acegisecurity.AuthenticationException;
|
||||
import org.acegisecurity.AuthenticationManager;
|
||||
import org.acegisecurity.context.SecurityContextHolder;
|
||||
import org.acegisecurity.event.authentication.InteractiveAuthenticationSuccessEvent;
|
||||
import org.acegisecurity.ui.rememberme.NullRememberMeServices;
|
||||
import org.acegisecurity.ui.rememberme.RememberMeServices;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.context.ApplicationEventPublisherAware;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceAware;
|
||||
import org.springframework.context.support.MessageSourceAccessor;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
/**
|
||||
* Abstract processor of browser-based HTTP-based authentication requests.
|
||||
|
@ -144,7 +137,7 @@ public abstract class AbstractProcessingFilter implements Filter,
|
|||
|
||||
private ApplicationEventPublisher eventPublisher;
|
||||
private AuthenticationManager authenticationManager;
|
||||
protected MessageSourceAccessor messages;
|
||||
protected MessageSourceAccessor messages = AcegiMessageSource.getAccessor();
|
||||
private Properties exceptionMappings = new Properties();
|
||||
private RememberMeServices rememberMeServices = new NullRememberMeServices();
|
||||
|
||||
|
|
|
@ -15,39 +15,7 @@
|
|||
|
||||
package org.acegisecurity.ui.digestauth;
|
||||
|
||||
import org.acegisecurity.AuthenticationException;
|
||||
import org.acegisecurity.AuthenticationServiceException;
|
||||
import org.acegisecurity.BadCredentialsException;
|
||||
|
||||
import org.acegisecurity.context.SecurityContextHolder;
|
||||
|
||||
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
|
||||
import org.acegisecurity.providers.dao.UserCache;
|
||||
import org.acegisecurity.providers.dao.cache.NullUserCache;
|
||||
|
||||
import org.acegisecurity.ui.WebAuthenticationDetails;
|
||||
|
||||
import org.acegisecurity.userdetails.UserDetailsService;
|
||||
import org.acegisecurity.userdetails.UserDetails;
|
||||
import org.acegisecurity.userdetails.UsernameNotFoundException;
|
||||
import org.acegisecurity.util.StringSplitUtils;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceAware;
|
||||
import org.springframework.context.support.MessageSourceAccessor;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
|
@ -59,6 +27,30 @@ import javax.servlet.ServletResponse;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.acegisecurity.AcegiMessageSource;
|
||||
import org.acegisecurity.AuthenticationException;
|
||||
import org.acegisecurity.AuthenticationServiceException;
|
||||
import org.acegisecurity.BadCredentialsException;
|
||||
import org.acegisecurity.context.SecurityContextHolder;
|
||||
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
|
||||
import org.acegisecurity.providers.dao.UserCache;
|
||||
import org.acegisecurity.providers.dao.cache.NullUserCache;
|
||||
import org.acegisecurity.ui.WebAuthenticationDetails;
|
||||
import org.acegisecurity.userdetails.UserDetails;
|
||||
import org.acegisecurity.userdetails.UserDetailsService;
|
||||
import org.acegisecurity.userdetails.UsernameNotFoundException;
|
||||
import org.acegisecurity.util.StringSplitUtils;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceAware;
|
||||
import org.springframework.context.support.MessageSourceAccessor;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
||||
/**
|
||||
* Processes a HTTP request's Digest authorization headers, putting the result
|
||||
|
@ -122,7 +114,7 @@ public class DigestProcessingFilter implements Filter, InitializingBean,
|
|||
|
||||
private UserDetailsService userDetailsService;
|
||||
private DigestProcessingFilterEntryPoint authenticationEntryPoint;
|
||||
protected MessageSourceAccessor messages;
|
||||
protected MessageSourceAccessor messages = AcegiMessageSource.getAccessor();
|
||||
private UserCache userCache = new NullUserCache();
|
||||
private boolean passwordAlreadyEncoded = false;
|
||||
|
||||
|
|
|
@ -15,42 +15,7 @@
|
|||
|
||||
package org.acegisecurity.ui.switchuser;
|
||||
|
||||
import org.acegisecurity.AccountExpiredException;
|
||||
import org.acegisecurity.Authentication;
|
||||
import org.acegisecurity.AuthenticationCredentialsNotFoundException;
|
||||
import org.acegisecurity.AuthenticationException;
|
||||
import org.acegisecurity.CredentialsExpiredException;
|
||||
import org.acegisecurity.DisabledException;
|
||||
import org.acegisecurity.GrantedAuthority;
|
||||
import org.acegisecurity.LockedException;
|
||||
|
||||
import org.acegisecurity.context.SecurityContextHolder;
|
||||
|
||||
import org.acegisecurity.event.authentication.AuthenticationSwitchUserEvent;
|
||||
|
||||
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
|
||||
|
||||
import org.acegisecurity.ui.WebAuthenticationDetails;
|
||||
import org.acegisecurity.userdetails.UserDetailsService;
|
||||
import org.acegisecurity.userdetails.UserDetails;
|
||||
import org.acegisecurity.userdetails.UsernameNotFoundException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.context.ApplicationEventPublisherAware;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceAware;
|
||||
import org.springframework.context.support.MessageSourceAccessor;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
@ -64,6 +29,33 @@ import javax.servlet.ServletResponse;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.acegisecurity.AccountExpiredException;
|
||||
import org.acegisecurity.AcegiMessageSource;
|
||||
import org.acegisecurity.Authentication;
|
||||
import org.acegisecurity.AuthenticationCredentialsNotFoundException;
|
||||
import org.acegisecurity.AuthenticationException;
|
||||
import org.acegisecurity.CredentialsExpiredException;
|
||||
import org.acegisecurity.DisabledException;
|
||||
import org.acegisecurity.GrantedAuthority;
|
||||
import org.acegisecurity.LockedException;
|
||||
import org.acegisecurity.context.SecurityContextHolder;
|
||||
import org.acegisecurity.event.authentication.AuthenticationSwitchUserEvent;
|
||||
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
|
||||
import org.acegisecurity.ui.WebAuthenticationDetails;
|
||||
import org.acegisecurity.userdetails.UserDetails;
|
||||
import org.acegisecurity.userdetails.UserDetailsService;
|
||||
import org.acegisecurity.userdetails.UsernameNotFoundException;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.context.ApplicationEventPublisherAware;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceAware;
|
||||
import org.springframework.context.support.MessageSourceAccessor;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
/**
|
||||
* Switch User processing filter responsible for user context switching.
|
||||
|
@ -132,7 +124,7 @@ public class SwitchUserProcessingFilter implements Filter, InitializingBean,
|
|||
// ~ Instance fields
|
||||
// ========================================================
|
||||
private UserDetailsService userDetailsService;
|
||||
protected MessageSourceAccessor messages;
|
||||
protected MessageSourceAccessor messages = AcegiMessageSource.getAccessor();
|
||||
private String exitUserUrl = "/j_acegi_exit_user";
|
||||
private String switchUserUrl = "/j_acegi_switch_user";
|
||||
private String targetUrl;
|
||||
|
|
|
@ -15,20 +15,18 @@
|
|||
|
||||
package org.acegisecurity.vote;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.acegisecurity.AccessDecisionManager;
|
||||
import org.acegisecurity.AcegiMessageSource;
|
||||
import org.acegisecurity.ConfigAttribute;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceAware;
|
||||
import org.springframework.context.support.MessageSourceAccessor;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Abstract implementation of {@link AccessDecisionManager}.
|
||||
|
@ -44,7 +42,7 @@ public abstract class AbstractAccessDecisionManager
|
|||
//~ Instance fields ========================================================
|
||||
|
||||
private List decisionVoters;
|
||||
protected MessageSourceAccessor messages;
|
||||
protected MessageSourceAccessor messages = AcegiMessageSource.getAccessor();
|
||||
private boolean allowIfAllAbstainDecisions = false;
|
||||
|
||||
//~ Methods ================================================================
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/* Copyright 2004, 2005 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.acegisecurity;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
/**
|
||||
* Tests {@link org.acegisecurity.AcegiMessageSource}.
|
||||
*/
|
||||
public class AcegiMessageSourceTests extends TestCase {
|
||||
//~ Constructors ===========================================================
|
||||
|
||||
public AcegiMessageSourceTests() {
|
||||
super();
|
||||
}
|
||||
|
||||
public AcegiMessageSourceTests(String arg0) {
|
||||
super(arg0);
|
||||
}
|
||||
|
||||
//~ Methods ================================================================
|
||||
|
||||
public static void main(String[] args) {
|
||||
junit.textui.TestRunner.run(AcegiMessageSourceTests.class);
|
||||
}
|
||||
|
||||
public void testOperation() {
|
||||
AcegiMessageSource msgs = new AcegiMessageSource();
|
||||
assertEquals("Proxy tickets are rejected",
|
||||
msgs.getMessage("RejectProxyTickets.reject", null, Locale.ENGLISH));
|
||||
}
|
||||
}
|
|
@ -23,8 +23,6 @@ import org.acegisecurity.GrantedAuthority;
|
|||
import org.acegisecurity.GrantedAuthorityImpl;
|
||||
|
||||
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.context.support.StaticMessageSource;
|
||||
|
||||
|
||||
/**
|
||||
* Tests {@link AuthByAdapterProvider}
|
||||
|
@ -82,7 +80,6 @@ public class AuthByAdapterTests extends TestCase {
|
|||
public void testAuthByAdapterProviderNonAuthenticationMethods()
|
||||
throws Exception {
|
||||
AuthByAdapterProvider provider = new AuthByAdapterProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
|
||||
try {
|
||||
provider.afterPropertiesSet();
|
||||
|
@ -101,7 +98,6 @@ public class AuthByAdapterTests extends TestCase {
|
|||
public void testAuthByAdapterProviderOnlyAcceptsAuthByAdapterImplementations()
|
||||
throws Exception {
|
||||
AuthByAdapterProvider provider = new AuthByAdapterProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setKey("my_password");
|
||||
|
||||
// Should fail as UsernamePassword is not interface of AuthByAdapter
|
||||
|
@ -122,7 +118,6 @@ public class AuthByAdapterTests extends TestCase {
|
|||
public void testAuthByAdapterProviderRequiresCorrectKey()
|
||||
throws Exception {
|
||||
AuthByAdapterProvider provider = new AuthByAdapterProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setKey("my_password");
|
||||
|
||||
// Should fail as PrincipalAcegiUserToken has different key
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.acegisecurity.acl.basic.MockAclObjectIdentity;
|
|||
import org.acegisecurity.acl.basic.SimpleAclEntry;
|
||||
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
|
||||
import org.acegisecurity.util.SimpleMethodInvocation;
|
||||
import org.springframework.context.support.StaticMessageSource;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -66,7 +65,6 @@ public class BasicAclEntryAfterInvocationProviderTests extends TestCase {
|
|||
SimpleAclEntry.ADMINISTRATION)});
|
||||
|
||||
BasicAclEntryAfterInvocationProvider provider = new BasicAclEntryAfterInvocationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setAclManager(aclManager);
|
||||
provider.afterPropertiesSet();
|
||||
|
||||
|
@ -96,7 +94,6 @@ public class BasicAclEntryAfterInvocationProviderTests extends TestCase {
|
|||
new MockAclObjectIdentity(), null, SimpleAclEntry.DELETE)});
|
||||
|
||||
BasicAclEntryAfterInvocationProvider provider = new BasicAclEntryAfterInvocationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setAclManager(aclManager);
|
||||
provider.afterPropertiesSet();
|
||||
|
||||
|
@ -126,7 +123,6 @@ public class BasicAclEntryAfterInvocationProviderTests extends TestCase {
|
|||
new MockAclObjectIdentity(), null, SimpleAclEntry.DELETE)});
|
||||
|
||||
BasicAclEntryAfterInvocationProvider provider = new BasicAclEntryAfterInvocationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setAclManager(aclManager);
|
||||
assertEquals(aclManager, provider.getAclManager());
|
||||
provider.afterPropertiesSet();
|
||||
|
@ -154,7 +150,6 @@ public class BasicAclEntryAfterInvocationProviderTests extends TestCase {
|
|||
new MockAclObjectIdentity(), null, SimpleAclEntry.DELETE), new MockAclEntry()});
|
||||
|
||||
BasicAclEntryAfterInvocationProvider provider = new BasicAclEntryAfterInvocationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setAclManager(aclManager);
|
||||
provider.afterPropertiesSet();
|
||||
|
||||
|
@ -176,7 +171,6 @@ public class BasicAclEntryAfterInvocationProviderTests extends TestCase {
|
|||
new MockAclObjectIdentity(), null, SimpleAclEntry.READ), new MockAclEntry()});
|
||||
|
||||
BasicAclEntryAfterInvocationProvider provider = new BasicAclEntryAfterInvocationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setAclManager(aclManager);
|
||||
assertEquals("AFTER_ACL_READ", provider.getProcessConfigAttribute());
|
||||
provider.setProcessConfigAttribute("AFTER_ACL_ADMIN");
|
||||
|
@ -208,7 +202,6 @@ public class BasicAclEntryAfterInvocationProviderTests extends TestCase {
|
|||
SimpleAclEntry.ADMINISTRATION), new MockAclEntry()});
|
||||
|
||||
BasicAclEntryAfterInvocationProvider provider = new BasicAclEntryAfterInvocationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setAclManager(aclManager);
|
||||
assertEquals(SimpleAclEntry.READ, provider.getRequirePermission()[0]);
|
||||
provider.setRequirePermission(new int[] {SimpleAclEntry.ADMINISTRATION});
|
||||
|
@ -229,7 +222,6 @@ public class BasicAclEntryAfterInvocationProviderTests extends TestCase {
|
|||
|
||||
public void testStartupDetectsMissingAclManager() throws Exception {
|
||||
BasicAclEntryAfterInvocationProvider provider = new BasicAclEntryAfterInvocationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
|
||||
try {
|
||||
provider.afterPropertiesSet();
|
||||
|
@ -242,7 +234,6 @@ public class BasicAclEntryAfterInvocationProviderTests extends TestCase {
|
|||
public void testStartupDetectsMissingProcessConfigAttribute()
|
||||
throws Exception {
|
||||
BasicAclEntryAfterInvocationProvider provider = new BasicAclEntryAfterInvocationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
AclManager aclManager = new MockAclManager("sydney", "marissa",
|
||||
new AclEntry[] {new SimpleAclEntry("marissa",
|
||||
new MockAclObjectIdentity(), null,
|
||||
|
@ -263,7 +254,6 @@ public class BasicAclEntryAfterInvocationProviderTests extends TestCase {
|
|||
public void testStartupDetectsMissingRequirePermission()
|
||||
throws Exception {
|
||||
BasicAclEntryAfterInvocationProvider provider = new BasicAclEntryAfterInvocationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
AclManager aclManager = new MockAclManager("sydney", "marissa",
|
||||
new AclEntry[] {new SimpleAclEntry("marissa",
|
||||
new MockAclObjectIdentity(), null,
|
||||
|
|
|
@ -20,8 +20,6 @@ import junit.framework.TestCase;
|
|||
import org.acegisecurity.Authentication;
|
||||
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
|
||||
import org.acegisecurity.ui.WebAuthenticationDetails;
|
||||
|
||||
import org.springframework.context.support.StaticMessageSource;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.MockHttpSession;
|
||||
|
||||
|
@ -40,7 +38,6 @@ public class ConcurrentSessionControllerImplTests extends TestCase {
|
|||
ConcurrentSessionControllerImpl sc = new ConcurrentSessionControllerImpl();
|
||||
SessionRegistry registry = new SessionRegistryImpl();
|
||||
sc.setSessionRegistry(registry);
|
||||
sc.setMessageSource(new StaticMessageSource());
|
||||
|
||||
// Attempt to authenticate - it should be successful
|
||||
Authentication auth = createAuthentication("bob", "1212");
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
|
||||
package org.acegisecurity.intercept.method.aopalliance;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Iterator;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.acegisecurity.AccessDecisionManager;
|
||||
|
@ -38,14 +41,8 @@ import org.acegisecurity.intercept.method.AbstractMethodDefinitionSource;
|
|||
import org.acegisecurity.intercept.method.MockMethodDefinitionSource;
|
||||
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
|
||||
import org.acegisecurity.runas.RunAsManagerImpl;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.context.support.StaticMessageSource;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -178,7 +175,6 @@ public class MethodSecurityInterceptorTests extends TestCase {
|
|||
public void testRejectsAccessDecisionManagersThatDoNotSupportMethodInvocation()
|
||||
throws Exception {
|
||||
MethodSecurityInterceptor si = new MethodSecurityInterceptor();
|
||||
si.setMessageSource(new StaticMessageSource());
|
||||
si.setAccessDecisionManager(new MockAccessDecisionManagerWhichOnlySupportsStrings());
|
||||
si.setAuthenticationManager(new MockAuthenticationManager());
|
||||
si.setObjectDefinitionSource(new MockMethodDefinitionSource(false, true));
|
||||
|
@ -214,7 +210,6 @@ public class MethodSecurityInterceptorTests extends TestCase {
|
|||
public void testRejectsCallsWhenObjectDefinitionSourceDoesNotSupportObject()
|
||||
throws Throwable {
|
||||
MethodSecurityInterceptor interceptor = new MethodSecurityInterceptor();
|
||||
interceptor.setMessageSource(new StaticMessageSource());
|
||||
interceptor.setObjectDefinitionSource(new MockObjectDefinitionSourceWhichOnlySupportsStrings());
|
||||
interceptor.setAccessDecisionManager(new MockAccessDecisionManager());
|
||||
interceptor.setAuthenticationManager(new MockAuthenticationManager());
|
||||
|
@ -231,7 +226,6 @@ public class MethodSecurityInterceptorTests extends TestCase {
|
|||
|
||||
public void testRejectsCallsWhenObjectIsNull() throws Throwable {
|
||||
MethodSecurityInterceptor interceptor = new MethodSecurityInterceptor();
|
||||
interceptor.setMessageSource(new StaticMessageSource());
|
||||
|
||||
try {
|
||||
interceptor.invoke(null);
|
||||
|
@ -244,7 +238,6 @@ public class MethodSecurityInterceptorTests extends TestCase {
|
|||
public void testRejectsRunAsManagersThatDoNotSupportMethodInvocation()
|
||||
throws Exception {
|
||||
MethodSecurityInterceptor si = new MethodSecurityInterceptor();
|
||||
si.setMessageSource(new StaticMessageSource());
|
||||
si.setAccessDecisionManager(new MockAccessDecisionManager());
|
||||
si.setAuthenticationManager(new MockAuthenticationManager());
|
||||
si.setObjectDefinitionSource(new MockMethodDefinitionSource(false, true));
|
||||
|
@ -263,7 +256,6 @@ public class MethodSecurityInterceptorTests extends TestCase {
|
|||
public void testStartupCheckForAccessDecisionManager()
|
||||
throws Exception {
|
||||
MethodSecurityInterceptor si = new MethodSecurityInterceptor();
|
||||
si.setMessageSource(new StaticMessageSource());
|
||||
si.setRunAsManager(new MockRunAsManager());
|
||||
si.setAuthenticationManager(new MockAuthenticationManager());
|
||||
si.setAfterInvocationManager(new MockAfterInvocationManager());
|
||||
|
@ -282,7 +274,6 @@ public class MethodSecurityInterceptorTests extends TestCase {
|
|||
public void testStartupCheckForAuthenticationManager()
|
||||
throws Exception {
|
||||
MethodSecurityInterceptor si = new MethodSecurityInterceptor();
|
||||
si.setMessageSource(new StaticMessageSource());
|
||||
si.setAccessDecisionManager(new MockAccessDecisionManager());
|
||||
si.setRunAsManager(new MockRunAsManager());
|
||||
si.setAfterInvocationManager(new MockAfterInvocationManager());
|
||||
|
@ -301,7 +292,6 @@ public class MethodSecurityInterceptorTests extends TestCase {
|
|||
public void testStartupCheckForMethodDefinitionSource()
|
||||
throws Exception {
|
||||
MethodSecurityInterceptor si = new MethodSecurityInterceptor();
|
||||
si.setMessageSource(new StaticMessageSource());
|
||||
si.setAccessDecisionManager(new MockAccessDecisionManager());
|
||||
si.setAuthenticationManager(new MockAuthenticationManager());
|
||||
|
||||
|
@ -316,7 +306,6 @@ public class MethodSecurityInterceptorTests extends TestCase {
|
|||
|
||||
public void testStartupCheckForRunAsManager() throws Exception {
|
||||
MethodSecurityInterceptor si = new MethodSecurityInterceptor();
|
||||
si.setMessageSource(new StaticMessageSource());
|
||||
si.setAccessDecisionManager(new MockAccessDecisionManager());
|
||||
si.setAuthenticationManager(new MockAuthenticationManager());
|
||||
si.setRunAsManager(null); // Overriding the default
|
||||
|
@ -334,7 +323,6 @@ public class MethodSecurityInterceptorTests extends TestCase {
|
|||
public void testStartupCheckForValidAfterInvocationManager()
|
||||
throws Exception {
|
||||
MethodSecurityInterceptor si = new MethodSecurityInterceptor();
|
||||
si.setMessageSource(new StaticMessageSource());
|
||||
si.setRunAsManager(new MockRunAsManager());
|
||||
si.setAuthenticationManager(new MockAuthenticationManager());
|
||||
si.setAfterInvocationManager(new MockAfterInvocationManagerWhichOnlySupportsStrings());
|
||||
|
@ -352,7 +340,6 @@ public class MethodSecurityInterceptorTests extends TestCase {
|
|||
public void testValidationFailsIfInvalidAttributePresented()
|
||||
throws Exception {
|
||||
MethodSecurityInterceptor si = new MethodSecurityInterceptor();
|
||||
si.setMessageSource(new StaticMessageSource());
|
||||
si.setAccessDecisionManager(new MockAccessDecisionManager());
|
||||
si.setAuthenticationManager(new MockAuthenticationManager());
|
||||
si.setRunAsManager(new RunAsManagerImpl());
|
||||
|
@ -372,7 +359,6 @@ public class MethodSecurityInterceptorTests extends TestCase {
|
|||
public void testValidationNotAttemptedIfIsValidateConfigAttributesSetToFalse()
|
||||
throws Exception {
|
||||
MethodSecurityInterceptor si = new MethodSecurityInterceptor();
|
||||
si.setMessageSource(new StaticMessageSource());
|
||||
si.setAccessDecisionManager(new MockAccessDecisionManager());
|
||||
si.setAuthenticationManager(new MockAuthenticationManager());
|
||||
|
||||
|
@ -388,7 +374,6 @@ public class MethodSecurityInterceptorTests extends TestCase {
|
|||
public void testValidationNotAttemptedIfMethodDefinitionSourceCannotReturnIterator()
|
||||
throws Exception {
|
||||
MethodSecurityInterceptor si = new MethodSecurityInterceptor();
|
||||
si.setMessageSource(new StaticMessageSource());
|
||||
si.setAccessDecisionManager(new MockAccessDecisionManager());
|
||||
si.setRunAsManager(new MockRunAsManager());
|
||||
si.setAuthenticationManager(new MockAuthenticationManager());
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
package org.acegisecurity.intercept.method.aspectj;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.acegisecurity.AccessDeniedException;
|
||||
|
@ -30,9 +32,6 @@ import org.acegisecurity.context.SecurityContextHolder;
|
|||
import org.acegisecurity.intercept.method.MethodDefinitionMap;
|
||||
import org.acegisecurity.intercept.method.MethodDefinitionSourceEditor;
|
||||
import org.acegisecurity.providers.TestingAuthenticationToken;
|
||||
import org.springframework.context.support.StaticMessageSource;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -65,7 +64,6 @@ public class AspectJSecurityInterceptorTests extends TestCase {
|
|||
public void testCallbackIsInvokedWhenPermissionGranted()
|
||||
throws Exception {
|
||||
AspectJSecurityInterceptor si = new AspectJSecurityInterceptor();
|
||||
si.setMessageSource(new StaticMessageSource());
|
||||
si.setApplicationEventPublisher(MockApplicationContext.getContext());
|
||||
si.setAccessDecisionManager(new MockAccessDecisionManager());
|
||||
si.setAuthenticationManager(new MockAuthenticationManager());
|
||||
|
@ -102,7 +100,6 @@ public class AspectJSecurityInterceptorTests extends TestCase {
|
|||
public void testCallbackIsNotInvokedWhenPermissionDenied()
|
||||
throws Exception {
|
||||
AspectJSecurityInterceptor si = new AspectJSecurityInterceptor();
|
||||
si.setMessageSource(new StaticMessageSource());
|
||||
si.setApplicationEventPublisher(MockApplicationContext.getContext());
|
||||
si.setAccessDecisionManager(new MockAccessDecisionManager());
|
||||
si.setAuthenticationManager(new MockAuthenticationManager());
|
||||
|
|
|
@ -15,6 +15,14 @@
|
|||
|
||||
package org.acegisecurity.intercept.web;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.acegisecurity.AccessDecisionManager;
|
||||
|
@ -33,20 +41,9 @@ import org.acegisecurity.SecurityConfig;
|
|||
import org.acegisecurity.context.SecurityContextHolder;
|
||||
import org.acegisecurity.context.SecurityContextImpl;
|
||||
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
|
||||
|
||||
import org.springframework.context.support.StaticMessageSource;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
|
||||
|
||||
/**
|
||||
* Tests {@link FilterSecurityInterceptor}.
|
||||
|
@ -78,7 +75,6 @@ public class FilterSecurityInterceptorTests extends TestCase {
|
|||
public void testEnsuresAccessDecisionManagerSupportsFilterInvocationClass()
|
||||
throws Exception {
|
||||
FilterSecurityInterceptor interceptor = new FilterSecurityInterceptor();
|
||||
interceptor.setMessageSource(new StaticMessageSource());
|
||||
interceptor.setAuthenticationManager(new MockAuthenticationManager());
|
||||
interceptor.setObjectDefinitionSource(new RegExpBasedFilterInvocationDefinitionMap());
|
||||
interceptor.setRunAsManager(new MockRunAsManager());
|
||||
|
@ -112,7 +108,6 @@ public class FilterSecurityInterceptorTests extends TestCase {
|
|||
public void testEnsuresRunAsManagerSupportsFilterInvocationClass()
|
||||
throws Exception {
|
||||
FilterSecurityInterceptor interceptor = new FilterSecurityInterceptor();
|
||||
interceptor.setMessageSource(new StaticMessageSource());
|
||||
interceptor.setAccessDecisionManager(new MockAccessDecisionManager());
|
||||
interceptor.setAuthenticationManager(new MockAuthenticationManager());
|
||||
interceptor.setObjectDefinitionSource(new RegExpBasedFilterInvocationDefinitionMap());
|
||||
|
@ -147,7 +142,6 @@ public class FilterSecurityInterceptorTests extends TestCase {
|
|||
throws Throwable {
|
||||
// Setup the FilterSecurityInterceptor
|
||||
FilterSecurityInterceptor interceptor = new FilterSecurityInterceptor();
|
||||
interceptor.setMessageSource(new StaticMessageSource());
|
||||
interceptor.setAccessDecisionManager(new MockAccessDecisionManager());
|
||||
interceptor.setAuthenticationManager(new MockAuthenticationManager());
|
||||
interceptor.setRunAsManager(new MockRunAsManager());
|
||||
|
@ -187,7 +181,6 @@ public class FilterSecurityInterceptorTests extends TestCase {
|
|||
|
||||
public void testNormalStartupAndGetter() throws Exception {
|
||||
FilterSecurityInterceptor interceptor = new FilterSecurityInterceptor();
|
||||
interceptor.setMessageSource(new StaticMessageSource());
|
||||
interceptor.setAccessDecisionManager(new MockAccessDecisionManager());
|
||||
interceptor.setAuthenticationManager(new MockAuthenticationManager());
|
||||
|
||||
|
@ -208,7 +201,6 @@ public class FilterSecurityInterceptorTests extends TestCase {
|
|||
public void testSuccessfulInvocation() throws Throwable {
|
||||
// Setup the FilterSecurityInterceptor
|
||||
FilterSecurityInterceptor interceptor = new FilterSecurityInterceptor();
|
||||
interceptor.setMessageSource(new StaticMessageSource());
|
||||
interceptor.setAccessDecisionManager(new MockAccessDecisionManager());
|
||||
interceptor.setAuthenticationManager(new MockAuthenticationManager());
|
||||
interceptor.setRunAsManager(new MockRunAsManager());
|
||||
|
|
|
@ -19,6 +19,7 @@ import java.util.List;
|
|||
import java.util.Vector;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.acegisecurity.Authentication;
|
||||
import org.acegisecurity.AuthenticationException;
|
||||
import org.acegisecurity.AuthenticationServiceException;
|
||||
|
@ -26,10 +27,8 @@ import org.acegisecurity.GrantedAuthority;
|
|||
import org.acegisecurity.GrantedAuthorityImpl;
|
||||
import org.acegisecurity.concurrent.ConcurrentSessionControllerImpl;
|
||||
import org.acegisecurity.concurrent.NullConcurrentSessionController;
|
||||
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.context.support.StaticMessageSource;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -183,7 +182,6 @@ public class ProviderManagerTests extends TestCase {
|
|||
|
||||
ProviderManager mgr = new ProviderManager();
|
||||
mgr.setProviders(providers);
|
||||
mgr.setMessageSource(new StaticMessageSource());
|
||||
|
||||
mgr.afterPropertiesSet();
|
||||
return mgr;
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.acegisecurity.BadCredentialsException;
|
|||
import org.acegisecurity.GrantedAuthority;
|
||||
import org.acegisecurity.GrantedAuthorityImpl;
|
||||
import org.acegisecurity.providers.TestingAuthenticationToken;
|
||||
import org.springframework.context.support.StaticMessageSource;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -54,7 +53,6 @@ public class AnonymousAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testDetectsAnInvalidKey() throws Exception {
|
||||
AnonymousAuthenticationProvider aap = new AnonymousAuthenticationProvider();
|
||||
aap.setMessageSource(new StaticMessageSource());
|
||||
aap.setKey("qwerty");
|
||||
|
||||
AnonymousAuthenticationToken token = new AnonymousAuthenticationToken("WRONG_KEY",
|
||||
|
@ -73,7 +71,6 @@ public class AnonymousAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testDetectsMissingKey() throws Exception {
|
||||
AnonymousAuthenticationProvider aap = new AnonymousAuthenticationProvider();
|
||||
aap.setMessageSource(new StaticMessageSource());
|
||||
|
||||
try {
|
||||
aap.afterPropertiesSet();
|
||||
|
@ -85,7 +82,6 @@ public class AnonymousAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testGettersSetters() throws Exception {
|
||||
AnonymousAuthenticationProvider aap = new AnonymousAuthenticationProvider();
|
||||
aap.setMessageSource(new StaticMessageSource());
|
||||
aap.setKey("qwerty");
|
||||
aap.afterPropertiesSet();
|
||||
assertEquals("qwerty", aap.getKey());
|
||||
|
@ -93,7 +89,6 @@ public class AnonymousAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testIgnoresClassesItDoesNotSupport() throws Exception {
|
||||
AnonymousAuthenticationProvider aap = new AnonymousAuthenticationProvider();
|
||||
aap.setMessageSource(new StaticMessageSource());
|
||||
aap.setKey("qwerty");
|
||||
|
||||
TestingAuthenticationToken token = new TestingAuthenticationToken("user",
|
||||
|
@ -107,7 +102,6 @@ public class AnonymousAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testNormalOperation() throws Exception {
|
||||
AnonymousAuthenticationProvider aap = new AnonymousAuthenticationProvider();
|
||||
aap.setMessageSource(new StaticMessageSource());
|
||||
aap.setKey("qwerty");
|
||||
|
||||
AnonymousAuthenticationToken token = new AnonymousAuthenticationToken("qwerty",
|
||||
|
@ -122,7 +116,6 @@ public class AnonymousAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testSupports() {
|
||||
AnonymousAuthenticationProvider aap = new AnonymousAuthenticationProvider();
|
||||
aap.setMessageSource(new StaticMessageSource());
|
||||
assertTrue(aap.supports(AnonymousAuthenticationToken.class));
|
||||
assertFalse(aap.supports(TestingAuthenticationToken.class));
|
||||
}
|
||||
|
|
|
@ -15,6 +15,11 @@
|
|||
|
||||
package org.acegisecurity.providers.cas;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.acegisecurity.Authentication;
|
||||
|
@ -28,12 +33,6 @@ import org.acegisecurity.providers.cas.ticketvalidator.AbstractTicketValidator;
|
|||
import org.acegisecurity.ui.cas.CasProcessingFilter;
|
||||
import org.acegisecurity.userdetails.User;
|
||||
import org.acegisecurity.userdetails.UserDetails;
|
||||
import org.springframework.context.support.StaticMessageSource;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -65,7 +64,6 @@ public class CasAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testAuthenticateStateful() throws Exception {
|
||||
CasAuthenticationProvider cap = new CasAuthenticationProvider();
|
||||
cap.setMessageSource(new StaticMessageSource());
|
||||
cap.setCasAuthoritiesPopulator(new MockAuthoritiesPopulator());
|
||||
cap.setCasProxyDecider(new MockProxyDecider(true));
|
||||
cap.setKey("qwerty");
|
||||
|
@ -110,7 +108,6 @@ public class CasAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testAuthenticateStateless() throws Exception {
|
||||
CasAuthenticationProvider cap = new CasAuthenticationProvider();
|
||||
cap.setMessageSource(new StaticMessageSource());
|
||||
cap.setCasAuthoritiesPopulator(new MockAuthoritiesPopulator());
|
||||
cap.setCasProxyDecider(new MockProxyDecider(true));
|
||||
cap.setKey("qwerty");
|
||||
|
@ -147,7 +144,6 @@ public class CasAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testDetectsAMissingTicketId() throws Exception {
|
||||
CasAuthenticationProvider cap = new CasAuthenticationProvider();
|
||||
cap.setMessageSource(new StaticMessageSource());
|
||||
cap.setCasAuthoritiesPopulator(new MockAuthoritiesPopulator());
|
||||
cap.setCasProxyDecider(new MockProxyDecider(true));
|
||||
cap.setKey("qwerty");
|
||||
|
@ -171,7 +167,6 @@ public class CasAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testDetectsAnInvalidKey() throws Exception {
|
||||
CasAuthenticationProvider cap = new CasAuthenticationProvider();
|
||||
cap.setMessageSource(new StaticMessageSource());
|
||||
cap.setCasAuthoritiesPopulator(new MockAuthoritiesPopulator());
|
||||
cap.setCasProxyDecider(new MockProxyDecider(true));
|
||||
cap.setKey("qwerty");
|
||||
|
@ -198,7 +193,6 @@ public class CasAuthenticationProviderTests extends TestCase {
|
|||
public void testDetectsMissingAuthoritiesPopulator()
|
||||
throws Exception {
|
||||
CasAuthenticationProvider cap = new CasAuthenticationProvider();
|
||||
cap.setMessageSource(new StaticMessageSource());
|
||||
cap.setCasProxyDecider(new MockProxyDecider());
|
||||
cap.setKey("qwerty");
|
||||
cap.setStatelessTicketCache(new MockStatelessTicketCache());
|
||||
|
@ -215,7 +209,6 @@ public class CasAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testDetectsMissingKey() throws Exception {
|
||||
CasAuthenticationProvider cap = new CasAuthenticationProvider();
|
||||
cap.setMessageSource(new StaticMessageSource());
|
||||
cap.setCasAuthoritiesPopulator(new MockAuthoritiesPopulator());
|
||||
cap.setCasProxyDecider(new MockProxyDecider());
|
||||
cap.setStatelessTicketCache(new MockStatelessTicketCache());
|
||||
|
@ -232,7 +225,6 @@ public class CasAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testDetectsMissingProxyDecider() throws Exception {
|
||||
CasAuthenticationProvider cap = new CasAuthenticationProvider();
|
||||
cap.setMessageSource(new StaticMessageSource());
|
||||
cap.setCasAuthoritiesPopulator(new MockAuthoritiesPopulator());
|
||||
cap.setKey("qwerty");
|
||||
cap.setStatelessTicketCache(new MockStatelessTicketCache());
|
||||
|
@ -249,7 +241,6 @@ public class CasAuthenticationProviderTests extends TestCase {
|
|||
public void testDetectsMissingStatelessTicketCache()
|
||||
throws Exception {
|
||||
CasAuthenticationProvider cap = new CasAuthenticationProvider();
|
||||
cap.setMessageSource(new StaticMessageSource());
|
||||
cap.setCasAuthoritiesPopulator(new MockAuthoritiesPopulator());
|
||||
cap.setCasProxyDecider(new MockProxyDecider());
|
||||
cap.setKey("qwerty");
|
||||
|
@ -266,7 +257,6 @@ public class CasAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testDetectsMissingTicketValidator() throws Exception {
|
||||
CasAuthenticationProvider cap = new CasAuthenticationProvider();
|
||||
cap.setMessageSource(new StaticMessageSource());
|
||||
cap.setCasAuthoritiesPopulator(new MockAuthoritiesPopulator());
|
||||
cap.setCasProxyDecider(new MockProxyDecider(true));
|
||||
cap.setKey("qwerty");
|
||||
|
@ -282,7 +272,6 @@ public class CasAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testGettersSetters() throws Exception {
|
||||
CasAuthenticationProvider cap = new CasAuthenticationProvider();
|
||||
cap.setMessageSource(new StaticMessageSource());
|
||||
cap.setCasAuthoritiesPopulator(new MockAuthoritiesPopulator());
|
||||
cap.setCasProxyDecider(new MockProxyDecider());
|
||||
cap.setKey("qwerty");
|
||||
|
@ -299,7 +288,6 @@ public class CasAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testIgnoresClassesItDoesNotSupport() throws Exception {
|
||||
CasAuthenticationProvider cap = new CasAuthenticationProvider();
|
||||
cap.setMessageSource(new StaticMessageSource());
|
||||
cap.setCasAuthoritiesPopulator(new MockAuthoritiesPopulator());
|
||||
cap.setCasProxyDecider(new MockProxyDecider());
|
||||
cap.setKey("qwerty");
|
||||
|
@ -319,7 +307,6 @@ public class CasAuthenticationProviderTests extends TestCase {
|
|||
public void testIgnoresUsernamePasswordAuthenticationTokensWithoutCasIdentifiersAsPrincipal()
|
||||
throws Exception {
|
||||
CasAuthenticationProvider cap = new CasAuthenticationProvider();
|
||||
cap.setMessageSource(new StaticMessageSource());
|
||||
cap.setCasAuthoritiesPopulator(new MockAuthoritiesPopulator());
|
||||
cap.setCasProxyDecider(new MockProxyDecider());
|
||||
cap.setKey("qwerty");
|
||||
|
@ -335,7 +322,6 @@ public class CasAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testSupports() {
|
||||
CasAuthenticationProvider cap = new CasAuthenticationProvider();
|
||||
cap.setMessageSource(new StaticMessageSource());
|
||||
assertTrue(cap.supports(UsernamePasswordAuthenticationToken.class));
|
||||
assertTrue(cap.supports(CasAuthenticationToken.class));
|
||||
}
|
||||
|
|
|
@ -15,15 +15,13 @@
|
|||
|
||||
package org.acegisecurity.providers.cas.proxy;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.acegisecurity.providers.cas.ProxyUntrustedException;
|
||||
|
||||
import org.springframework.context.support.StaticMessageSource;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
|
||||
/**
|
||||
* Tests {@link NamedCasProxyDecider}.
|
||||
|
@ -52,7 +50,6 @@ public class NamedCasProxyDeciderTests extends TestCase {
|
|||
public void testAcceptsIfNearestProxyIsAuthorized()
|
||||
throws Exception {
|
||||
NamedCasProxyDecider proxyDecider = new NamedCasProxyDecider();
|
||||
proxyDecider.setMessageSource(new StaticMessageSource());
|
||||
|
||||
// Build the ticket returned from CAS
|
||||
List proxyList = new Vector();
|
||||
|
@ -72,7 +69,6 @@ public class NamedCasProxyDeciderTests extends TestCase {
|
|||
|
||||
public void testAcceptsIfNoProxiesInTicket() {
|
||||
NamedCasProxyDecider proxyDecider = new NamedCasProxyDecider();
|
||||
proxyDecider.setMessageSource(new StaticMessageSource());
|
||||
|
||||
List proxyList = new Vector(); // no proxies in list
|
||||
|
||||
|
@ -82,7 +78,6 @@ public class NamedCasProxyDeciderTests extends TestCase {
|
|||
|
||||
public void testDetectsMissingValidProxiesList() throws Exception {
|
||||
NamedCasProxyDecider proxyDecider = new NamedCasProxyDecider();
|
||||
proxyDecider.setMessageSource(new StaticMessageSource());
|
||||
|
||||
try {
|
||||
proxyDecider.afterPropertiesSet();
|
||||
|
@ -95,7 +90,6 @@ public class NamedCasProxyDeciderTests extends TestCase {
|
|||
|
||||
public void testDoesNotAcceptNull() {
|
||||
NamedCasProxyDecider proxyDecider = new NamedCasProxyDecider();
|
||||
proxyDecider.setMessageSource(new StaticMessageSource());
|
||||
|
||||
try {
|
||||
proxyDecider.confirmProxyListTrusted(null);
|
||||
|
@ -107,7 +101,6 @@ public class NamedCasProxyDeciderTests extends TestCase {
|
|||
|
||||
public void testGettersSetters() {
|
||||
NamedCasProxyDecider proxyDecider = new NamedCasProxyDecider();
|
||||
proxyDecider.setMessageSource(new StaticMessageSource());
|
||||
|
||||
// Build the list of valid nearest proxies
|
||||
List validProxies = new Vector();
|
||||
|
@ -122,7 +115,6 @@ public class NamedCasProxyDeciderTests extends TestCase {
|
|||
public void testRejectsIfNearestProxyIsNotAuthorized()
|
||||
throws Exception {
|
||||
NamedCasProxyDecider proxyDecider = new NamedCasProxyDecider();
|
||||
proxyDecider.setMessageSource(new StaticMessageSource());
|
||||
|
||||
// Build the ticket returned from CAS
|
||||
List proxyList = new Vector();
|
||||
|
|
|
@ -15,13 +15,12 @@
|
|||
|
||||
package org.acegisecurity.providers.cas.proxy;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.acegisecurity.providers.cas.ProxyUntrustedException;
|
||||
import org.springframework.context.support.StaticMessageSource;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -72,7 +71,6 @@ public class RejectProxyTicketsTests extends TestCase {
|
|||
|
||||
public void testRejectsIfAnyProxyInList() {
|
||||
RejectProxyTickets proxyDecider = new RejectProxyTickets();
|
||||
proxyDecider.setMessageSource(new StaticMessageSource());
|
||||
List proxyList = new Vector();
|
||||
proxyList.add("https://localhost/webApp/j_acegi_cas_security_check");
|
||||
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
|
||||
package org.acegisecurity.providers.dao;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.acegisecurity.AccountExpiredException;
|
||||
|
@ -32,18 +35,13 @@ import org.acegisecurity.providers.dao.cache.EhCacheBasedUserCache;
|
|||
import org.acegisecurity.providers.dao.cache.NullUserCache;
|
||||
import org.acegisecurity.providers.dao.salt.SystemWideSaltSource;
|
||||
import org.acegisecurity.providers.encoding.ShaPasswordEncoder;
|
||||
import org.acegisecurity.userdetails.UserDetailsService;
|
||||
import org.acegisecurity.userdetails.User;
|
||||
import org.acegisecurity.userdetails.UserDetails;
|
||||
import org.acegisecurity.userdetails.UserDetailsService;
|
||||
import org.acegisecurity.userdetails.UsernameNotFoundException;
|
||||
|
||||
import org.springframework.context.support.StaticMessageSource;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.dao.DataRetrievalFailureException;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* Tests {@link DaoAuthenticationProvider}.
|
||||
|
@ -67,7 +65,6 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
"KOala");
|
||||
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setUserDetailsService(new MockAuthenticationDaoUserMarissa());
|
||||
provider.setUserCache(new MockUserCache());
|
||||
|
||||
|
@ -84,7 +81,6 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
"opal");
|
||||
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setUserDetailsService(new MockAuthenticationDaoUserPeterAccountExpired());
|
||||
provider.setUserCache(new MockUserCache());
|
||||
|
||||
|
@ -101,7 +97,6 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
"opal");
|
||||
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setUserDetailsService(new MockAuthenticationDaoUserPeterAccountLocked());
|
||||
provider.setUserCache(new MockUserCache());
|
||||
|
||||
|
@ -118,7 +113,6 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
"opal");
|
||||
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setUserDetailsService(new MockAuthenticationDaoUserPeterCredentialsExpired());
|
||||
provider.setUserCache(new MockUserCache());
|
||||
|
||||
|
@ -146,7 +140,6 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
"opal");
|
||||
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setUserDetailsService(new MockAuthenticationDaoUserPeter());
|
||||
provider.setUserCache(new MockUserCache());
|
||||
|
||||
|
@ -163,7 +156,6 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
"koala");
|
||||
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setUserDetailsService(new MockAuthenticationDaoSimulateBackendError());
|
||||
provider.setUserCache(new MockUserCache());
|
||||
|
||||
|
@ -180,7 +172,6 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
"koala");
|
||||
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setUserDetailsService(new MockAuthenticationDaoUserMarissa());
|
||||
provider.setUserCache(new MockUserCache());
|
||||
|
||||
|
@ -197,7 +188,6 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
"INVALID_PASSWORD");
|
||||
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setUserDetailsService(new MockAuthenticationDaoUserMarissa());
|
||||
provider.setUserCache(new MockUserCache());
|
||||
|
||||
|
@ -214,7 +204,6 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
"koala");
|
||||
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setHideUserNotFoundExceptions(false); // we want UsernameNotFoundExceptions
|
||||
provider.setUserDetailsService(new MockAuthenticationDaoUserMarissa());
|
||||
provider.setUserCache(new MockUserCache());
|
||||
|
@ -232,7 +221,6 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
"koala");
|
||||
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
assertTrue(provider.isHideUserNotFoundExceptions());
|
||||
provider.setUserDetailsService(new MockAuthenticationDaoUserMarissa());
|
||||
provider.setUserCache(new MockUserCache());
|
||||
|
@ -250,7 +238,6 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
"koala");
|
||||
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setUserDetailsService(new MockAuthenticationDaoUserMarissa());
|
||||
provider.setUserCache(new MockUserCache());
|
||||
|
||||
|
@ -268,7 +255,6 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
token.setDetails("192.168.0.1");
|
||||
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setUserDetailsService(new MockAuthenticationDaoUserMarissa());
|
||||
provider.setUserCache(new MockUserCache());
|
||||
|
||||
|
@ -292,7 +278,6 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
"koala");
|
||||
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setUserDetailsService(new MockAuthenticationDaoUserMarissa());
|
||||
provider.setUserCache(new MockUserCache());
|
||||
|
||||
|
@ -322,7 +307,6 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
salt.setSystemWideSalt("SYSTEM_SALT_VALUE");
|
||||
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setUserDetailsService(new MockAuthenticationDaoUserMarissaWithSalt());
|
||||
provider.setSaltSource(salt);
|
||||
provider.setUserCache(new MockUserCache());
|
||||
|
@ -348,7 +332,6 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
"koala");
|
||||
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setUserDetailsService(new MockAuthenticationDaoUserMarissa());
|
||||
provider.setUserCache(new MockUserCache());
|
||||
provider.setForcePrincipalAsString(true);
|
||||
|
@ -370,7 +353,6 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
"koala");
|
||||
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setUserDetailsService(new MockAuthenticationDaoReturnsNull());
|
||||
|
||||
try {
|
||||
|
@ -384,7 +366,6 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testGettersSetters() {
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setPasswordEncoder(new ShaPasswordEncoder());
|
||||
assertEquals(ShaPasswordEncoder.class,
|
||||
provider.getPasswordEncoder().getClass());
|
||||
|
@ -409,7 +390,6 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
MockAuthenticationDaoUserMarissa authenticationDao = new MockAuthenticationDaoUserMarissa();
|
||||
MockUserCache cache = new MockUserCache();
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setUserDetailsService(authenticationDao);
|
||||
provider.setUserCache(cache);
|
||||
|
||||
|
@ -436,7 +416,6 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
public void testStartupFailsIfNoAuthenticationDao()
|
||||
throws Exception {
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
|
||||
try {
|
||||
provider.afterPropertiesSet();
|
||||
|
@ -448,7 +427,6 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testStartupFailsIfNoUserCacheSet() throws Exception {
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setUserDetailsService(new MockAuthenticationDaoUserMarissa());
|
||||
assertEquals(NullUserCache.class, provider.getUserCache().getClass());
|
||||
provider.setUserCache(null);
|
||||
|
@ -463,7 +441,6 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testStartupSuccess() throws Exception {
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
UserDetailsService dao = new MockAuthenticationDaoUserMarissa();
|
||||
provider.setUserDetailsService(dao);
|
||||
provider.setUserCache(new MockUserCache());
|
||||
|
@ -474,7 +451,6 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testSupports() {
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
assertTrue(provider.supports(UsernamePasswordAuthenticationToken.class));
|
||||
assertTrue(!provider.supports(TestingAuthenticationToken.class));
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.acegisecurity.BadCredentialsException;
|
|||
import org.acegisecurity.GrantedAuthority;
|
||||
import org.acegisecurity.GrantedAuthorityImpl;
|
||||
import org.acegisecurity.providers.TestingAuthenticationToken;
|
||||
import org.springframework.context.support.StaticMessageSource;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -54,7 +53,6 @@ public class RememberMeAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testDetectsAnInvalidKey() throws Exception {
|
||||
RememberMeAuthenticationProvider aap = new RememberMeAuthenticationProvider();
|
||||
aap.setMessageSource(new StaticMessageSource());
|
||||
aap.setKey("qwerty");
|
||||
|
||||
RememberMeAuthenticationToken token = new RememberMeAuthenticationToken("WRONG_KEY",
|
||||
|
@ -73,7 +71,6 @@ public class RememberMeAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testDetectsMissingKey() throws Exception {
|
||||
RememberMeAuthenticationProvider aap = new RememberMeAuthenticationProvider();
|
||||
aap.setMessageSource(new StaticMessageSource());
|
||||
|
||||
try {
|
||||
aap.afterPropertiesSet();
|
||||
|
@ -85,7 +82,6 @@ public class RememberMeAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testGettersSetters() throws Exception {
|
||||
RememberMeAuthenticationProvider aap = new RememberMeAuthenticationProvider();
|
||||
aap.setMessageSource(new StaticMessageSource());
|
||||
aap.setKey("qwerty");
|
||||
aap.afterPropertiesSet();
|
||||
assertEquals("qwerty", aap.getKey());
|
||||
|
@ -106,7 +102,6 @@ public class RememberMeAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testNormalOperation() throws Exception {
|
||||
RememberMeAuthenticationProvider aap = new RememberMeAuthenticationProvider();
|
||||
aap.setMessageSource(new StaticMessageSource());
|
||||
aap.setKey("qwerty");
|
||||
|
||||
RememberMeAuthenticationToken token = new RememberMeAuthenticationToken("qwerty",
|
||||
|
@ -121,7 +116,6 @@ public class RememberMeAuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testSupports() {
|
||||
RememberMeAuthenticationProvider aap = new RememberMeAuthenticationProvider();
|
||||
aap.setMessageSource(new StaticMessageSource());
|
||||
assertTrue(aap.supports(RememberMeAuthenticationToken.class));
|
||||
assertFalse(aap.supports(TestingAuthenticationToken.class));
|
||||
}
|
||||
|
|
|
@ -15,15 +15,18 @@
|
|||
|
||||
package org.acegisecurity.providers.x509;
|
||||
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.acegisecurity.*;
|
||||
import org.acegisecurity.Authentication;
|
||||
import org.acegisecurity.AuthenticationException;
|
||||
import org.acegisecurity.BadCredentialsException;
|
||||
import org.acegisecurity.GrantedAuthority;
|
||||
import org.acegisecurity.GrantedAuthorityImpl;
|
||||
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
|
||||
import org.acegisecurity.userdetails.User;
|
||||
import org.acegisecurity.userdetails.UserDetails;
|
||||
import org.springframework.context.support.StaticMessageSource;
|
||||
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -51,7 +54,6 @@ public class X509AuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testAuthenticationIsNullWithUnsupportedToken() {
|
||||
X509AuthenticationProvider provider = new X509AuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
Authentication request = new UsernamePasswordAuthenticationToken("dummy",
|
||||
"dummy");
|
||||
Authentication result = provider.authenticate(request);
|
||||
|
@ -60,7 +62,6 @@ public class X509AuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testFailsWithNullCertificate() {
|
||||
X509AuthenticationProvider provider = new X509AuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
|
||||
provider.setX509AuthoritiesPopulator(new MockAuthoritiesPopulator(false));
|
||||
|
||||
|
@ -74,7 +75,6 @@ public class X509AuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testNormalOperation() throws Exception {
|
||||
X509AuthenticationProvider provider = new X509AuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
|
||||
provider.setX509AuthoritiesPopulator(new MockAuthoritiesPopulator(false));
|
||||
provider.afterPropertiesSet();
|
||||
|
@ -87,7 +87,6 @@ public class X509AuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testPopulatorRejectionCausesFailure() throws Exception {
|
||||
X509AuthenticationProvider provider = new X509AuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
provider.setX509AuthoritiesPopulator(new MockAuthoritiesPopulator(true));
|
||||
|
||||
try {
|
||||
|
@ -100,7 +99,6 @@ public class X509AuthenticationProviderTests extends TestCase {
|
|||
|
||||
public void testRequiresPopulator() throws Exception {
|
||||
X509AuthenticationProvider provider = new X509AuthenticationProvider();
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
|
||||
try {
|
||||
provider.afterPropertiesSet();
|
||||
|
|
|
@ -15,22 +15,20 @@
|
|||
|
||||
package org.acegisecurity.providers.x509.populator;
|
||||
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.acegisecurity.BadCredentialsException;
|
||||
import org.acegisecurity.GrantedAuthority;
|
||||
import org.acegisecurity.GrantedAuthorityImpl;
|
||||
import org.acegisecurity.providers.x509.X509TestUtils;
|
||||
import org.acegisecurity.userdetails.UserDetailsService;
|
||||
import org.acegisecurity.userdetails.User;
|
||||
import org.acegisecurity.userdetails.UserDetails;
|
||||
import org.acegisecurity.userdetails.UserDetailsService;
|
||||
import org.acegisecurity.userdetails.UsernameNotFoundException;
|
||||
|
||||
import org.springframework.context.support.StaticMessageSource;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
|
||||
/**
|
||||
* DOCUMENT ME!
|
||||
|
@ -57,7 +55,6 @@ public class DaoX509AuthoritiesPopulatorTests extends TestCase {
|
|||
public void testDefaultCNPatternMatch() throws Exception {
|
||||
X509Certificate cert = X509TestUtils.buildTestCertificate();
|
||||
DaoX509AuthoritiesPopulator populator = new DaoX509AuthoritiesPopulator();
|
||||
populator.setMessageSource(new StaticMessageSource());
|
||||
|
||||
populator.setUserDetailsService(new MockAuthenticationDaoMatchesNameOrEmail());
|
||||
populator.afterPropertiesSet();
|
||||
|
@ -67,7 +64,6 @@ public class DaoX509AuthoritiesPopulatorTests extends TestCase {
|
|||
public void testEmailPatternMatch() throws Exception {
|
||||
X509Certificate cert = X509TestUtils.buildTestCertificate();
|
||||
DaoX509AuthoritiesPopulator populator = new DaoX509AuthoritiesPopulator();
|
||||
populator.setMessageSource(new StaticMessageSource());
|
||||
|
||||
populator.setUserDetailsService(new MockAuthenticationDaoMatchesNameOrEmail());
|
||||
populator.setSubjectDNRegex("emailAddress=(.*?),");
|
||||
|
@ -77,7 +73,6 @@ public class DaoX509AuthoritiesPopulatorTests extends TestCase {
|
|||
|
||||
public void testInvalidRegexFails() throws Exception {
|
||||
DaoX509AuthoritiesPopulator populator = new DaoX509AuthoritiesPopulator();
|
||||
populator.setMessageSource(new StaticMessageSource());
|
||||
populator.setUserDetailsService(new MockAuthenticationDaoMatchesNameOrEmail());
|
||||
populator.setSubjectDNRegex("CN=(.*?,"); // missing closing bracket on group
|
||||
|
||||
|
@ -92,7 +87,6 @@ public class DaoX509AuthoritiesPopulatorTests extends TestCase {
|
|||
public void testMatchOnShoeSizeFieldInDNFails() throws Exception {
|
||||
X509Certificate cert = X509TestUtils.buildTestCertificate();
|
||||
DaoX509AuthoritiesPopulator populator = new DaoX509AuthoritiesPopulator();
|
||||
populator.setMessageSource(new StaticMessageSource());
|
||||
|
||||
populator.setUserDetailsService(new MockAuthenticationDaoMatchesNameOrEmail());
|
||||
populator.setSubjectDNRegex("shoeSize=(.*?),");
|
||||
|
@ -109,7 +103,6 @@ public class DaoX509AuthoritiesPopulatorTests extends TestCase {
|
|||
public void testPatternWithNoGroupFails() throws Exception {
|
||||
X509Certificate cert = X509TestUtils.buildTestCertificate();
|
||||
DaoX509AuthoritiesPopulator populator = new DaoX509AuthoritiesPopulator();
|
||||
populator.setMessageSource(new StaticMessageSource());
|
||||
|
||||
populator.setUserDetailsService(new MockAuthenticationDaoMatchesNameOrEmail());
|
||||
populator.setSubjectDNRegex("CN=.*?,");
|
||||
|
@ -126,7 +119,6 @@ public class DaoX509AuthoritiesPopulatorTests extends TestCase {
|
|||
|
||||
public void testRequiresDao() throws Exception {
|
||||
DaoX509AuthoritiesPopulator populator = new DaoX509AuthoritiesPopulator();
|
||||
populator.setMessageSource(new StaticMessageSource());
|
||||
|
||||
try {
|
||||
populator.afterPropertiesSet();
|
||||
|
|
|
@ -21,12 +21,9 @@ import org.acegisecurity.Authentication;
|
|||
import org.acegisecurity.BadCredentialsException;
|
||||
import org.acegisecurity.GrantedAuthority;
|
||||
import org.acegisecurity.GrantedAuthorityImpl;
|
||||
|
||||
import org.acegisecurity.providers.TestingAuthenticationToken;
|
||||
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
|
||||
|
||||
import org.springframework.context.support.StaticMessageSource;
|
||||
|
||||
|
||||
/**
|
||||
* Tests {@link RunAsImplAuthenticationProvider}.
|
||||
|
@ -59,7 +56,6 @@ public class RunAsImplAuthenticationProviderTests extends TestCase {
|
|||
"ROLE_TWO")}, UsernamePasswordAuthenticationToken.class);
|
||||
RunAsImplAuthenticationProvider provider = new RunAsImplAuthenticationProvider();
|
||||
provider.setKey("hello_world");
|
||||
provider.setMessageSource(new StaticMessageSource());
|
||||
|
||||
try {
|
||||
provider.authenticate(token);
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
package org.acegisecurity.ui.switchuser;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.acegisecurity.AccountExpiredException;
|
||||
import org.acegisecurity.Authentication;
|
||||
import org.acegisecurity.AuthenticationException;
|
||||
|
@ -25,13 +26,11 @@ import org.acegisecurity.GrantedAuthority;
|
|||
import org.acegisecurity.GrantedAuthorityImpl;
|
||||
import org.acegisecurity.context.SecurityContextHolder;
|
||||
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
|
||||
import org.acegisecurity.userdetails.UserDetailsService;
|
||||
import org.acegisecurity.userdetails.User;
|
||||
import org.acegisecurity.userdetails.UserDetails;
|
||||
import org.acegisecurity.userdetails.UserDetailsService;
|
||||
import org.acegisecurity.userdetails.UsernameNotFoundException;
|
||||
import org.acegisecurity.util.MockFilterChain;
|
||||
|
||||
import org.springframework.context.support.StaticMessageSource;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
|
@ -75,7 +74,6 @@ public class SwitchUserProcessingFilterTests extends TestCase {
|
|||
"user-that-doesnt-exist");
|
||||
|
||||
SwitchUserProcessingFilter filter = new SwitchUserProcessingFilter();
|
||||
filter.setMessageSource(new StaticMessageSource());
|
||||
filter.setUserDetailsService(new MockAuthenticationDaoUserJackLord());
|
||||
|
||||
try {
|
||||
|
@ -99,7 +97,6 @@ public class SwitchUserProcessingFilterTests extends TestCase {
|
|||
"mcgarrett");
|
||||
|
||||
SwitchUserProcessingFilter filter = new SwitchUserProcessingFilter();
|
||||
filter.setMessageSource(new StaticMessageSource());
|
||||
filter.setUserDetailsService(new MockAuthenticationDaoUserJackLord());
|
||||
|
||||
try {
|
||||
|
@ -125,7 +122,6 @@ public class SwitchUserProcessingFilterTests extends TestCase {
|
|||
"wofat");
|
||||
|
||||
SwitchUserProcessingFilter filter = new SwitchUserProcessingFilter();
|
||||
filter.setMessageSource(new StaticMessageSource());
|
||||
filter.setUserDetailsService(new MockAuthenticationDaoUserJackLord());
|
||||
|
||||
try {
|
||||
|
@ -151,7 +147,6 @@ public class SwitchUserProcessingFilterTests extends TestCase {
|
|||
"steve");
|
||||
|
||||
SwitchUserProcessingFilter filter = new SwitchUserProcessingFilter();
|
||||
filter.setMessageSource(new StaticMessageSource());
|
||||
filter.setUserDetailsService(new MockAuthenticationDaoUserJackLord());
|
||||
|
||||
try {
|
||||
|
@ -174,7 +169,6 @@ public class SwitchUserProcessingFilterTests extends TestCase {
|
|||
"jacklord");
|
||||
|
||||
SwitchUserProcessingFilter filter = new SwitchUserProcessingFilter();
|
||||
filter.setMessageSource(new StaticMessageSource());
|
||||
filter.setUserDetailsService(new MockAuthenticationDaoUserJackLord());
|
||||
|
||||
Authentication result = filter.attemptSwitchUser(request);
|
||||
|
@ -183,7 +177,6 @@ public class SwitchUserProcessingFilterTests extends TestCase {
|
|||
|
||||
public void testBadConfigMissingAuthenticationDao() {
|
||||
SwitchUserProcessingFilter filter = new SwitchUserProcessingFilter();
|
||||
filter.setMessageSource(new StaticMessageSource());
|
||||
filter.setSwitchUserUrl("/j_acegi_switch_user");
|
||||
filter.setExitUserUrl("/j_acegi_exit_user");
|
||||
filter.setTargetUrl("/main.jsp");
|
||||
|
@ -198,7 +191,6 @@ public class SwitchUserProcessingFilterTests extends TestCase {
|
|||
|
||||
public void testBadConfigMissingTargetUrl() {
|
||||
SwitchUserProcessingFilter filter = new SwitchUserProcessingFilter();
|
||||
filter.setMessageSource(new StaticMessageSource());
|
||||
filter.setUserDetailsService(new MockAuthenticationDaoUserJackLord());
|
||||
filter.setSwitchUserUrl("/j_acegi_switch_user");
|
||||
filter.setExitUserUrl("/j_acegi_exit_user");
|
||||
|
@ -214,7 +206,6 @@ public class SwitchUserProcessingFilterTests extends TestCase {
|
|||
public void testDefaultProcessesFilterUrlWithPathParameter() {
|
||||
MockHttpServletRequest request = createMockSwitchRequest();
|
||||
SwitchUserProcessingFilter filter = new SwitchUserProcessingFilter();
|
||||
filter.setMessageSource(new StaticMessageSource());
|
||||
filter.setSwitchUserUrl("/j_acegi_switch_user");
|
||||
|
||||
request.setRequestURI(
|
||||
|
@ -247,7 +238,6 @@ public class SwitchUserProcessingFilterTests extends TestCase {
|
|||
|
||||
// setup filter
|
||||
SwitchUserProcessingFilter filter = new SwitchUserProcessingFilter();
|
||||
filter.setMessageSource(new StaticMessageSource());
|
||||
filter.setUserDetailsService(new MockAuthenticationDaoUserJackLord());
|
||||
filter.setExitUserUrl("/j_acegi_exit_user");
|
||||
|
||||
|
@ -276,7 +266,6 @@ public class SwitchUserProcessingFilterTests extends TestCase {
|
|||
|
||||
// setup filter
|
||||
SwitchUserProcessingFilter filter = new SwitchUserProcessingFilter();
|
||||
filter.setMessageSource(new StaticMessageSource());
|
||||
filter.setUserDetailsService(new MockAuthenticationDaoUserJackLord());
|
||||
filter.setExitUserUrl("/j_acegi_exit_user");
|
||||
|
||||
|
@ -305,7 +294,6 @@ public class SwitchUserProcessingFilterTests extends TestCase {
|
|||
MockFilterChain chain = new MockFilterChain(true);
|
||||
|
||||
SwitchUserProcessingFilter filter = new SwitchUserProcessingFilter();
|
||||
filter.setMessageSource(new StaticMessageSource());
|
||||
filter.setSwitchUserUrl("/j_acegi_switch_user");
|
||||
filter.setTargetUrl("/webapp/someOtherUrl");
|
||||
filter.setUserDetailsService(new MockAuthenticationDaoUserJackLord());
|
||||
|
@ -355,7 +343,6 @@ public class SwitchUserProcessingFilterTests extends TestCase {
|
|||
|
||||
// setup filter
|
||||
SwitchUserProcessingFilter filter = new SwitchUserProcessingFilter();
|
||||
filter.setMessageSource(new StaticMessageSource());
|
||||
filter.setUserDetailsService(new MockAuthenticationDaoUserJackLord());
|
||||
filter.setSwitchUserUrl("/j_acegi_switch_user");
|
||||
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
|
||||
package org.acegisecurity.vote;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.acegisecurity.AccessDeniedException;
|
||||
|
@ -23,10 +26,6 @@ import org.acegisecurity.GrantedAuthority;
|
|||
import org.acegisecurity.GrantedAuthorityImpl;
|
||||
import org.acegisecurity.SecurityConfig;
|
||||
import org.acegisecurity.providers.TestingAuthenticationToken;
|
||||
import org.springframework.context.support.StaticMessageSource;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -144,7 +143,6 @@ public class AffirmativeBasedTests extends TestCase {
|
|||
|
||||
private AffirmativeBased makeDecisionManager() {
|
||||
AffirmativeBased decisionManager = new AffirmativeBased();
|
||||
decisionManager.setMessageSource(new StaticMessageSource());
|
||||
RoleVoter roleVoter = new RoleVoter();
|
||||
DenyVoter denyForSureVoter = new DenyVoter();
|
||||
DenyAgainVoter denyAgainForSureVoter = new DenyAgainVoter();
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
|
||||
package org.acegisecurity.vote;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.acegisecurity.AccessDeniedException;
|
||||
|
@ -23,10 +26,6 @@ import org.acegisecurity.GrantedAuthority;
|
|||
import org.acegisecurity.GrantedAuthorityImpl;
|
||||
import org.acegisecurity.SecurityConfig;
|
||||
import org.acegisecurity.providers.TestingAuthenticationToken;
|
||||
import org.springframework.context.support.StaticMessageSource;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -165,7 +164,6 @@ public class ConsensusBasedTests extends TestCase {
|
|||
|
||||
private ConsensusBased makeDecisionManager() {
|
||||
ConsensusBased decisionManager = new ConsensusBased();
|
||||
decisionManager.setMessageSource(new StaticMessageSource());
|
||||
RoleVoter roleVoter = new RoleVoter();
|
||||
DenyVoter denyForSureVoter = new DenyVoter();
|
||||
DenyAgainVoter denyAgainForSureVoter = new DenyAgainVoter();
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
|
||||
package org.acegisecurity.vote;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.acegisecurity.AccessDeniedException;
|
||||
|
@ -23,10 +26,6 @@ import org.acegisecurity.GrantedAuthority;
|
|||
import org.acegisecurity.GrantedAuthorityImpl;
|
||||
import org.acegisecurity.SecurityConfig;
|
||||
import org.acegisecurity.providers.TestingAuthenticationToken;
|
||||
import org.springframework.context.support.StaticMessageSource;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -60,7 +59,6 @@ public class UnanimousBasedTests extends TestCase {
|
|||
throws Exception {
|
||||
TestingAuthenticationToken auth = makeTestToken();
|
||||
UnanimousBased mgr = makeDecisionManager();
|
||||
mgr.setMessageSource(new StaticMessageSource());
|
||||
|
||||
ConfigAttributeDefinition config = new ConfigAttributeDefinition();
|
||||
config.addConfigAttribute(new SecurityConfig("ROLE_1")); // grant
|
||||
|
@ -78,7 +76,6 @@ public class UnanimousBasedTests extends TestCase {
|
|||
throws Exception {
|
||||
TestingAuthenticationToken auth = makeTestToken();
|
||||
UnanimousBased mgr = makeDecisionManager();
|
||||
mgr.setMessageSource(new StaticMessageSource());
|
||||
|
||||
ConfigAttributeDefinition config = new ConfigAttributeDefinition();
|
||||
config.addConfigAttribute(new SecurityConfig("ROLE_2")); // grant
|
||||
|
@ -91,7 +88,6 @@ public class UnanimousBasedTests extends TestCase {
|
|||
throws Exception {
|
||||
TestingAuthenticationToken auth = makeTestToken();
|
||||
UnanimousBased mgr = makeDecisionManager();
|
||||
mgr.setMessageSource(new StaticMessageSource());
|
||||
|
||||
ConfigAttributeDefinition config = new ConfigAttributeDefinition();
|
||||
config.addConfigAttribute(new SecurityConfig("ROLE_WE_DO_NOT_HAVE")); // deny
|
||||
|
@ -107,7 +103,6 @@ public class UnanimousBasedTests extends TestCase {
|
|||
public void testRoleVoterPrefixObserved() throws Exception {
|
||||
TestingAuthenticationToken auth = makeTestTokenWithFooBarPrefix();
|
||||
UnanimousBased mgr = makeDecisionManagerWithFooBarPrefix();
|
||||
mgr.setMessageSource(new StaticMessageSource());
|
||||
|
||||
ConfigAttributeDefinition config = new ConfigAttributeDefinition();
|
||||
config.addConfigAttribute(new SecurityConfig("FOOBAR_1")); // grant
|
||||
|
@ -121,7 +116,6 @@ public class UnanimousBasedTests extends TestCase {
|
|||
throws Exception {
|
||||
TestingAuthenticationToken auth = makeTestToken();
|
||||
UnanimousBased mgr = makeDecisionManager();
|
||||
mgr.setMessageSource(new StaticMessageSource());
|
||||
|
||||
assertTrue(!mgr.isAllowIfAllAbstainDecisions()); // check default
|
||||
|
||||
|
@ -141,7 +135,6 @@ public class UnanimousBasedTests extends TestCase {
|
|||
TestingAuthenticationToken auth = makeTestToken();
|
||||
UnanimousBased mgr = makeDecisionManager();
|
||||
mgr.setAllowIfAllAbstainDecisions(true);
|
||||
mgr.setMessageSource(new StaticMessageSource());
|
||||
assertTrue(mgr.isAllowIfAllAbstainDecisions()); // check changed
|
||||
|
||||
ConfigAttributeDefinition config = new ConfigAttributeDefinition();
|
||||
|
@ -155,7 +148,6 @@ public class UnanimousBasedTests extends TestCase {
|
|||
throws Exception {
|
||||
TestingAuthenticationToken auth = makeTestToken();
|
||||
UnanimousBased mgr = makeDecisionManager();
|
||||
mgr.setMessageSource(new StaticMessageSource());
|
||||
|
||||
ConfigAttributeDefinition config = new ConfigAttributeDefinition();
|
||||
config.addConfigAttribute(new SecurityConfig("ROLE_1")); // grant
|
||||
|
@ -167,7 +159,6 @@ public class UnanimousBasedTests extends TestCase {
|
|||
|
||||
private UnanimousBased makeDecisionManager() {
|
||||
UnanimousBased decisionManager = new UnanimousBased();
|
||||
decisionManager.setMessageSource(new StaticMessageSource());
|
||||
RoleVoter roleVoter = new RoleVoter();
|
||||
DenyVoter denyForSureVoter = new DenyVoter();
|
||||
DenyAgainVoter denyAgainForSureVoter = new DenyAgainVoter();
|
||||
|
@ -182,7 +173,6 @@ public class UnanimousBasedTests extends TestCase {
|
|||
|
||||
private UnanimousBased makeDecisionManagerWithFooBarPrefix() {
|
||||
UnanimousBased decisionManager = new UnanimousBased();
|
||||
decisionManager.setMessageSource(new StaticMessageSource());
|
||||
RoleVoter roleVoter = new RoleVoter();
|
||||
roleVoter.setRolePrefix("FOOBAR_");
|
||||
|
||||
|
|
Loading…
Reference in New Issue