@Override
  public void authorize(ResourcePermission context, Subject currentUser) {
    if (context == null) {
      return;
    }
    if (context.getResource() == Resource.NULL && context.getOperation() == Operation.NULL) {
      return;
    }

    try {
      currentUser.checkPermission(context);
    } catch (ShiroException e) {
      String message = currentUser.getPrincipal() + " not authorized for " + context;
      logger.info("NotAuthorizedException: {}", message);
      throw new NotAuthorizedException(message, e);
    }
  }
Binds the passed-in subject to the executing thread. Usage:

<pre>
ThreadState state = null;
try {
  state = securityService.bindSubject(subject);
  // do the rest of the work as this subject
} finally {
  if (state != null) {
    state.clear();
  }
}
</pre>
geode-core/src/main/java/org/apache/geode/internal/security/IntegratedSecurityService.java