I'm trying to create a method authentication with RESTEasy.
My URLs REST are mapped with con Spring Security
I want to know how Spring Security can to recognize to authenticated user...
I've created a login URL and login method in a service class. This method is used in my web application and call other method that return true o false
Code:@Path("/service/login") public class LoginService { private UsuarioBusiness usuarioBusiness; @GET @Path("/go/{user}/{pass}") @Produces("application/json") public Response login(@PathParam("user") String usuario, @PathParam("pass") String pass){ //call other method } }But this only serves for that the app that call login service redirect to the homepage application. When the app want to access to other URL is rejected because is mapped with Spring SecurityCode://Other method public boolean login(String username, String password) { try { Authentication authenticate = authenticationManager.authenticate( new UsernamePasswordAuthenticationToken(username, password)); if (authenticate.isAuthenticated()) { SecurityContextHolder.getContext().setAuthentication(authenticate); return true; } } catch (AuthenticationException e) { System.out.println("Error en login"); } return false; }
How I make for Spring Security recognize to my user authenticated?
In this post mentioned entry-point but I don't understand how associate to a URL
Thanks![]()



Reply With Quote
