From b56ceb875ea1c2077f4fcb542bffab271fd6e415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20B=C3=BChner?= Date: Wed, 15 Jul 2015 12:33:59 +0200 Subject: [PATCH 1/2] Fix a bug in the auth filter The jsonGenerator has to be closed before the writer object. Otherwise no JSON will be returned when logging in. --- .../terrestris/shogun/security/ShogunAuthProcessingFilter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/terrestris/shogun/security/ShogunAuthProcessingFilter.java b/src/main/java/de/terrestris/shogun/security/ShogunAuthProcessingFilter.java index 1efbaaf2..211cc24b 100644 --- a/src/main/java/de/terrestris/shogun/security/ShogunAuthProcessingFilter.java +++ b/src/main/java/de/terrestris/shogun/security/ShogunAuthProcessingFilter.java @@ -109,8 +109,8 @@ public void sendRedirect(HttpServletRequest httpServletRequest, } catch (IOException e) { throw e; } finally { - IOUtils.closeQuietly(out); IOUtils.closeQuietly(jsonGenerator); + IOUtils.closeQuietly(out); } } From ee4c3b9490561da4fcb484495cca9d4d254a02cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20B=C3=BChner?= Date: Wed, 15 Jul 2015 14:09:18 +0200 Subject: [PATCH 2/2] Set content type of login response --- .../terrestris/shogun/security/ShogunAuthProcessingFilter.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/de/terrestris/shogun/security/ShogunAuthProcessingFilter.java b/src/main/java/de/terrestris/shogun/security/ShogunAuthProcessingFilter.java index 211cc24b..5aba266a 100644 --- a/src/main/java/de/terrestris/shogun/security/ShogunAuthProcessingFilter.java +++ b/src/main/java/de/terrestris/shogun/security/ShogunAuthProcessingFilter.java @@ -89,6 +89,9 @@ public void sendRedirect(HttpServletRequest httpServletRequest, }); super.successfulAuthentication(request, response, authResult); + // set content type + response.setContentType("application/json;charset=UTF-8"); + // build a comma separated string of the ROLES String authorityText = StringUtils.join(authResult.getAuthorities(), ",");