导航菜单

页面标题

页面副标题

Meine NEW v2.0.3616 - AuthorizationManagementActivity.java 源代码

正在查看: Meine NEW v2.0.3616 应用的 AuthorizationManagementActivity.java JAVA 源代码文件

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


package net.openid.appauth;

import android.app.PendingIntent;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import c4.x0;
import com.google.gson.internal.u;
import com.microsoft.identity.common.adal.internal.AuthenticationConstants;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import net.openid.appauth.AuthorizationException;
import org.json.JSONException;

public class AuthorizationManagementActivity extends androidx.appcompat.app.f {
    public boolean c = false;
    public Intent d;
    public z6.c e;
    public PendingIntent f;
    public PendingIntent g;

    public final void g(Bundle bundle) {
        if (bundle == null) {
            c7.a.d().e(5, null, "No stored state - unable to handle response", new Object[0]);
            finish();
            return;
        }
        this.d = (Intent) bundle.getParcelable("authIntent");
        this.c = bundle.getBoolean("authStarted", false);
        this.f = (PendingIntent) bundle.getParcelable("completeIntent");
        this.g = (PendingIntent) bundle.getParcelable("cancelIntent");
        try {
            String string = bundle.getString("authRequest", null);
            this.e = string != null ? x0.u(string, bundle.getString("authRequestType", null)) : null;
        } catch (JSONException unused) {
            h(this.g, AuthorizationException.a.a.g(), 0);
        }
    }

    public final void h(PendingIntent pendingIntent, Intent intent, int i) {
        if (pendingIntent == null) {
            setResult(i, intent);
            return;
        }
        try {
            pendingIntent.send((Context) this, 0, intent);
        } catch (PendingIntent.CanceledException e) {
            c7.a.d().e(6, null, "Failed to send cancel intent", e);
        }
    }

    public final void onCreate(Bundle bundle) {
        super/*androidx.fragment.app.q*/.onCreate(bundle);
        if (bundle == null) {
            g(getIntent().getExtras());
        } else {
            g(bundle);
        }
    }

    public final void onNewIntent(Intent intent) {
        super/*androidx.activity.ComponentActivity*/.onNewIntent(intent);
        setIntent(intent);
    }

    public final void onResume() {
        u hVar;
        Intent h;
        String[] split;
        super/*androidx.fragment.app.q*/.onResume();
        if (!this.c) {
            try {
                startActivity(this.d);
                this.c = true;
                return;
            } catch (ActivityNotFoundException unused) {
                c7.a.c("Authorization flow canceled due to missing browser", new Object[0]);
                h(this.g, AuthorizationException.f(AuthorizationException.b.b, null).g(), 0);
                finish();
                return;
            }
        }
        if (getIntent().getData() != null) {
            Uri data = getIntent().getData();
            if (data.getQueryParameterNames().contains("error")) {
                int i = AuthorizationException.h;
                String queryParameter = data.getQueryParameter("error");
                String queryParameter2 = data.getQueryParameter("error_description");
                String queryParameter3 = data.getQueryParameter("error_uri");
                AuthorizationException authorizationException = AuthorizationException.a.d.get(queryParameter);
                if (authorizationException == null) {
                    authorizationException = AuthorizationException.a.b;
                }
                int i2 = authorizationException.c;
                int i3 = authorizationException.d;
                if (queryParameter2 == null) {
                    queryParameter2 = authorizationException.f;
                }
                h = new AuthorizationException(i2, i3, queryParameter, queryParameter2, queryParameter3 != null ? Uri.parse(queryParameter3) : authorizationException.g, null).g();
            } else {
                z6.c cVar = this.e;
                if (cVar instanceof z6.d) {
                    z6.d dVar = (z6.d) cVar;
                    x0.j(dVar, "authorization request cannot be null");
                    new LinkedHashMap();
                    String queryParameter4 = data.getQueryParameter("state");
                    x0.k("state must not be empty", queryParameter4);
                    String queryParameter5 = data.getQueryParameter(AuthenticationConstants.OAuth2.TOKEN_TYPE);
                    x0.k("tokenType must not be empty", queryParameter5);
                    String queryParameter6 = data.getQueryParameter("code");
                    x0.k("authorizationCode must not be empty", queryParameter6);
                    String queryParameter7 = data.getQueryParameter("access_token");
                    x0.k("accessToken must not be empty", queryParameter7);
                    String queryParameter8 = data.getQueryParameter(AuthenticationConstants.OAuth2.EXPIRES_IN);
                    Long valueOf = queryParameter8 != null ? Long.valueOf(Long.parseLong(queryParameter8)) : null;
                    Long valueOf2 = valueOf == null ? null : Long.valueOf(TimeUnit.SECONDS.toMillis(valueOf.longValue()) + System.currentTimeMillis());
                    String queryParameter9 = data.getQueryParameter("id_token");
                    x0.k("idToken cannot be empty", queryParameter9);
                    String queryParameter10 = data.getQueryParameter("scope");
                    String q = (TextUtils.isEmpty(queryParameter10) || (split = queryParameter10.split(" +")) == null) ? null : b4.d.q(Arrays.asList(split));
                    Set<String> set = b.k;
                    LinkedHashMap linkedHashMap = new LinkedHashMap();
                    for (String str : data.getQueryParameterNames()) {
                        if (!set.contains(str)) {
                            linkedHashMap.put(str, data.getQueryParameter(str));
                        }
                    }
                    hVar = new b(dVar, queryParameter4, queryParameter5, queryParameter6, queryParameter7, valueOf2, queryParameter9, q, Collections.unmodifiableMap(z6.a.b(linkedHashMap, b.k)));
                } else {
                    if (!(cVar instanceof z6.g)) {
                        throw new IllegalArgumentException("Malformed request or uri");
                    }
                    z6.g gVar = (z6.g) cVar;
                    x0.j(gVar, "request cannot be null");
                    String queryParameter11 = data.getQueryParameter("state");
                    if (queryParameter11 != null) {
                        x0.g(queryParameter11, "state must not be empty");
                    }
                    hVar = new z6.h(gVar, queryParameter11);
                }
                if ((this.e.getState() != null || hVar.d() == null) && (this.e.getState() == null || this.e.getState().equals(hVar.d()))) {
                    h = hVar.h();
                } else {
                    c7.a.d().e(5, null, "State returned in authorization response (%s) does not match state from request (%s) - discarding response", hVar.d(), this.e.getState());
                    h = AuthorizationException.a.c.g();
                }
            }
            if (h == null) {
                c7.a.d().e(6, null, "Failed to extract OAuth2 response from redirect", new Object[0]);
            } else {
                h.setData(data);
                h(this.f, h, -1);
            }
        } else {
            c7.a.c("Authorization flow canceled by user", new Object[0]);
            h(this.g, AuthorizationException.f(AuthorizationException.b.a, null).g(), 0);
        }
        finish();
    }

    public final void onSaveInstanceState(Bundle bundle) {
        super/*androidx.activity.ComponentActivity*/.onSaveInstanceState(bundle);
        bundle.putBoolean("authStarted", this.c);
        bundle.putParcelable("authIntent", this.d);
        bundle.putString("authRequest", this.e.a());
        z6.c cVar = this.e;
        bundle.putString("authRequestType", cVar instanceof z6.d ? AuthenticationConstants.AAD.AUTHORIZATION : cVar instanceof z6.g ? "end_session" : null);
        bundle.putParcelable("completeIntent", this.f);
        bundle.putParcelable("cancelIntent", this.g);
    }
}