1
我有一个需要安全的应用程序。我已尝试导入模块安全,它正在工作的应用程序需要登录,现在我有另一个问题。我想从REST进行身份验证。我的意思是有客户端请求我的身份验证的应用程序?我已经尝试这样如何在Play框架中验证REST 1.2.5
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;
}
,但是当我用剩下的客户,它错误测试了一下,说,服务器重定向太多。对不起,我的英文不好,我想一个例子,如果是更多钞票
IAM是没有问题的? – Yusuf1494