
com.makeandbuild.vessl.persistence.couch.Base64BasicAuthEncoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vessl Show documentation
Show all versions of vessl Show documentation
a lightweight persistence, REST, fixture, property configuration, and validation framework
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