"expected RPC request message type but got " +
hdr.getMessageType());
return;
}
RequestHeader rqHdr = hdr.getRequestHeader();
// check authentication
if (!rqHdr.hasAuthData() ||
!rqHdr.getAuthData().getAuthType().equals(AUTH_TYPE)) {
rq.sendError(ErrorType.AUTH_FAILED, POSIX_ERROR_NONE,
"only '"+AUTH_TYPE.toString()+"' is permitted");
return;
}
// check userCredentials
if (!rqHdr.hasUserCreds() ||
!rqHdr.getUserCreds().getUsername().equals(USER)) {
rq.sendError(ErrorType.AUTH_FAILED, POSIX_ERROR_NONE,
"expected request from user '" + USER + "' only");
return;
}