requireAuthentication method

APIResponse<T> requireAuthentication({
  1. bool require = true,
  2. String type = 'Basic',
  3. String realm = 'API',
})

Defines that this response requires authentication.

Depending of the serve implementation (usually HTTP), it will send to the client the request for authentication (in HTTP is the headers WWW-Authenticate).

Implementation

APIResponse<T> requireAuthentication({
  bool require = true,
  String type = 'Basic',
  String realm = 'API',
}) {
  _requiresAuthentication = require;
  _authenticationType = type;
  _authenticationRealm = realm;
  return this;
}