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

com.makeandbuild.vessl.persistence.couch.Base64BasicAuthEncoder Maven / Gradle / Ivy

Go to download

a lightweight persistence, REST, fixture, property configuration, and validation framework

There is a newer version: 1.0.52
Show newest version
package com.makeandbuild.vessl.persistence.couch;
import sun.misc.BASE64Encoder;

@SuppressWarnings("restriction")
public class Base64BasicAuthEncoder implements Encoder {
    @Override
    public String encode(String... input) {
        if (input.length < 2) throw new IllegalArgumentException("Must provide a username and password");
        try {
            BASE64Encoder encoder = new BASE64Encoder();
            return "Basic " + encoder.encode((input[0] + ":" + input[1]).getBytes());
        } catch (Exception e) {
            throw new RuntimeException("Could not encode values for basic authentication", e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy