安全である必要がある遊びのアプリケーションがあります。私はモジュールを安全にインポートしようとしましたが、アプリケーションは今すぐログインする必要がありますが、別の問題があります。RESTから認証したい。認証のためにクライアントがアプリケーションに要求する方法を意味しますか?、私はこのように試しました
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;
}
しかし、残りのクライアントでテストすると、エラーが発生し、サーバーがリダイレクトされすぎたと表示されます。私の悪い英語で申し訳ありませんが、可能であれば例が欲しいです