私はRESTFullサーバーとそのためのAndroidクライアントを持っています。サーバーには、クライアントのHTTP呼び出しにデータを返すメソッドがいくつかあります。クライアントコードのメソッドの1つは、顧客を認証するために使用した以下のメソッドです。
HttpClient httpclient = new DefaultHttpClient();
HttpGet request = new HttpGet(
"http://localhost:8080/myapp/customer/login/cUser/cpwd");
request.addHeader("Accept", "text/plain");
HttpResponse response = httpclient.execute(request);
HttpEntity entity = response.getEntity();
InputStream instream = entity.getContent();
String msg = read(instream);
if(msg.equals("success"){ // if customer logged in successfully
//do something
}
サーバー側のコードは、上記のURIの一部をユーザー名とパスワードとして使用し、認証を行います。私の意見では、誰かがこれらのデータにアクセスして、好きなように使用するのは簡単です。これを行うためのより良い方法はありますか?
前もって感謝します