diff options
author | Kevin Goos <kevingoos@telenet.be> | 2018-03-16 13:35:11 +0100 |
---|---|---|
committer | Kevin Goos <kevingoos@telenet.be> | 2018-03-16 13:35:11 +0100 |
commit | 3b7c9c56e198ce213d3e113a2fbc4148b5d85558 (patch) | |
tree | a04b64fc484c6832b8f023412db020e3e5e9a657 /src/org/traccar/api | |
parent | b34cf25b5ac1f178d783a512d3b95faed4bdb010 (diff) | |
parent | 25a36fe2fb8045e455de5e936c286c4db8b40563 (diff) | |
download | trackermap-server-3b7c9c56e198ce213d3e113a2fbc4148b5d85558.tar.gz trackermap-server-3b7c9c56e198ce213d3e113a2fbc4148b5d85558.tar.bz2 trackermap-server-3b7c9c56e198ce213d3e113a2fbc4148b5d85558.zip |
Merge branch 'master' of https://github.com/kevingoos/traccar
Diffstat (limited to 'src/org/traccar/api')
-rw-r--r-- | src/org/traccar/api/MediaFilter.java | 2 | ||||
-rw-r--r-- | src/org/traccar/api/SecurityRequestFilter.java | 4 | ||||
-rw-r--r-- | src/org/traccar/api/resource/SessionResource.java | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/org/traccar/api/MediaFilter.java b/src/org/traccar/api/MediaFilter.java index 4685ce05b..25e242b01 100644 --- a/src/org/traccar/api/MediaFilter.java +++ b/src/org/traccar/api/MediaFilter.java @@ -43,7 +43,7 @@ public class MediaFilter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { - HttpServletResponse httpResponse = ((HttpServletResponse) response); + HttpServletResponse httpResponse = (HttpServletResponse) response; try { HttpSession session = ((HttpServletRequest) request).getSession(false); Long userId = null; diff --git a/src/org/traccar/api/SecurityRequestFilter.java b/src/org/traccar/api/SecurityRequestFilter.java index 7024bdbc9..aace9f705 100644 --- a/src/org/traccar/api/SecurityRequestFilter.java +++ b/src/org/traccar/api/SecurityRequestFilter.java @@ -17,6 +17,7 @@ package org.traccar.api; import org.traccar.Context; import org.traccar.api.resource.SessionResource; +import org.traccar.helper.DataConverter; import org.traccar.helper.Log; import org.traccar.model.User; @@ -28,7 +29,6 @@ import javax.ws.rs.container.ContainerRequestFilter; import javax.ws.rs.container.ResourceInfo; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; -import javax.xml.bind.DatatypeConverter; import java.lang.reflect.Method; import java.nio.charset.StandardCharsets; import java.sql.SQLException; @@ -43,7 +43,7 @@ public class SecurityRequestFilter implements ContainerRequestFilter { public static String[] decodeBasicAuth(String auth) { auth = auth.replaceFirst("[B|b]asic ", ""); - byte[] decodedBytes = DatatypeConverter.parseBase64Binary(auth); + byte[] decodedBytes = DataConverter.parseBase64(auth); if (decodedBytes != null && decodedBytes.length > 0) { return new String(decodedBytes, StandardCharsets.US_ASCII).split(":", 2); } diff --git a/src/org/traccar/api/resource/SessionResource.java b/src/org/traccar/api/resource/SessionResource.java index 2a0bd4364..fd331c766 100644 --- a/src/org/traccar/api/resource/SessionResource.java +++ b/src/org/traccar/api/resource/SessionResource.java @@ -17,6 +17,7 @@ package org.traccar.api.resource; import org.traccar.Context; import org.traccar.api.BaseResource; +import org.traccar.helper.DataConverter; import org.traccar.helper.LogAction; import org.traccar.model.User; @@ -34,7 +35,6 @@ import javax.ws.rs.QueryParam; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import javax.xml.bind.DatatypeConverter; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; @@ -63,11 +63,11 @@ public class SessionResource extends BaseResource { if (cookies != null) { for (Cookie cookie : cookies) { if (cookie.getName().equals(USER_COOKIE_KEY)) { - byte[] emailBytes = DatatypeConverter.parseBase64Binary( + byte[] emailBytes = DataConverter.parseBase64( URLDecoder.decode(cookie.getValue(), StandardCharsets.US_ASCII.name())); email = new String(emailBytes, StandardCharsets.UTF_8); } else if (cookie.getName().equals(PASS_COOKIE_KEY)) { - byte[] passwordBytes = DatatypeConverter.parseBase64Binary( + byte[] passwordBytes = DataConverter.parseBase64( URLDecoder.decode(cookie.getValue(), StandardCharsets.US_ASCII.name())); password = new String(passwordBytes, StandardCharsets.UTF_8); } |