Create a value suitable as the value of {@code Authorization} header.

@return
{@code Authorization} header value for Basic authentication.
341985
public String format()
    {
        if (mFormatted != null)
        {
            return mFormatted;
        }

        // userid:password
        String credentials = String.format("%s:%s",
                mUserId   == null ? "" : mUserId,
                mPassword == null ? "" : mPassword);

        // Convert the credentials into a byte array.
        byte[] credentialsBytes = getBytes(credentials);

        // Encode the byte array by Base64.
        String encoded = Base64.encodeBase64String(credentialsBytes);

        // Build the value of Authorization header.
        mFormatted = "Basic " + encoded;

        return mFormatted;
    }
369154
private String getAuthorizationToken(final HttpHeaders headers) {
        if (headers.getCookies() != null) {
            for (Map.Entry<String, Cookie> entry : headers.getCookies().entrySet()) {
                if (AuthorizationTokenCookie.COOKIE_NAME.equals(entry.getValue().getName())) {
                    return entry.getValue().getValue();
                }
            }
        }
        final List<String> header = headers.getRequestHeader("Authorization");
        if (header != null) {
            final String bearer = header.get(0);
            if (bearer != null) {
                return bearer.substring("Bearer ".length());
            }
        }
        return null;
    }
898252
public String value(String name) {
        final HttpHeader header = getHeader(name);
        return header == null ? null : header.value();
    }
1091641
public T header(String name, String value, boolean isOverride) {
		if(null != name && null != value){
			final List<String> values = headers.get(name.trim());
			if(isOverride || CollectionUtil.isEmpty(values)) {
				final ArrayList<String> valueList = new ArrayList<String>();
				valueList.add(value);
				headers.put(name.trim(), valueList);
			}else {
				values.add(value.trim());
			}
		}
		return (T) this;
	}
455036
public HttpHeaders set(String name, String value) {
        final String headerKey = name.toLowerCase(Locale.ROOT);
        if (value == null) {
            headers.remove(headerKey);
        } else {
            headers.put(headerKey, new HttpHeader(name, value));
        }
        return this;
    }
47108
private Header[] combineHeaders(NameValuePair[] headers) {

        Header[] fullHeaders = new Header[this.headers.size() + headers.length];

        // Add class-level headers (for all requests)
        for (int i = 0; i < this.headers.size(); i++) {
            fullHeaders[i] = this.headers.get(i);
        }

        // Add headers specific to this request:
        for (int i = 0; i < headers.length; i++) {
            NameValuePair header = headers[i];
            fullHeaders[i + this.headers.size()] = new BasicHeader(header.getName(), header.getValue());
        }

        //System.out.println(Arrays.toString(fullHeaders));
        return fullHeaders;
    }
567910
public T header(String name, String value) {
		return header(name, value, true);
	}
343743
@Override
    public Mono<String> authorizationHeaderValueAsync(HttpRequest request) {
        return Mono.just(headerProvider.getAuthenticationHeaderValue(request));
    }
1341837
public KieServerHttpRequest basicAuthorization(final String name, final String password ) {
        return header(AUTHORIZATION, "Basic " + org.kie.server.common.rest.Base64Util.encode(name + ':' + password));
    }
536029
public static ClientAddressSource ofHeader(CharSequence header) {
        checkArgument(header != null && header.length() > 0, "empty header");
        return new ClientAddressSource(HttpHeaderNames.of(header));
    }
582519
public void addHeader( String name, String value )
    {
        headers.add( new BasicHeader( name, value ) );
    }
396651
public static Header of(String name, String value) {
        return new Header(requireNonNull(name), requireNonNull(value));
    }
1187067
public CLIConnectionFactory basicAuth(String userInfo) {
        return authorization("Basic " + new String(Base64.encodeBase64((userInfo).getBytes())));
    }
989137
def make_auth_headers(self, content_type):
        """"""
        headers = self.make_headers(content_type)
        headers['Authorization'] = 'Basic {}'.format(self.get_auth_string())
        return headers
75312
public static Header getInstance() {
		if (INSTANCE == null) {
			INSTANCE = new Header();
			try {
				INSTANCE.load();
			} catch (Exception e) {
				INSTANCE.setHeader(new Properties());
			}
		}
		return INSTANCE;
	}
453132
public static HttpClientRequest<ByteBuf> createRequest(URI uri) {
        String uriToUse = stripUserInfoFromUriIfDefined(uri).toASCIIString();
        HttpClientRequest<ByteBuf> request = HttpClientRequest.createGet(uriToUse);

        if (uri.getUserInfo() != null) {
            logger.debug("Adding basic authentication header for URI {}", uriToUse);
            String basicAuth = "Basic " + Base64.getEncoder().encodeToString(uri.getUserInfo().getBytes(UTF_8));
            request.withHeader("Authorization", basicAuth);
        }

        return request;
    }
1236023
public T basic(String user, String password){
        connection.setRequestProperty("Authorization", "Basic " + toBase64((user + ":" + password).getBytes()));
        return (T) this;
    }