use of com.sun.jersey.api.client.filter.HTTPDigestAuthFilter in project exhibitor by soabase.
the class ExhibitorMain method addRemoteAuth.
private void addRemoteAuth(ExhibitorArguments.Builder builder, String remoteAuthSpec) {
String[] parts = remoteAuthSpec.split(":");
Preconditions.checkArgument(parts.length == 2, "Badly formed remote client authorization: " + remoteAuthSpec);
String type = parts[0].trim();
String userName = parts[1].trim();
String password = Preconditions.checkNotNull(users.get(userName), "Realm user not found: " + userName);
ClientFilter filter;
if (type.equals("basic")) {
filter = new HTTPBasicAuthFilter(userName, password);
} else if (type.equals("digest")) {
filter = new HTTPDigestAuthFilter(userName, password);
} else {
throw new IllegalStateException("Unknown remote client authorization type: " + type);
}
builder.remoteConnectionConfiguration(new RemoteConnectionConfiguration(Arrays.asList(filter)));
}
Aggregations