All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.internetitem.logback.elasticsearch.config.BasicAuthentication Maven / Gradle / Ivy

package com.internetitem.logback.elasticsearch.config;

import com.internetitem.logback.elasticsearch.util.Base64;

import java.net.HttpURLConnection;

public class BasicAuthentication implements Authentication {
    public void addAuth(HttpURLConnection urlConnection, String body) {
        String userInfo = urlConnection.getURL().getUserInfo();
        if (userInfo != null) {
            String basicAuth = "Basic " + Base64.encode(userInfo.getBytes());
            urlConnection.setRequestProperty("Authorization", basicAuth);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy