dart2.auth.http_basic_auth.mustache Maven / Gradle / Ivy
part of {{pubName}}.api;
class HttpBasicAuth implements Authentication {
String _username;
String _password;
@override
void applyToParams(List queryParams, Map headerParams) {
String str = (_username == null ? "" : _username) + ":" + (_password == null ? "" : _password);
headerParams["Authorization"] = "Basic " + base64.encode(utf8.encode(str));
}
set username(String username) => _username = username;
set password(String password) => _password = password;
}