Repository: geode
Updated Branches:
  refs/heads/feature/GEODE-3447 ea1d8c1f9 -> ab8159db4


throw an exception rather than return null if authentication has yet
to be done.


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/ab8159db
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/ab8159db
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/ab8159db

Branch: refs/heads/feature/GEODE-3447
Commit: ab8159db409062e02bd0d752e23d8045264beb63
Parents: ea1d8c1
Author: Bruce Schuchardt <bschucha...@pivotal.io>
Authored: Mon Aug 28 10:32:03 2017 -0700
Committer: Bruce Schuchardt <bschucha...@pivotal.io>
Committed: Mon Aug 28 10:32:03 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/geode/security/StreamAuthenticator.java    | 4 +---
 .../geode/protocol/protobuf/ProtobufSimpleAuthenticator.java   | 6 +++++-
 2 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/ab8159db/geode-core/src/main/java/org/apache/geode/security/StreamAuthenticator.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/main/java/org/apache/geode/security/StreamAuthenticator.java 
b/geode-core/src/main/java/org/apache/geode/security/StreamAuthenticator.java
index 5cbc4f8..8bba60c 100644
--- 
a/geode-core/src/main/java/org/apache/geode/security/StreamAuthenticator.java
+++ 
b/geode-core/src/main/java/org/apache/geode/security/StreamAuthenticator.java
@@ -46,10 +46,8 @@ public interface StreamAuthenticator {
   /**
    * Return an authorization object which can be used to determine which 
permissions this stream has
    * according to the provided securityManager.
-   *
-   * Calling this before authentication has succeeded may result in a null 
return object.
    */
-  StreamAuthorizer getAuthorizer();
+  StreamAuthorizer getAuthorizer() throws AuthenticationRequiredException;
 
   /**
    * @return a unique identifier for this particular implementation (NOOP, 
PASSTHROUGH, etc.)

http://git-wip-us.apache.org/repos/asf/geode/blob/ab8159db/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/ProtobufSimpleAuthenticator.java
----------------------------------------------------------------------
diff --git 
a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/ProtobufSimpleAuthenticator.java
 
b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/ProtobufSimpleAuthenticator.java
index 77d473a..304ab73 100644
--- 
a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/ProtobufSimpleAuthenticator.java
+++ 
b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/ProtobufSimpleAuthenticator.java
@@ -15,6 +15,7 @@
 package org.apache.geode.protocol.protobuf;
 
 import org.apache.geode.management.internal.security.ResourceConstants;
+import org.apache.geode.security.AuthenticationRequiredException;
 import org.apache.geode.security.StreamAuthenticator;
 import org.apache.geode.security.AuthenticationFailedException;
 import org.apache.geode.security.SecurityManager;
@@ -64,7 +65,10 @@ public class ProtobufSimpleAuthenticator implements 
StreamAuthenticator {
   }
 
   @Override
-  public StreamAuthorizer getAuthorizer() {
+  public StreamAuthorizer getAuthorizer() throws 
AuthenticationRequiredException {
+    if (authorizer == null) {
+      throw new AuthenticationRequiredException("Not yet authenticated");
+    }
     return authorizer;
   }
 

Reply via email to