SEC-1010: Moved TestingAuthenticationProvider and token to main core src tree and updated poms to match
This commit is contained in:
+4
-7
@@ -22,8 +22,9 @@ import org.springframework.security.AuthenticationException;
|
||||
/**
|
||||
* An {@link AuthenticationProvider} implementation for the {@link TestingAuthenticationToken}.<p>It simply
|
||||
* accepts as valid whatever is contained within the <code>TestingAuthenticationToken</code>.</p>
|
||||
* <p>The purpose of this implementation is to facilitate unit testing. This provider should <B>never be enabled
|
||||
* on a production system</b>.</p>
|
||||
* <p>
|
||||
* The purpose of this implementation is to facilitate unit testing. This provider should <b>never be enabled
|
||||
* on a production system</b>.
|
||||
*
|
||||
* @author Ben Alex
|
||||
* @version $Id$
|
||||
@@ -37,10 +38,6 @@ public class TestingAuthenticationProvider implements AuthenticationProvider {
|
||||
}
|
||||
|
||||
public boolean supports(Class authentication) {
|
||||
if (TestingAuthenticationToken.class.isAssignableFrom(authentication)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return TestingAuthenticationToken.class.isAssignableFrom(authentication);
|
||||
}
|
||||
}
|
||||
+9
-8
@@ -20,8 +20,9 @@ import org.springframework.security.util.AuthorityUtils;
|
||||
|
||||
|
||||
/**
|
||||
* An {@link org.springframework.security.Authentication} implementation that is designed for use whilst unit testing.<p>The
|
||||
* corresponding authentication provider is {@link TestingAuthenticationProvider}.</p>
|
||||
* An {@link org.springframework.security.Authentication} implementation that is designed for use whilst unit testing.
|
||||
* <p>
|
||||
* The corresponding authentication provider is {@link TestingAuthenticationProvider}.
|
||||
*
|
||||
* @author Ben Alex
|
||||
* @version $Id$
|
||||
@@ -36,15 +37,15 @@ public class TestingAuthenticationToken extends AbstractAuthenticationToken {
|
||||
//~ Constructors ===================================================================================================
|
||||
|
||||
public TestingAuthenticationToken(Object principal, Object credentials) {
|
||||
super(null);
|
||||
super(null);
|
||||
this.principal = principal;
|
||||
this.credentials = credentials;
|
||||
}
|
||||
this.credentials = credentials;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public TestingAuthenticationToken(Object principal, Object credentials, String... authorities) {
|
||||
this(principal, credentials, AuthorityUtils.stringArrayToAuthorityArray(authorities));
|
||||
}
|
||||
this(principal, credentials, AuthorityUtils.stringArrayToAuthorityArray(authorities));
|
||||
}
|
||||
|
||||
public TestingAuthenticationToken(Object principal, Object credentials, GrantedAuthority[] authorities) {
|
||||
super(authorities);
|
||||
Reference in New Issue
Block a user