mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-27 00:03:22 +01:00
66 lines
2.6 KiB
Java
66 lines
2.6 KiB
Java
package org.apache.http.auth;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.Locale;
|
|
import java.util.Map;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
import org.apache.http.HttpRequest;
|
|
import org.apache.http.annotation.Contract;
|
|
import org.apache.http.annotation.ThreadingBehavior;
|
|
import org.apache.http.config.Lookup;
|
|
import org.apache.http.params.HttpParams;
|
|
import org.apache.http.protocol.HttpContext;
|
|
import org.apache.http.util.Args;
|
|
import rx.Single$$ExternalSyntheticBUOutline0;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@Contract(threading = ThreadingBehavior.SAFE)
|
|
@Deprecated
|
|
/* loaded from: classes11.dex */
|
|
public final class AuthSchemeRegistry implements Lookup<AuthSchemeProvider> {
|
|
private final ConcurrentHashMap<String, AuthSchemeFactory> registeredSchemes = new ConcurrentHashMap<>();
|
|
|
|
public AuthScheme getAuthScheme(String str, HttpParams httpParams) throws IllegalStateException {
|
|
Args.notNull(str, "Name");
|
|
AuthSchemeFactory authSchemeFactory = this.registeredSchemes.get(str.toLowerCase(Locale.ENGLISH));
|
|
if (authSchemeFactory != null) {
|
|
return authSchemeFactory.newInstance(httpParams);
|
|
}
|
|
Single$$ExternalSyntheticBUOutline0.m$2("Unsupported authentication scheme: ".concat(str));
|
|
return null;
|
|
}
|
|
|
|
public List<String> getSchemeNames() {
|
|
return new ArrayList(this.registeredSchemes.keySet());
|
|
}
|
|
|
|
@Override // org.apache.http.config.Lookup
|
|
public AuthSchemeProvider lookup(final String str) {
|
|
return new AuthSchemeProvider() { // from class: org.apache.http.auth.AuthSchemeRegistry.1
|
|
@Override // org.apache.http.auth.AuthSchemeProvider
|
|
public AuthScheme create(HttpContext httpContext) {
|
|
return AuthSchemeRegistry.this.getAuthScheme(str, ((HttpRequest) httpContext.getAttribute("http.request")).getParams());
|
|
}
|
|
};
|
|
}
|
|
|
|
public void register(String str, AuthSchemeFactory authSchemeFactory) {
|
|
Args.notNull(str, "Name");
|
|
Args.notNull(authSchemeFactory, "Authentication scheme factory");
|
|
this.registeredSchemes.put(str.toLowerCase(Locale.ENGLISH), authSchemeFactory);
|
|
}
|
|
|
|
public void setItems(Map<String, AuthSchemeFactory> map) {
|
|
if (map == null) {
|
|
return;
|
|
}
|
|
this.registeredSchemes.clear();
|
|
this.registeredSchemes.putAll(map);
|
|
}
|
|
|
|
public void unregister(String str) {
|
|
Args.notNull(str, "Name");
|
|
this.registeredSchemes.remove(str.toLowerCase(Locale.ENGLISH));
|
|
}
|
|
}
|