I can't make my app working. I have created these simple endpoints :
@GetMapping("/sso/metabase")
public void ssoToMetabase(HttpServletResponse response, @RequestParam(required = false) String return_to)
throws IOException {
System.out.println("SSO to Metabase called with return_to: " + return_to);
String email = "Test@gmail.com";
String firstName = "Test";
String lastName = "Test";
User user = new User();
user.setEmail(email);
user.setFirstName(firstName);
user.setLastName(lastName);
String token = jwtService.signToken(user);
String ssoUrl = metabaseUrl + "/auth/sso?jwt=" + token;
if (return_to != null && !return_to.isEmpty()) {
ssoUrl += "&return_to=" + URLEncoder.encode(return_to, StandardCharsets.UTF_8.toString());
}
response.sendRedirect(ssoUrl);
}
@GetMapping("/analytics")
public void showAnalytics(HttpServletResponse response) throws IOException {
String iframeUrl = "/sso/metabase?return_to=" + METABASE_DASHBOARD_PATH;
String html = "<iframe src=\"" + iframeUrl
+ "\" frameborder=\"0\" width=\"1280\" height=\"600\" allowtransparency=\"true\"></iframe>";
response.setContentType("text/html");
response.getWriter().write(html);
}
but when I hit /analytics endpoint it just redirects over and over.. Metabase with java/spring