code: private void checkCommandAllowed(IdentityContext identityContext, Class commandClass) {
          if (!commandAuthorization.isAuthorized(identityContext, this.authorizations.asMap(), commandClass)) {
              throw new IllegalStateException(identityContext + " is not authorized to execute " + commandClass);
          }
      }
docs: Checks if the identityContext is allowed access to the command class, if the identity context is not allowed
  to execute the passed command class a {@code IllegalStateException} is thrown.
  
  @param identityContext identity context.
  @param commandClass    class of the command.
  @throws IllegalStateException if the identity context is not allowed to execute the command.