format code
git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1311024 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
80f7784e60
commit
67059a5bb8
|
@ -21,7 +21,8 @@ package org.codehaus.redback.jsecurity;
|
|||
|
||||
import org.jsecurity.authc.AuthenticationException;
|
||||
|
||||
public class PrincipalLockedException extends AuthenticationException
|
||||
public class PrincipalLockedException
|
||||
extends AuthenticationException
|
||||
{
|
||||
public PrincipalLockedException( String message, Throwable cause )
|
||||
{
|
||||
|
|
|
@ -21,7 +21,8 @@ package org.codehaus.redback.jsecurity;
|
|||
|
||||
import org.jsecurity.authc.AuthenticationException;
|
||||
|
||||
public class PrincipalPasswordChangeRequiredException extends AuthenticationException
|
||||
public class PrincipalPasswordChangeRequiredException
|
||||
extends AuthenticationException
|
||||
{
|
||||
public PrincipalPasswordChangeRequiredException( String message, Throwable cause )
|
||||
{
|
||||
|
|
|
@ -19,19 +19,15 @@ package org.codehaus.redback.jsecurity;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.archiva.redback.policy.AccountLockedException;
|
||||
import org.apache.archiva.redback.policy.UserSecurityPolicy;
|
||||
import org.apache.archiva.redback.rbac.Permission;
|
||||
import org.apache.archiva.redback.rbac.UserAssignment;
|
||||
import org.apache.archiva.redback.users.User;
|
||||
import org.apache.archiva.redback.users.UserNotFoundException;
|
||||
import org.apache.archiva.redback.rbac.RBACManager;
|
||||
import org.apache.archiva.redback.rbac.RbacManagerException;
|
||||
import org.apache.archiva.redback.rbac.UserAssignment;
|
||||
import org.apache.archiva.redback.users.User;
|
||||
import org.apache.archiva.redback.users.UserManager;
|
||||
import org.apache.archiva.redback.users.UserNotFoundException;
|
||||
import org.jsecurity.authc.AuthenticationException;
|
||||
import org.jsecurity.authc.AuthenticationInfo;
|
||||
import org.jsecurity.authc.AuthenticationToken;
|
||||
|
@ -45,7 +41,12 @@ import org.jsecurity.subject.PrincipalCollection;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class RedbackRealm extends AuthorizingRealm
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
public class RedbackRealm
|
||||
extends AuthorizingRealm
|
||||
{
|
||||
private Logger log = LoggerFactory.getLogger( RedbackRealm.class );
|
||||
|
||||
|
@ -125,7 +126,8 @@ public class RedbackRealm extends AuthorizingRealm
|
|||
|
||||
if ( user.isPasswordChangeRequired() )
|
||||
{
|
||||
throw new PrincipalPasswordChangeRequiredException("Password change is required for user " + user.getPrincipal());
|
||||
throw new PrincipalPasswordChangeRequiredException(
|
||||
"Password change is required for user " + user.getPrincipal() );
|
||||
}
|
||||
|
||||
return new RedbackAuthenticationInfo( user, getName() );
|
||||
|
@ -139,7 +141,8 @@ public class RedbackRealm extends AuthorizingRealm
|
|||
public boolean doCredentialsMatch( AuthenticationToken token, AuthenticationInfo info )
|
||||
{
|
||||
final String credentials = new String( (char[]) token.getCredentials() );
|
||||
final boolean match = securityPolicy.getPasswordEncoder().encodePassword(credentials).equals((String)info.getCredentials());
|
||||
final boolean match = securityPolicy.getPasswordEncoder().encodePassword( credentials ).equals(
|
||||
(String) info.getCredentials() );
|
||||
if ( !match )
|
||||
{
|
||||
User user = ( (RedbackAuthenticationInfo) info ).getUser();
|
||||
|
@ -168,7 +171,8 @@ public class RedbackRealm extends AuthorizingRealm
|
|||
};
|
||||
}
|
||||
|
||||
final class RedbackAuthenticationInfo extends SimpleAuthenticationInfo
|
||||
final class RedbackAuthenticationInfo
|
||||
extends SimpleAuthenticationInfo
|
||||
{
|
||||
private final User user;
|
||||
|
||||
|
|
|
@ -21,13 +21,13 @@ package org.codehaus.redback.jsecurity;
|
|||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.archiva.redback.policy.UserSecurityPolicy;
|
||||
import org.apache.archiva.redback.rbac.Role;
|
||||
import org.apache.archiva.redback.users.User;
|
||||
import org.apache.archiva.redback.rbac.Operation;
|
||||
import org.apache.archiva.redback.rbac.Permission;
|
||||
import org.apache.archiva.redback.rbac.RBACManager;
|
||||
import org.apache.archiva.redback.rbac.Resource;
|
||||
import org.apache.archiva.redback.rbac.Role;
|
||||
import org.apache.archiva.redback.rbac.UserAssignment;
|
||||
import org.apache.archiva.redback.users.User;
|
||||
import org.apache.archiva.redback.users.UserManager;
|
||||
import org.jsecurity.authc.IncorrectCredentialsException;
|
||||
import org.jsecurity.authc.UsernamePasswordToken;
|
||||
|
@ -75,8 +75,6 @@ public class RedbackRealmTest
|
|||
super.setUp();
|
||||
securityManager = new DefaultSecurityManager();
|
||||
|
||||
|
||||
|
||||
realm = new RedbackRealm( userManager, rbacManager, userSecurityPolicy );
|
||||
securityManager.setRealm( realm );
|
||||
|
||||
|
|
Loading…
Reference in New Issue