com.ning.http.client.Realm Java Examples
The following examples show how to use
com.ning.http.client.Realm.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Zendesk.java From scava with Eclipse Public License 2.0 | 6 votes |
private Zendesk(AsyncHttpClient client, String url, String username, String password) { this.logger = LoggerFactory.getLogger(Zendesk.class); this.closeClient = client == null; this.oauthToken = null; this.client = client == null ? new AsyncHttpClient() : client; this.url = url.endsWith("/") ? url + "api/v2" : url + "/api/v2"; if (username != null) { this.realm = new Realm.RealmBuilder() .setScheme(Realm.AuthScheme.BASIC) .setPrincipal(username) .setPassword(password) .setUsePreemptiveAuth(true) .build(); } else { if (password != null) { throw new IllegalStateException("Cannot specify token or password without specifying username"); } this.realm = null; } this.mapper = createMapper(); }
Example #2
Source File: GrizzlyClientCustomizer.java From datacollector with Apache License 2.0 | 6 votes |
@Override public AsyncHttpClientConfig.Builder customize( Client client, Configuration config, AsyncHttpClientConfig.Builder configBuilder ) { if (useProxy && !StringUtils.isEmpty(username)) { Realm realm = new Realm.RealmBuilder().setScheme(Realm.AuthScheme.BASIC) .setUsePreemptiveAuth(true) .setTargetProxy(true) .setPrincipal(username) .setPassword(password) .build(); configBuilder.setRealm(realm); } return configBuilder; }
Example #3
Source File: NingRequestBuilder.java From ob1k with Apache License 2.0 | 5 votes |
@Override public RequestBuilder withBasicAuth(final String username, final String password) { final Realm realm = new Realm.RealmBuilder(). setPrincipal(username). setPassword(password). setUsePreemptiveAuth(true). setScheme(Realm.AuthScheme.BASIC). build(); ningRequestBuilder.setRealm(realm); return this; }
Example #4
Source File: XbmcConnector.java From openhab1-addons with Eclipse Public License 2.0 | 5 votes |
private Realm createRealm() { Realm.RealmBuilder builder = new Realm.RealmBuilder(); builder.setPrincipal(xbmc.getUsername()); builder.setPassword(xbmc.getPassword()); builder.setUsePreemptiveAuth(true); builder.setScheme(AuthScheme.BASIC); return builder.build(); }