6
I’m starting with Angularjs and Rest (Java JAX-RS) and I’m having a doubt.
The functions responsible for Rest requests are easily viewed via the browser by right-clicking Exibir código fonte da página
.
Therefore, anyone who owns it will be able to access all the information available by the service, even if the Rest server requires authentication, since the user will be aware of all the data...
$http({
method: 'POST',
url: "http://meudominio.com:8080/Integracao/rest/produtos",
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
transformRequest: function(obj) {
var str = [];
for(var p in obj)
str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
return str.join("&");
},
data: {
login: "login",
senha: "senha"
}
}).success(function (response) {
console.log("rest: "+response.response);
});
In the above example, a user would have access to URL, login and password.
Is there any way to hide it?
I edited my question. Note that the data for authentication can be obtained, so anyone can make as many requests as they want.
– NilsonUehara