Merged V2.1 to HEAD

6386: Fix for AR-1649
   6387: Fix for AR-1645
   6388: Updated Polish messages
   6389: Updated security providers
   6392: Add support to log in as guest with any password (if guest is allowed)
   6393: AR-1562 : Cannot directly exit/disable Alfresco JavaScript Debugger window
   6394: Allow creation of PropertyValue persisted properties without knowing the type QName
   6397: Log Serializable properties don't cause infinte waits
   6398: Build fix and tidy up for authentication chaining
            Resolved conflicted state of 'root\projects\repository\source\java\org\alfresco\repo\security\authentication\AuthenticationUtil.java'
   6402: AR-1643 Web Script args object does not handle multi-value arguments
   6407: Removed use of QName "{}silly" as a data type definition.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6728 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-09-10 15:41:43 +00:00
parent 1050a3cb98
commit a3ddf17f8e
16 changed files with 253 additions and 153 deletions

View File

@@ -140,30 +140,38 @@ public abstract class AuthenticationUtil
*/
public static Authentication setCurrentAuthentication(Authentication authentication)
{
Context context = ContextHolder.getContext();
SecureContext sc = null;
if ((context == null) || !(context instanceof SecureContext))
if (authentication == null)
{
sc = new SecureContextImpl();
ContextHolder.setContext(sc);
clearCurrentSecurityContext();
return null;
}
else
{
sc = (SecureContext) context;
}
authentication.setAuthenticated(true);
sc.setAuthentication(authentication);
Context context = ContextHolder.getContext();
SecureContext sc = null;
if ((context == null) || !(context instanceof SecureContext))
{
sc = new SecureContextImpl();
ContextHolder.setContext(sc);
}
else
{
sc = (SecureContext) context;
}
authentication.setAuthenticated(true);
sc.setAuthentication(authentication);
// Support for logging tenant domain / username (via log4j NDC)
String userName = SYSTEM_USER_NAME;
if (authentication.getPrincipal() instanceof UserDetails)
{
userName = ((UserDetails) authentication.getPrincipal()).getUsername();
// Support for logging tenant domain / username (via log4j NDC)
String userName = SYSTEM_USER_NAME;
if (authentication.getPrincipal() instanceof UserDetails)
{
userName = ((UserDetails) authentication.getPrincipal()).getUsername();
}
logNDC(userName);
return authentication;
}
logNDC(userName);
return authentication;
}
public static void logNDC(String userName)