⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 httpauthenticator.java

📁 这是linux下ssl vpn的实现程序
💻 JAVA
字号:
package com.maverick.http;

import java.io.IOException;

public abstract class HttpAuthenticator {

  protected PasswordCredentials credentials;
  protected String authorizationHeader;
  protected String authenticationHeader;
  protected HttpConnection connection;
  protected boolean hasCompleted = false;
  String scheme;
  String uri;

  public static final int AUTHENTICATION_FAILED = 1;
  public static final int AUTHENTICATION_IN_PROGRESS = 2;
  public static final int AUTHENTICATION_COMPLETED = 3;

  public HttpAuthenticator(String scheme, String uri) {
    this.scheme = scheme;
    this.uri = uri;
  }

  public void setURI(String uri) {
    this.uri = uri;
  }

  public String getURI() {
    return uri;
  }

  public abstract boolean isStateless();

  public String getAuthorizationHeader() {
      return authorizationHeader;
  }

  public void setConnection(HttpConnection connection) {
  	this.connection = connection;
  }

  public void setAuthenicationHeader(String authenticationHeader) {
  	this.authenticationHeader = authenticationHeader;
  }

  public void setAuthorizationHeader(String authorizationHeader) {
  	this.authorizationHeader = authorizationHeader;
  }

  public abstract void setChallenge(String challenge);

  public void setCredentials(PasswordCredentials credentials) {
    this.credentials = credentials;
  }

  public abstract void authenticate(HttpRequest request, HttpMethod method) throws IOException;

  public abstract int processResponse(HttpResponse response);

  public boolean canAuthenticate() {
    return true;
  }

  void complete() {
    hasCompleted = true;
  }

  public boolean wantsPrompt() {
    return !hasCompleted;
  }

  public String getScheme() {
    return scheme;
  }


}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -