dart2.auth.http_basic_auth.mustache Maven / Gradle / Ivy
{{>header}}
{{>part_of}}
class HttpBasicAuth implements Authentication {
HttpBasicAuth({this.username = '', this.password = ''});
String username;
String password;
@override
Future applyToParams(List queryParams, Map headerParams,) async {
if (username.isNotEmpty && password.isNotEmpty) {
final credentials = '$username:$password';
headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}';
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy