REST 서비스를 사용하여 데이터베이스에 액세스하여 사용자를 로그인하는 보안 문제가 있습니다. 작동하지만 암호가 어떤 방식 으로든 암호화되지 않고 URL을 통해 이동하기 때문에 그렇게 될 수 없습니다. .REST 기반 서비스에서 계정 정보를 숨기려면 어떻게합니까?
첫째, 요청 전송 코드 : : 이것은 내 코드 지금
[ServiceContract]
public interface IMyService
{
[OperationContract]
[WebInvoke(Method = "GET", UriTemplate = "Create/{user}/{pass}/{email}")]
bool CreateNewAccount(string user, string pass, string email);
[OperationContract]
[WebInvoke(Method = "GET", UriTemplate = "Validate/{user}/{pass}")]
bool ValidateUser(string user, string pass);
}
는이 같은 작품 : 서버 측에서 지금
private void validateUser(String user, String pass)
{
String URL = "http://myserviceserver/MyService.svc";
AlertDialog popup;
try{
HttpGet request = new HttpGet(URL + "/Validate" + "/" + user + "/" + pass);
request.setHeader("Accept", "application/json");
request.setHeader("Content-type", "application/json");
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpResponse response = httpClient.execute(request);
HttpEntity responseEntity = response.getEntity();
// Read response data into buffer
char[] buffer = new char[(int)responseEntity.getContentLength()];
InputStream stream = responseEntity.getContent();
InputStreamReader reader = new InputStreamReader(stream);
reader.read(buffer);
stream.close();
String resultado = new String(buffer);
if(resultado.contains("true"))
{
popup = createAlertDialog("Message", "User Validated", "OK");
popup.show();
}
else
{
popup = createAlertDialog("Message", "User NOT Validated", "OK");
popup.show();
}
}
catch(Exception e)
{
}
}
을,이 내 서비스 인터페이스입니다 하지만 매력적이지는 않지만 안전하지는 않지만 보내는 정보를 숨길 수있는 방법은 아직 이해가되지 않습니다. 바로 지금은 http://myserviceserver/MyService.svc/Validate/user/password에 요청하여 로그인하고 있기 때문입니다.
은 어떤 도움이 apreciated됩니다 :)
인증을 위해 WCF에 내장 된 기능을 사용하지 않는 이유는 무엇입니까? 그렇게하면 헤더와 물건으로 전체 HTTP 클라이언트를 재 구현할 필요가 없으며 WCF를 사용하고 wsHttp를 사용하도록 구성하면됩니다. – CodeCaster