瀏覽代碼

SEC-1857: Use Principal.getName() in ContextPropagatingRemoteInvocation

This is a better option than using the toString() method 
where the latter doesn't return the username. e.g when the
principal is a UserDetails.
Luke Taylor 13 年之前
父節點
當前提交
9fa6e78770

+ 1 - 1
remoting/src/main/java/org/springframework/security/remoting/rmi/ContextPropagatingRemoteInvocation.java

@@ -65,7 +65,7 @@ public class ContextPropagatingRemoteInvocation extends RemoteInvocation {
         Authentication currentUser = SecurityContextHolder.getContext().getAuthentication();
 
         if (currentUser != null) {
-            principal = currentUser.getPrincipal().toString();
+            principal = currentUser.getName();
             credentials = currentUser.getCredentials().toString();
         } else {
             principal = credentials = null;