use of org.apache.activemq.artemis.rest.queue.push.xml.BasicAuth in project activemq-artemis by apache.
the class UriStrategy method initAuthentication.
protected void initAuthentication() {
if (registration.getAuthenticationMechanism() != null) {
if (registration.getAuthenticationMechanism().getType() instanceof BasicAuth) {
BasicAuth basic = (BasicAuth) registration.getAuthenticationMechanism().getType();
UsernamePasswordCredentials creds = new UsernamePasswordCredentials(basic.getUsername(), basic.getPassword());
AuthScope authScope = new AuthScope(AuthScope.ANY);
((DefaultHttpClient) client).getCredentialsProvider().setCredentials(authScope, creds);
localContext = new BasicHttpContext();
// Generate BASIC scheme object and stick it to the local execution context
BasicScheme basicAuth = new BasicScheme();
localContext.setAttribute("preemptive-auth", basicAuth);
// Add as the first request interceptor
((DefaultHttpClient) client).addRequestInterceptor(new PreemptiveAuth(), 0);
executor.setHttpContext(localContext);
}
}
}
Aggregations