导航菜单

页面标题

页面副标题

St.John's v1.0.9 - PopAuthenticationSchemeInternal.java 源代码

正在查看: St.John's v1.0.9 应用的 PopAuthenticationSchemeInternal.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.microsoft.identity.common.java.authscheme;

import com.google.gson.annotations.SerializedName;
import com.microsoft.identity.common.java.authscheme.TokenAuthenticationScheme;
import com.microsoft.identity.common.java.crypto.IDevicePopManager;
import com.microsoft.identity.common.java.exception.ClientException;
import com.microsoft.identity.common.java.util.IClockSkewManager;
import java.net.URL;

public class PopAuthenticationSchemeInternal extends TokenAuthenticationScheme implements IPoPAuthenticationSchemeParams {
    public static final String SCHEME_POP = "PoP";
    private static final long serialVersionUID = 788393037295696358L;

    @SerializedName(SerializedNames.CLIENT_CLAIMS)
    private String mClientClaims;
    private transient IClockSkewManager mClockSkewManager;

    @SerializedName(SerializedNames.HTTP_METHOD)
    private String mHttpMethod;

    @SerializedName("nonce")
    private String mNonce;
    private transient IDevicePopManager mPopManager;

    @SerializedName(SerializedNames.URL)
    private URL mUrl;

    public static final class SerializedNames {
        public static final String CLIENT_CLAIMS = "client_claims";
        public static final String HTTP_METHOD = "http_method";
        public static final String KID = "kid";
        public static final String NONCE = "nonce";
        public static final String URL = "url";
    }

    public static abstract class PopAuthenticationSchemeInternalBuilder<C extends PopAuthenticationSchemeInternal, B extends PopAuthenticationSchemeInternalBuilder<C, B>> extends TokenAuthenticationScheme.TokenAuthenticationSchemeBuilder<C, B> {
        private String clientClaims;
        private IClockSkewManager clockSkewManager;
        private String httpMethod;
        private String nonce;
        private IDevicePopManager popManager;
        private URL url;

        @Override
        public abstract C build();

        @Override
        public abstract B self();

        private static void $fillValuesFromInstanceIntoBuilder(PopAuthenticationSchemeInternal popAuthenticationSchemeInternal, PopAuthenticationSchemeInternalBuilder<?, ?> popAuthenticationSchemeInternalBuilder) {
            popAuthenticationSchemeInternalBuilder.clockSkewManager(popAuthenticationSchemeInternal.mClockSkewManager);
            popAuthenticationSchemeInternalBuilder.httpMethod(popAuthenticationSchemeInternal.mHttpMethod);
            popAuthenticationSchemeInternalBuilder.url(popAuthenticationSchemeInternal.mUrl);
            popAuthenticationSchemeInternalBuilder.nonce(popAuthenticationSchemeInternal.mNonce);
            popAuthenticationSchemeInternalBuilder.clientClaims(popAuthenticationSchemeInternal.mClientClaims);
            popAuthenticationSchemeInternalBuilder.popManager(popAuthenticationSchemeInternal.mPopManager);
        }

        @Override
        public B $fillValuesFrom(C c) {
            super.$fillValuesFrom((PopAuthenticationSchemeInternalBuilder<C, B>) c);
            $fillValuesFromInstanceIntoBuilder((PopAuthenticationSchemeInternal) c, (PopAuthenticationSchemeInternalBuilder<?, ?>) this);
            return self();
        }

        public B clientClaims(String str) {
            this.clientClaims = str;
            return self();
        }

        public B clockSkewManager(IClockSkewManager iClockSkewManager) {
            this.clockSkewManager = iClockSkewManager;
            return self();
        }

        public B httpMethod(String str) {
            this.httpMethod = str;
            return self();
        }

        public B nonce(String str) {
            this.nonce = str;
            return self();
        }

        public B popManager(IDevicePopManager iDevicePopManager) {
            this.popManager = iDevicePopManager;
            return self();
        }

        @Override
        public String toString() {
            return "PopAuthenticationSchemeInternal.PopAuthenticationSchemeInternalBuilder(super=" + super.toString() + ", clockSkewManager=" + this.clockSkewManager + ", httpMethod=" + this.httpMethod + ", url=" + this.url + ", nonce=" + this.nonce + ", clientClaims=" + this.clientClaims + ", popManager=" + this.popManager + ")";
        }

        public B url(URL url) {
            this.url = url;
            return self();
        }
    }

    private static final class PopAuthenticationSchemeInternalBuilderImpl extends PopAuthenticationSchemeInternalBuilder<PopAuthenticationSchemeInternal, PopAuthenticationSchemeInternalBuilderImpl> {
        @Override
        public PopAuthenticationSchemeInternalBuilderImpl self() {
            return this;
        }

        private PopAuthenticationSchemeInternalBuilderImpl() {
        }

        @Override
        public PopAuthenticationSchemeInternal build() {
            return new PopAuthenticationSchemeInternal(this);
        }
    }

    protected PopAuthenticationSchemeInternal(PopAuthenticationSchemeInternalBuilder<?, ?> popAuthenticationSchemeInternalBuilder) {
        super(popAuthenticationSchemeInternalBuilder);
        this.mClockSkewManager = ((PopAuthenticationSchemeInternalBuilder) popAuthenticationSchemeInternalBuilder).clockSkewManager;
        this.mHttpMethod = ((PopAuthenticationSchemeInternalBuilder) popAuthenticationSchemeInternalBuilder).httpMethod;
        this.mUrl = ((PopAuthenticationSchemeInternalBuilder) popAuthenticationSchemeInternalBuilder).url;
        this.mNonce = ((PopAuthenticationSchemeInternalBuilder) popAuthenticationSchemeInternalBuilder).nonce;
        this.mClientClaims = ((PopAuthenticationSchemeInternalBuilder) popAuthenticationSchemeInternalBuilder).clientClaims;
        this.mPopManager = ((PopAuthenticationSchemeInternalBuilder) popAuthenticationSchemeInternalBuilder).popManager;
    }

    public static PopAuthenticationSchemeInternalBuilder<?, ?> builder() {
        return new PopAuthenticationSchemeInternalBuilderImpl();
    }

    public PopAuthenticationSchemeInternalBuilder<?, ?> toBuilder() {
        return new PopAuthenticationSchemeInternalBuilderImpl().$fillValuesFrom((PopAuthenticationSchemeInternalBuilderImpl) this);
    }

    @Override
    protected boolean canEqual(Object obj) {
        return obj instanceof PopAuthenticationSchemeInternal;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof PopAuthenticationSchemeInternal)) {
            return false;
        }
        PopAuthenticationSchemeInternal popAuthenticationSchemeInternal = (PopAuthenticationSchemeInternal) obj;
        if (!popAuthenticationSchemeInternal.canEqual(this) || !super.equals(obj)) {
            return false;
        }
        String httpMethod = getHttpMethod();
        String httpMethod2 = popAuthenticationSchemeInternal.getHttpMethod();
        if (httpMethod != null ? !httpMethod.equals(httpMethod2) : httpMethod2 != null) {
            return false;
        }
        URL url = getUrl();
        URL url2 = popAuthenticationSchemeInternal.getUrl();
        if (url != null ? !url.equals(url2) : url2 != null) {
            return false;
        }
        String nonce = getNonce();
        String nonce2 = popAuthenticationSchemeInternal.getNonce();
        if (nonce != null ? !nonce.equals(nonce2) : nonce2 != null) {
            return false;
        }
        String clientClaims = getClientClaims();
        String clientClaims2 = popAuthenticationSchemeInternal.getClientClaims();
        return clientClaims != null ? clientClaims.equals(clientClaims2) : clientClaims2 == null;
    }

    @Override
    public int hashCode() {
        int hashCode = super.hashCode();
        String httpMethod = getHttpMethod();
        int hashCode2 = (hashCode * 59) + (httpMethod == null ? 43 : httpMethod.hashCode());
        URL url = getUrl();
        int hashCode3 = (hashCode2 * 59) + (url == null ? 43 : url.hashCode());
        String nonce = getNonce();
        int hashCode4 = (hashCode3 * 59) + (nonce == null ? 43 : nonce.hashCode());
        String clientClaims = getClientClaims();
        return (hashCode4 * 59) + (clientClaims != null ? clientClaims.hashCode() : 43);
    }

    PopAuthenticationSchemeInternal() {
        super(SCHEME_POP);
    }

    public PopAuthenticationSchemeInternal(IClockSkewManager iClockSkewManager, IDevicePopManager iDevicePopManager, String str, URL url, String str2, String str3) {
        super(SCHEME_POP);
        if (iClockSkewManager == null) {
            throw new NullPointerException("clockSkewManager is marked non-null but is null");
        }
        if (iDevicePopManager == null) {
            throw new NullPointerException("popManager is marked non-null but is null");
        }
        if (url == null) {
            throw new NullPointerException("url is marked non-null but is null");
        }
        this.mClockSkewManager = iClockSkewManager;
        this.mPopManager = iDevicePopManager;
        this.mHttpMethod = str;
        this.mUrl = url;
        this.mNonce = str2;
        this.mClientClaims = str3;
    }

    public PopAuthenticationSchemeInternal(IDevicePopManager iDevicePopManager, String str, URL url, String str2, String str3) {
        super(SCHEME_POP);
        if (iDevicePopManager == null) {
            throw new NullPointerException("popManager is marked non-null but is null");
        }
        if (url == null) {
            throw new NullPointerException("url is marked non-null but is null");
        }
        this.mClockSkewManager = null;
        this.mPopManager = iDevicePopManager;
        this.mHttpMethod = str;
        this.mUrl = url;
        this.mNonce = str2;
        this.mClientClaims = str3;
    }

    @Override
    public String getAccessTokenForScheme(String str) throws ClientException {
        if (str == null) {
            throw new NullPointerException("accessToken is marked non-null but is null");
        }
        IClockSkewManager iClockSkewManager = this.mClockSkewManager;
        if (iClockSkewManager == null) {
            throw new RuntimeException("IClockSkewManager not initialized.");
        }
        return this.mPopManager.mintSignedAccessToken(getHttpMethod(), iClockSkewManager.getAdjustedReferenceTime().getTime() / 1000, getUrl(), str, getNonce(), getClientClaims());
    }

    public void setClockSkewManager(IClockSkewManager iClockSkewManager) {
        if (iClockSkewManager == null) {
            throw new NullPointerException("clockSkewManager is marked non-null but is null");
        }
        this.mClockSkewManager = iClockSkewManager;
    }

    public void setDevicePopManager(IDevicePopManager iDevicePopManager) {
        if (iDevicePopManager == null) {
            throw new NullPointerException("devicePopManager is marked non-null but is null");
        }
        this.mPopManager = iDevicePopManager;
    }

    @Override
    public String getHttpMethod() {
        return this.mHttpMethod;
    }

    @Override
    public URL getUrl() {
        return this.mUrl;
    }

    @Override
    public String getClientClaims() {
        return this.mClientClaims;
    }

    @Override
    public String getNonce() {
        return this.mNonce;
    }
}