mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-27 00:03:22 +01:00
119 lines
3.1 KiB
Java
119 lines
3.1 KiB
Java
package org.apache.http.auth;
|
|
|
|
import java.util.Queue;
|
|
import org.apache.http.util.Args;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes11.dex */
|
|
public class AuthState {
|
|
private Queue<AuthOption> authOptions;
|
|
private AuthScheme authScheme;
|
|
private AuthScope authScope;
|
|
private Credentials credentials;
|
|
private AuthProtocolState state = AuthProtocolState.UNCHALLENGED;
|
|
|
|
public Queue<AuthOption> getAuthOptions() {
|
|
return this.authOptions;
|
|
}
|
|
|
|
public AuthScheme getAuthScheme() {
|
|
return this.authScheme;
|
|
}
|
|
|
|
@Deprecated
|
|
public AuthScope getAuthScope() {
|
|
return this.authScope;
|
|
}
|
|
|
|
public Credentials getCredentials() {
|
|
return this.credentials;
|
|
}
|
|
|
|
public AuthProtocolState getState() {
|
|
return this.state;
|
|
}
|
|
|
|
public boolean hasAuthOptions() {
|
|
Queue<AuthOption> queue = this.authOptions;
|
|
return (queue == null || queue.isEmpty()) ? false : true;
|
|
}
|
|
|
|
@Deprecated
|
|
public void invalidate() {
|
|
reset();
|
|
}
|
|
|
|
public boolean isConnectionBased() {
|
|
AuthScheme authScheme = this.authScheme;
|
|
return authScheme != null && authScheme.isConnectionBased();
|
|
}
|
|
|
|
@Deprecated
|
|
public boolean isValid() {
|
|
return this.authScheme != null;
|
|
}
|
|
|
|
public void reset() {
|
|
this.state = AuthProtocolState.UNCHALLENGED;
|
|
this.authOptions = null;
|
|
this.authScheme = null;
|
|
this.authScope = null;
|
|
this.credentials = null;
|
|
}
|
|
|
|
@Deprecated
|
|
public void setAuthScheme(AuthScheme authScheme) {
|
|
if (authScheme == null) {
|
|
reset();
|
|
} else {
|
|
this.authScheme = authScheme;
|
|
}
|
|
}
|
|
|
|
@Deprecated
|
|
public void setAuthScope(AuthScope authScope) {
|
|
this.authScope = authScope;
|
|
}
|
|
|
|
@Deprecated
|
|
public void setCredentials(Credentials credentials) {
|
|
this.credentials = credentials;
|
|
}
|
|
|
|
public void setState(AuthProtocolState authProtocolState) {
|
|
if (authProtocolState == null) {
|
|
authProtocolState = AuthProtocolState.UNCHALLENGED;
|
|
}
|
|
this.state = authProtocolState;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder sb = new StringBuilder("state:");
|
|
sb.append(this.state);
|
|
sb.append(";");
|
|
if (this.authScheme != null) {
|
|
sb.append("auth scheme:");
|
|
sb.append(this.authScheme.getSchemeName());
|
|
sb.append(";");
|
|
}
|
|
if (this.credentials != null) {
|
|
sb.append("credentials present");
|
|
}
|
|
return sb.toString();
|
|
}
|
|
|
|
public void update(AuthScheme authScheme, Credentials credentials) {
|
|
Args.notNull(authScheme, "Auth scheme");
|
|
Args.notNull(credentials, "Credentials");
|
|
this.authScheme = authScheme;
|
|
this.credentials = credentials;
|
|
this.authOptions = null;
|
|
}
|
|
|
|
public void update(Queue<AuthOption> queue) {
|
|
Args.notEmpty(queue, "Queue of auth options");
|
|
this.authOptions = queue;
|
|
this.authScheme = null;
|
|
this.credentials = null;
|
|
}
|
|
}
|