[英]how to authenticate REST in play framework 1.2.5
i have an application of play that need to be secure. 我有一个需要安全的游戏应用程序。 i have try to import module secure, it working the application need login now, and now i have another problem. 我已经尝试安全地导入模块,它现在需要登录才能正常工作,现在我还有另一个问题。 I want to authenticate from REST. 我想从REST进行身份验证。 I mean how client request to my application for authenticate?, i have try like this 我的意思是客户端如何请求我的应用程序进行身份验证?,我已经尝试过这样
public static Response logIn(){
DataInputStream dis = new DataInputStream(request.body);
String request;
response.status = 400;
try {
while(null != ((request = dis.readLine()))){
JSONObject jsonObject = new JSONObject(request);
String username = jsonObject.getString("username");
String password = jsonObject.getString("password");
boolean authenticated = Security.authenticate(username, password);
if(authenticated){
response.status = 200;
return response;
}else{
response.status = 400;
return response;
}
}
} catch (IOException | JSONException e) {
e.printStackTrace();
}
return response;
}
but when i test it with rest client, it error, it say that server redirected too many. 但是当我用其余客户端测试它时,它出错了,它说服务器重定向太多了。 Sorry for my bad English, i want an example if that posible 对不起,我的英语不好,我想举个例子
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.