You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2020/12/11 16:13:52 UTC

[GitHub] [geode] jdeppe-pivotal opened a new pull request #5840: GEODE-8782: Add getPrincipal method to FunctionContext interface

jdeppe-pivotal opened a new pull request #5840:
URL: https://github.com/apache/geode/pull/5840


   - Add the ability to retrieve the Principal from the FunctionContext
     when a SecurityManager is enabled.
   
   Authored-by: Jens Deppe <jd...@vmware.com>
   
   Thank you for submitting a contribution to Apache Geode.
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [ ] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?
   
   - [ ] Has your PR been rebased against the latest commit within the target branch (typically `develop`)?
   
   - [ ] Is your initial contribution a single, squashed commit?
   
   - [ ] Does `gradlew build` run cleanly?
   
   - [ ] Have you written or updated unit tests to verify your changes?
   
   - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
   
   ### Note:
   Please ensure that once the PR is submitted, check Concourse for build issues and
   submit an update to your PR as soon as possible. If you need help, please send an
   email to dev@geode.apache.org.
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode] upthewaterspout commented on a change in pull request #5840: GEODE-8782: Add getPrincipal method to FunctionContext interface

Posted by GitBox <gi...@apache.org>.
upthewaterspout commented on a change in pull request #5840:
URL: https://github.com/apache/geode/pull/5840#discussion_r542691265



##########
File path: geode-core/src/main/java/org/apache/geode/internal/cache/execute/FunctionRemoteContext.java
##########
@@ -84,6 +85,10 @@ public void fromData(DataInput in) throws IOException, ClassNotFoundException {
       this.bucketArray = BucketSetHelper.fromSet(bucketSet);
     }
     this.isReExecute = DataSerializer.readBoolean(in);
+
+    if (StaticSerialization.getVersionForDataStream(in).isNotOlderThan(KnownVersion.GEODE_1_14_0)) {

Review comment:
       Instead of this, I think you could make this class implement VersionedDataSerializable which might handle writing the principal differently.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode] jdeppe-pivotal commented on a change in pull request #5840: GEODE-8782: Add getPrincipal method to FunctionContext interface

Posted by GitBox <gi...@apache.org>.
jdeppe-pivotal commented on a change in pull request #5840:
URL: https://github.com/apache/geode/pull/5840#discussion_r543467832



##########
File path: geode-core/src/main/java/org/apache/geode/internal/cache/execute/FunctionRemoteContext.java
##########
@@ -84,6 +85,10 @@ public void fromData(DataInput in) throws IOException, ClassNotFoundException {
       this.bucketArray = BucketSetHelper.fromSet(bucketSet);
     }
     this.isReExecute = DataSerializer.readBoolean(in);
+
+    if (StaticSerialization.getVersionForDataStream(in).isNotOlderThan(KnownVersion.GEODE_1_14_0)) {

Review comment:
       I tried that but had some upgrade tests that became flaky. I may have done something wrong, but using `VersionedDataSerializable` seemed to not work for this.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode] jdeppe-pivotal commented on pull request #5840: GEODE-8782: Add getPrincipal method to FunctionContext interface

Posted by GitBox <gi...@apache.org>.
jdeppe-pivotal commented on pull request #5840:
URL: https://github.com/apache/geode/pull/5840#issuecomment-745385708


   @jinmeiliao Yes, good idea. I've added the principal to `FunctionContextImpl` and removed the code that rebound the `Subject` on function threads.
   
   @upthewaterspout I've also removed the default implementation for `FunctionContext.getPrincipal()` since FunctionContext (and impls) are never serialized anywhere and it is also never implemented by user code.


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode] jdeppe-pivotal merged pull request #5840: GEODE-8782: Add getPrincipal method to FunctionContext interface

Posted by GitBox <gi...@apache.org>.
jdeppe-pivotal merged pull request #5840:
URL: https://github.com/apache/geode/pull/5840


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode] jinmeiliao commented on pull request #5840: GEODE-8782: Add getPrincipal method to FunctionContext interface

Posted by GitBox <gi...@apache.org>.
jinmeiliao commented on pull request #5840:
URL: https://github.com/apache/geode/pull/5840#issuecomment-745491031


   After you are done with this, can you file another jira ticket to redo the `QueryCommand`? Currently we are sending the principal using `DataCommandRequest`, now that the principal is in the function context, we don't need to do that anymore. Or if you can lump it into this PR, that would be great too!


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode] jinmeiliao commented on pull request #5840: GEODE-8782: Add getPrincipal method to FunctionContext interface

Posted by GitBox <gi...@apache.org>.
jinmeiliao commented on pull request #5840:
URL: https://github.com/apache/geode/pull/5840#issuecomment-744603610


   I see you are binding the subject to the threads running the function and also adding the the parameter `principal` to the constructor of the `FunctoinContext`, I wonder if we only need to do one of the two? If subject is already in the thread context, you don't need to pass it in the constructor, you can just directly get it from the thread local by calling `getCache().getSecurityService().getPrinicipal()`


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org