@Override
  public final Database filterDatabase(Database database) throws MetaException, NoSuchObjectException {
    if (database != null) {
      String dbName = database.getName();
      List<String> databases = filterDatabases(Collections.singletonList(dbName));
      if (databases.isEmpty()) {
        throw new NoSuchObjectException(String.format("Database %s does not exist", dbName));
      }
    }
    return database;
  }
HiveMetaStoreAuthorizer :  Do authorization checks on MetaStore Events in MetaStorePreEventListener
ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/metastore/HiveMetaStoreAuthorizer.java