@Override
  public void init(final Principal principal, final DistributedMember remoteMember,
      final Cache cache) throws NotAuthorizedException {
    synchronized (sync) {
      XmlAuthorization.init(cache);
    }

    systemLogWriter = cache.getLogger();
    securityLogWriter = cache.getSecurityLogger();

    String name;
    if (principal != null) {
      name = principal.getName();
    } else {
      name = EMPTY_VALUE;
    }

    HashSet<String> roles = XmlAuthorization.userRoles.get(name);
    if (roles != null) {
      for (String roleName : roles) {
        Map<String, Map<OperationCode, FunctionSecurityPrmsHolder>> regionOperationMap =
            XmlAuthorization.rolePermissions.get(roleName);
        if (regionOperationMap != null) {
          for (Map.Entry<String, Map<OperationCode, FunctionSecurityPrmsHolder>> regionEntry : regionOperationMap
              .entrySet()) {
            String regionName = regionEntry.getKey();
            Map<OperationCode, FunctionSecurityPrmsHolder> regionOperations =
                allowedOps.get(regionName);
            if (regionOperations == null) {
              regionOperations = new HashMap<>();
              allowedOps.put(regionName, regionOperations);
            }
            regionOperations.putAll(regionEntry.getValue());
          }
        }
      }
    }
  }
Initialize the {@code XmlAuthorization} callback for a client having the given principal.

This method caches the full XML authorization file the first time it is invoked and caches all
the permissions for the provided {@code principal} to speed up lookup the
{@code authorizeOperation} calls. The permissions for the principal are maintained as a
{@link Map} of region name to the {@link HashSet} of operations allowed for that region. A
global entry with region name as empty string is also made for permissions provided for all the
regions.

@param principal the principal associated with the authenticated client
@param cache reference to the cache object
@param remoteMember the {@link DistributedMember} object for the remote authenticated client

@throws NotAuthorizedException if some exception condition happens during the initialization
        while reading the XML; in such a case all subsequent client operations will throw
        {@code NotAuthorizedException}
geode-dunit/src/main/java/org/apache/geode/security/templates/XmlAuthorization.java