I am wondering if it is appropriate to use @Pathparam to pass parameters to login method. I want to use the returned boolean value in a client but so far I haven’t been able to get neither TRUE nor FALSE but bunch of XML tags.
@POST
@GET
@Path("{username}/{password}")
@Produces("text/plain")
@Consumes({"application/xml", "application/json"})
public boolean login(@PathParam("usrName")String usrName, @PathParam("pwd")String pwd){
List<User> users= super.findAll();
for(User u : users){
if(u.getUserName().equals(usrName) && u.getPassword().equals(pwd)){
return true;
}
}
return false;
}
when you are thinking about security than
do not use PathParam or QueryParamlike annotationsuse
@FormParamto pass value to serverand use
POST requestfor thisin you code i see GET & POST both methods
do not use both for this type of operation
for authenticational data
Strictly use POST.