diff options
Diffstat (limited to 'src/java/com/juick/api/Utils.java')
-rw-r--r-- | src/java/com/juick/api/Utils.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/java/com/juick/api/Utils.java b/src/java/com/juick/api/Utils.java index cac5612d..b406c362 100644 --- a/src/java/com/juick/api/Utils.java +++ b/src/java/com/juick/api/Utils.java @@ -70,8 +70,8 @@ public class Utils { } public static int getHttpAuthUID(Connection sql, HttpServletRequest request) { - String auth = request.getHeader("HTTP_AUTHORIZATION"); - if (auth != null && auth.length() > 8) { + String auth = request.getHeader("Authorization"); + if (auth != null && auth.length() > 8 && auth.startsWith("Basic ")) { try { BASE64Decoder dec = new BASE64Decoder(); String loginpassw[] = new String(dec.decodeBuffer(auth.substring(6))).split(":", 2); @@ -84,6 +84,14 @@ public class Utils { return 0; } + public static int getVisitorQueryStringUID(Connection sql, HttpServletRequest request) { + String hash = request.getParameter("hash"); + if (hash != null && hash.length() == 16) { + return com.juick.server.UserQueries.getUIDbyHash(sql, hash); + } + return 0; + } + public static void sendPermanentRedirect(HttpServletResponse response, String location) { response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); response.setHeader("Location", location); |