Author: olamy
Date: Tue Jan 15 15:43:09 2013
New Revision: 1433464

URL: http://svn.apache.org/viewvc?rev=1433464&view=rev
Log:
use getUsername rather than getPrincipal

Modified:
    
archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaUserManagerAuthenticator.java
    
archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java
    
archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/BypassSecuritySystem.java

Modified: 
archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaUserManagerAuthenticator.java
URL: 
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaUserManagerAuthenticator.java?rev=1433464&r1=1433463&r2=1433464&view=diff
==============================================================================
--- 
archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaUserManagerAuthenticator.java
 (original)
+++ 
archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaUserManagerAuthenticator.java
 Tue Jan 15 15:43:09 2013
@@ -106,14 +106,14 @@ public class ArchivaUserManagerAuthentic
             try
             {
                 log.debug( "Authenticate: {} with userManager: {}", source, 
userManager.getId() );
-                User user = userManager.findUser( source.getPrincipal() );
+                User user = userManager.findUser( source.getUsername() );
                 username = user.getUsername();
 
                 if ( user.isLocked() )
                 {
-                    //throw new AccountLockedException( "Account " + 
source.getPrincipal() + " is locked.", user );
+                    //throw new AccountLockedException( "Account " + 
source.getUsername() + " is locked.", user );
                     AccountLockedException e =
-                        new AccountLockedException( "Account " + 
source.getPrincipal() + " is locked.", user );
+                        new AccountLockedException( "Account " + 
source.getUsername() + " is locked.", user );
                     log.warn( "{}", e.getMessage() );
                     resultException = e;
                     authnResultErrors.add(
@@ -138,7 +138,7 @@ public class ArchivaUserManagerAuthentic
                 boolean isPasswordValid = encoder.isPasswordValid( 
user.getEncodedPassword(), source.getPassword() );
                 if ( isPasswordValid )
                 {
-                    log.debug( "User {} provided a valid password", 
source.getPrincipal() );
+                    log.debug( "User {} provided a valid password", 
source.getUsername() );
 
                     try
                     {
@@ -156,7 +156,7 @@ public class ArchivaUserManagerAuthentic
                             }
                         }
 
-                        return new AuthenticationResult( true, 
source.getPrincipal(), null );
+                        return new AuthenticationResult( true, 
source.getUsername(), null );
                     }
                     catch ( MustChangePasswordException e )
                     {
@@ -169,11 +169,11 @@ public class ArchivaUserManagerAuthentic
                 }
                 else
                 {
-                    log.warn( "Password is Invalid for user {} and userManager 
'{}'.", source.getPrincipal(),
+                    log.warn( "Password is Invalid for user {} and userManager 
'{}'.", source.getUsername(),
                               userManager.getId() );
                     authnResultErrors.add( new AuthenticationFailureCause( 
AuthenticationConstants.AUTHN_NO_SUCH_USER,
                                                                            
"Password is Invalid for user "
-                                                                               
+ source.getPrincipal() + "." ) );
+                                                                               
+ source.getUsername() + "." ) );
 
                     try
                     {
@@ -189,23 +189,23 @@ public class ArchivaUserManagerAuthentic
                         }
                     }
 
-                    //return new AuthenticationResult( false, 
source.getPrincipal(), null, authnResultExceptionsMap );
+                    //return new AuthenticationResult( false, 
source.getUsername(), null, authnResultExceptionsMap );
                 }
             }
             catch ( UserNotFoundException e )
             {
-                log.warn( "Login for user {} failed. user not found.", 
source.getPrincipal() );
+                log.warn( "Login for user {} failed. user not found.", 
source.getUsername() );
                 resultException = e;
                 authnResultErrors.add( new AuthenticationFailureCause( 
AuthenticationConstants.AUTHN_NO_SUCH_USER,
-                                                                       "Login 
for user " + source.getPrincipal()
+                                                                       "Login 
for user " + source.getUsername()
                                                                            + " 
failed. user not found." ) );
             }
             catch ( UserManagerException e )
             {
-                log.warn( "Login for user {} failed, message: {}", 
source.getPrincipal(), e.getMessage() );
+                log.warn( "Login for user {} failed, message: {}", 
source.getUsername(), e.getMessage() );
                 resultException = e;
                 authnResultErrors.add( new AuthenticationFailureCause( 
AuthenticationConstants.AUTHN_RUNTIME_EXCEPTION,
-                                                                       "Login 
for user " + source.getPrincipal()
+                                                                       "Login 
for user " + source.getUsername()
                                                                            + " 
failed, message: " + e.getMessage() ) );
             }
         }

Modified: 
archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java
URL: 
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java?rev=1433464&r1=1433463&r2=1433464&view=diff
==============================================================================
--- 
archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java
 (original)
+++ 
archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java
 Tue Jan 15 15:43:09 2013
@@ -68,19 +68,19 @@ public class SecuritySystemStub
         AuthenticationResult result = null;
         SecuritySession session = null;
 
-        if ( users.get( source.getPrincipal() ) != null )
+        if ( users.get( source.getUsername() ) != null )
         {
-            result = new AuthenticationResult( true, source.getPrincipal(), 
null );
+            result = new AuthenticationResult( true, source.getUsername(), 
null );
 
             User user = new JdoUser();
-            user.setUsername( source.getPrincipal() );
-            user.setPassword( users.get( source.getPrincipal() ) );
+            user.setUsername( source.getUsername() );
+            user.setPassword( users.get( source.getUsername() ) );
 
             session = new DefaultSecuritySession( result, user );
         }
         else
         {
-            result = new AuthenticationResult( false, source.getPrincipal(), 
null );
+            result = new AuthenticationResult( false, source.getUsername(), 
null );
             session = new DefaultSecuritySession( result );
         }
         return session;

Modified: 
archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/BypassSecuritySystem.java
URL: 
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/BypassSecuritySystem.java?rev=1433464&r1=1433463&r2=1433464&view=diff
==============================================================================
--- 
archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/BypassSecuritySystem.java
 (original)
+++ 
archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/BypassSecuritySystem.java
 Tue Jan 15 15:43:09 2013
@@ -63,7 +63,7 @@ public class BypassSecuritySystem
     public SecuritySession authenticate( AuthenticationDataSource source )
         throws AuthenticationException, UserNotFoundException, 
AccountLockedException
     {
-        AuthenticationResult result = new AuthenticationResult( true, 
source.getPrincipal(), null );
+        AuthenticationResult result = new AuthenticationResult( true, 
source.getUsername(), null );
         return new DefaultSecuritySession( result );
     }
 


Reply via email to