Hi,
I'm making my own application that will also cooperate with other application writen in PHP.
But I'm stuck at the moment. I made my own AuthenticationHandler:
Code is working fine but the problem is I have no idea how to sent parameters to the other php app. I don't want to use GET as it will be visible for anyone. I don't know if I can use POST or SESSION in here.Code:@Override public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException, ServletException { AnagUser user = (AnagUser) authentication.getPrincipal(); String username = user.getUsername(); Collection<GrantedAuthority> grantedAuthorities = authentication.getAuthorities(); // redirect according to granted authorities if (grantedAuthorities.contains(new GrantedAuthorityImpl("ROLE_ADMIN"))) { httpServletResponse.sendRedirect(httpServletRequest.getContextPath() + "index"); } else if (grantedAuthorities.contains(new GrantedAuthorityImpl("ROLE_USER"))) { httpServletResponse.sendRedirect("www.phpapp.com"); } else if (grantedAuthorities.contains(new GrantedAuthorityImpl("ROLE_USER_OTHER"))) { httpServletResponse.sendRedirect("www.phpapp.com"); } super.onAuthenticationSuccess(httpServletRequest, httpServletResponse, authentication); }
Basically in php app I want to catch those parameters and use them for authentication in other app.
It's done like this because:
- admin panel is in java app,
- user panel (specific user panel) in in php app.
Maybe I should use other approach but I don't really have access to php app.


Reply With Quote