
com.chavaillaz.client.common.security.PasswordAuthentication Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common-client Show documentation
Show all versions of common-client Show documentation
Library for the creation of asynchronous clients supporting multiple HTTP clients
package com.chavaillaz.client.common.security;
import static com.chavaillaz.client.common.utility.Utils.encodeBase64;
import java.util.function.BiConsumer;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* Basic authentication with username and password, adding {@code Authorization} header with them.
*/
@Getter
@RequiredArgsConstructor
public class PasswordAuthentication extends AnonymousAuthentication {
private final String username;
private final String password;
@Override
public void fillHeaders(BiConsumer addHeader) {
addHeader.accept("Authorization", "Basic " + encodeBase64(getUsername() + ":" + getPassword()));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy