Search in sources :

Example 1 with HTTPDigestAuthFilter

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)));
}
Also used : HTTPDigestAuthFilter(com.sun.jersey.api.client.filter.HTTPDigestAuthFilter) ClientFilter(com.sun.jersey.api.client.filter.ClientFilter) RemoteConnectionConfiguration(com.netflix.exhibitor.core.RemoteConnectionConfiguration) HTTPBasicAuthFilter(com.sun.jersey.api.client.filter.HTTPBasicAuthFilter)

Aggregations

RemoteConnectionConfiguration (com.netflix.exhibitor.core.RemoteConnectionConfiguration)1 ClientFilter (com.sun.jersey.api.client.filter.ClientFilter)1 HTTPBasicAuthFilter (com.sun.jersey.api.client.filter.HTTPBasicAuthFilter)1 HTTPDigestAuthFilter (com.sun.jersey.api.client.filter.HTTPDigestAuthFilter)1