From d7d53864f610211a1591d056ccf8e7295438e4a6 Mon Sep 17 00:00:00 2001 From: Rafael Guterres Date: Fri, 6 Nov 2015 01:06:59 -0200 Subject: Fix checkstyle --- src/org/traccar/helper/Authorization.java | 6 +++--- src/org/traccar/web/BaseServlet.java | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/org/traccar/helper/Authorization.java b/src/org/traccar/helper/Authorization.java index 0dc27fe5d..fc34687cd 100644 --- a/src/org/traccar/helper/Authorization.java +++ b/src/org/traccar/helper/Authorization.java @@ -24,10 +24,10 @@ import org.jboss.netty.handler.codec.base64.Base64; import org.jboss.netty.util.CharsetUtil; public final class Authorization { - + private Authorization() { } - + public static final String HEADER = "Authorization"; public static final String SCHEME = "Basic"; public static final String REGEX = SCHEME + " "; @@ -39,7 +39,7 @@ public final class Authorization { public static Map parse(String authorization) { Map authMap = new HashMap<>(); final String encodedUsernameAndPassword = authorization.replaceFirst(REGEX, REPLACEMENT); - ChannelBuffer buffer = ChannelBuffers.copiedBuffer(encodedUsernameAndPassword,CharsetUtil.UTF_8); + 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()); diff --git a/src/org/traccar/web/BaseServlet.java b/src/org/traccar/web/BaseServlet.java index a77ad0908..039e3a1f4 100644 --- a/src/org/traccar/web/BaseServlet.java +++ b/src/org/traccar/web/BaseServlet.java @@ -65,7 +65,9 @@ public abstract class BaseServlet extends HttpServlet { String authorization = req.getHeader(Authorization.HEADER); if (authorization != null && !authorization.isEmpty()) { Map authMap = Authorization.parse(authorization); - User user = Context.getDataManager().login(authMap.get(Authorization.USERNAME), authMap.get(Authorization.PASSWORD)); + String username = authMap.get(Authorization.USERNAME); + String password = authMap.get(Authorization.PASSWORD); + User user = Context.getDataManager().login(username, password); if (user != null) { return user.getId(); } -- cgit v1.2.3