buildAuthorizationWithFields method

Credential? buildAuthorizationWithFields(
  1. Map<String, String?>? parameters
)

Implementation

Credential? buildAuthorizationWithFields(Map<String, String?>? parameters) {
  if (authorizationFields == null ||
      authorizationFields!.isEmpty ||
      parameters == null) {
    return null;
  }

  var fieldUser = authorizationFields![0];
  var fieldPass =
      (authorizationFields!.length > 1 ? authorizationFields![1] : null) ??
          'password';

  var user = parameters[fieldUser];
  var pass = parameters[fieldPass];

  if (user != null && pass != null) {
    return BasicCredential(user, pass);
  }

  return null;
}