dart2-v3template.auth.http_basic_auth.mustache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of connect-openapi-dart Show documentation
Show all versions of connect-openapi-dart Show documentation
dart2 generator from openapi 3.x spec files. Changing to openapitools dependencies.
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;
}