class BloombergBpipePermissionCheckProvider extends AbstractPermissionCheckProvider implements PermissionCheckProvider, Lifecycle {

  @Override
  public PermissionCheckProviderResult isPermitted(PermissionCheckProviderRequest request) {
    ArgumentChecker.notNull(request, "request");
    // validate
    if (isRunning() == false) {
      return PermissionCheckProviderResult.ofAuthenticationError(
          "Bloomberg permission check found connection not running");
    }
    String emrsId = StringUtils.trimToNull(request.getUserIdBundle().getValue(ExternalSchemes.BLOOMBERG_EMRSID));
    if (emrsId == null) {
      return PermissionCheckProviderResult.ofAuthenticationError(
          "Bloomberg permission check request did not contain an EMRS user ID");
    }
    if (request.getNetworkAddress() == null) {
      return PermissionCheckProviderResult.ofAuthenticationError(
          "Bloomberg permission check request did not contain a network address");
    }
    // obtain user identity
    Identity userIdentity;
    try {
      userIdentity = _userIdentityCache.get(IdentityCacheKey.of(request.getNetworkAddress(), emrsId));
    } catch (ExecutionException | UncheckedExecutionException ex) {
      return processAuthenticationError(request, ex);
    }
    // check whether identity has the permissions
    return checkPermissions(request, userIdentity);
  }

  public  BloombergBpipePermissionCheckProvider(BloombergConnector bloombergConnector);
  public  BloombergBpipePermissionCheckProvider(BloombergConnector bloombergConnector, Duration identityExpiry);

}