com.ning.http.client.Realm.AuthScheme Java Examples
The following examples show how to use
com.ning.http.client.Realm.AuthScheme.
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: WSAsync.java From restcommander with Apache License 2.0 | 5 votes |
private BoundRequestBuilder prepare(BoundRequestBuilder builder) { if (this.username != null && this.password != null && this.scheme != null) { AuthScheme authScheme; switch (this.scheme) { case DIGEST: authScheme = AuthScheme.DIGEST; break; case NTLM: authScheme = AuthScheme.NTLM; break; case KERBEROS: authScheme = AuthScheme.KERBEROS; break; case SPNEGO: authScheme = AuthScheme.SPNEGO; break; case BASIC: authScheme = AuthScheme.BASIC; break; default: throw new RuntimeException("Scheme " + this.scheme + " not supported by the UrlFetch WS backend."); } builder.setRealm( (new RealmBuilder()) .setScheme(authScheme) .setPrincipal(this.username) .setPassword(this.password) .setUsePreemptiveAuth(true) .build() ); } for (String key: this.headers.keySet()) { builder.addHeader(key, headers.get(key)); } builder.setFollowRedirects(this.followRedirects); PerRequestConfig perRequestConfig = new PerRequestConfig(); perRequestConfig.setRequestTimeoutInMs(this.timeout * 1000); builder.setPerRequestConfig(perRequestConfig); return builder; }
Example #2
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(); }