When publishing a REST Service, you can require the user to Authenticate using Basic Authentication.
Within an endpoint event, you can access the Basic Authentication string using the following method:
var credentials = form.rest.readBasicAuthenticationCredentials();
if(credentials.getUsername() == "user" && credentials.getPassword()== "pwd"){
}
else{
//send back forbidden status
form.rest.setStatus(403);
}
Alternatively, for other Authorization types you can access the Authorization header directly using form.rest.getRequestHeader(‘Authorization’). Examples of creating custom authentication methods can be found here.