diff options
author | Rafael Guterres <guterresrafael@gmail.com> | 2015-11-05 22:39:00 -0200 |
---|---|---|
committer | Rafael Guterres <guterresrafael@gmail.com> | 2015-11-05 22:39:00 -0200 |
commit | 6214776d2ff4c10de27add89d5de0be8999da146 (patch) | |
tree | d97120eb13a75067d0059a56a07182cf3ae89a42 /src/org | |
parent | 2490884fd74e20b69e5913533be77fc057731a47 (diff) | |
download | trackermap-server-6214776d2ff4c10de27add89d5de0be8999da146.tar.gz trackermap-server-6214776d2ff4c10de27add89d5de0be8999da146.tar.bz2 trackermap-server-6214776d2ff4c10de27add89d5de0be8999da146.zip |
Change class Base64 to support current java
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/traccar/helper/Authorization.java | 8 |
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()); |