Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)

96479: Merged 5.0.N (5.0.2) to HEAD-BUG-FIX (5.1/Cloud)
      96424: Merged V4.2-BUG-FIX (4.2.5) to 5.0.N (5.0.2)
         96414: Merged V4.1-BUG-FIX (4.1.10) to V4.2-BUG-FIX (4.2.5)
            96401: Merged DEV to V4.1-BUG-FIX 
             96343 : MNT-11041 : Share SSOAuthenticationFilter and non-ascii username strings
              'userHeader' for alfrescoHeader connector is detected to apply userName base64 encoded (support non-ASCII symbols) or not.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@96508 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-02-07 10:33:50 +00:00
parent b732ec7175
commit cadf017c30

View File

@@ -18,6 +18,7 @@
*/ */
package org.alfresco.repo.security.authentication.external; package org.alfresco.repo.security.authentication.external;
import java.io.UnsupportedEncodingException;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@@ -219,6 +220,21 @@ public class DefaultRemoteUserMapper implements RemoteUserMapper, ActivateableBe
{ {
return null; return null;
} }
// MNT-11041 Share SSOAuthenticationFilter and non-ascii username strings
boolean isEncode = Boolean.valueOf(request.getHeader("Remote-User-Encode"));
if (userId != null && isEncode)
{
try
{
userId = new String(org.apache.commons.codec.binary.Base64.decodeBase64(userId), "UTF-8");
}
catch (UnsupportedEncodingException e)
{
//TODO
}
}
if (this.userIdPattern == null) if (this.userIdPattern == null)
{ {
userId = userId.trim(); userId = userId.trim();