aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/helper/Authorization.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/org/traccar/helper/Authorization.java b/src/org/traccar/helper/Authorization.java
index 992254d04..0dc27fe5d 100644
--- a/src/org/traccar/helper/Authorization.java
+++ b/src/org/traccar/helper/Authorization.java
@@ -15,10 +15,13 @@
*/
package org.traccar.helper;
-import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.jboss.netty.handler.codec.base64.Base64;
+import org.jboss.netty.util.CharsetUtil;
public final class Authorization {
@@ -36,7 +39,8 @@ public final class Authorization {
public static Map<String, String> parse(String authorization) {
Map<String, String> authMap = new HashMap<>();
final String encodedUsernameAndPassword = authorization.replaceFirst(REGEX, REPLACEMENT);
- String usernameAndPassword = new String(Base64.getDecoder().decode(encodedUsernameAndPassword));
+ ChannelBuffer buffer = ChannelBuffers.copiedBuffer(encodedUsernameAndPassword,CharsetUtil.UTF_8);
+ String usernameAndPassword = Base64.decode(buffer).toString(CharsetUtil.UTF_8);
final StringTokenizer tokenizer = new StringTokenizer(usernameAndPassword, TOKENIZER);
authMap.put(USERNAME, tokenizer.nextToken());
authMap.put(PASSWORD, tokenizer.nextToken());