congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
PreemptiveAuth.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
com.offbytwo.jenkins.client.PreemptiveAuth
constructor

Best Java code snippets using com.offbytwo.jenkins.client.PreemptiveAuth.<init> (Showing top 3 results out of 315)

origin: com.offbytwo.jenkins/jenkins-client

/**
 * Add authentication to supplied builder.
 * @param builder the builder to configure
 * @param uri the server URI
 * @param username the username
 * @param password the password
 * @return the passed in builder
 */
protected static HttpClientBuilder addAuthentication(final HttpClientBuilder builder, 
    final URI uri, final String username,
    String password) {
  if (isNotBlank(username)) {
    CredentialsProvider provider = new BasicCredentialsProvider();
    AuthScope scope = new AuthScope(uri.getHost(), uri.getPort(), "realm");
    UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(username, password);
    provider.setCredentials(scope, credentials);
    builder.setDefaultCredentialsProvider(provider);
    builder.addInterceptorFirst(new PreemptiveAuth());
  }
  return builder;
}
origin: Verigreen/verigreen

/**
 * Create an authenticated Jenkins HTTP client
 * 
 * @param uri
 *            Location of the jenkins server (ex. http://localhost:8080)
 * @param username
 *            Username to use when connecting
 * @param password
 *            Password or auth token to use when connecting
 */
public JenkinsHttpClient(URI uri, String username, String password) {
  this(uri);
  if (isNotBlank(username)) {
    CredentialsProvider provider = client.getCredentialsProvider();
    AuthScope scope = new AuthScope(uri.getHost(), uri.getPort(), AuthScope.ANY_REALM);
    UsernamePasswordCredentials credentials =
        new UsernamePasswordCredentials(username, password);
    provider.setCredentials(scope, credentials);
    
    localContext = new BasicHttpContext();
    localContext.setAttribute("preemptive-auth", new BasicScheme());
    client.addRequestInterceptor(new PreemptiveAuth(), 0);
  }
}

origin: stackoverflow.com

client.addRequestInterceptor(new PreemptiveAuth(), 0);
com.offbytwo.jenkins.clientPreemptiveAuth<init>

Popular methods of PreemptiveAuth

    Popular in Java

    • Making http post requests using okhttp
    • setContentView (Activity)
    • setRequestProperty (URLConnection)
    • getOriginalFilename (MultipartFile)
      Return the original filename in the client's filesystem.This may contain path information depending
    • OutputStream (java.io)
      A writable sink for bytes.Most clients will use output streams that write data to the file system (
    • ConnectException (java.net)
      A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
    • SimpleDateFormat (java.text)
      Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
    • JLabel (javax.swing)
    • BasicDataSource (org.apache.commons.dbcp)
      Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
    • IsNull (org.hamcrest.core)
      Is the value null?
    • Top plugins for WebStorm
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Tabnine for your IDE now