mridulm commented on code in PR #2441:
URL: https://github.com/apache/celeborn/pull/2441#discussion_r1550946338
##########
common/src/main/scala/org/apache/celeborn/common/rpc/RpcEndpoint.scala:
##########
@@ -134,6 +136,21 @@ trait RpcEndpoint {
rpcEnv.stop(_self)
}
}
+
+ def checkAuth(context: RpcCallContext, appId: String): Unit = {
+ context match {
+ case remoteContext: RemoteNettyRpcCallContext =>
+ checkAuth(remoteContext.transportClient, appId)
+ case _ =>
+ // Do nothing if the context is not RemoteNettyRpcCallContext
+ }
+ }
+
+ private def checkAuth(client: TransportClient, appId: String): Unit = {
+ if (client.getClientId != null && !(client.getClientId == appId))
Review Comment:
super nit:
```suggestion
if (client.getClientId != null && client.getClientId != appId)
```
##########
common/src/main/scala/org/apache/celeborn/common/rpc/RpcEndpoint.scala:
##########
@@ -134,6 +136,21 @@ trait RpcEndpoint {
rpcEnv.stop(_self)
}
}
+
+ def checkAuth(context: RpcCallContext, appId: String): Unit = {
+ context match {
+ case remoteContext: RemoteNettyRpcCallContext =>
+ checkAuth(remoteContext.transportClient, appId)
+ case _ =>
+ // Do nothing if the context is not RemoteNettyRpcCallContext
+ }
+ }
+
+ private def checkAuth(client: TransportClient, appId: String): Unit = {
+ if (client.getClientId != null && !(client.getClientId == appId))
+ throw new SecurityException(
Review Comment:
`SecurityException` is typically for use by security manager in java (see
`java.lang.SecurityManager`).
Might be better to create our own `Exception`, or perhaps use
`IllegalStateException`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]