导航菜单

页面标题

页面副标题

BodyTech v7.6.4 - AuthorizationManagementActivity.java 源代码

正在查看: BodyTech v7.6.4 应用的 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 androidx.appcompat.app.AppCompatActivity;
import com.newrelic.agent.android.api.v2.TraceFieldInterface;
import com.newrelic.agent.android.background.ApplicationStateMonitor;
import com.newrelic.agent.android.instrumentation.Instrumented;
import com.newrelic.agent.android.tracing.Trace;
import com.newrelic.agent.android.tracing.TraceMachine;
import java.util.ArrayList;
import net.openid.appauth.AuthorizationException;
import org.json.JSONException;

@Instrumented
public class AuthorizationManagementActivity extends AppCompatActivity implements TraceFieldInterface {
    private boolean c = false;
    private Intent d;
    private gl.b e;
    private PendingIntent k;
    private PendingIntent n;
    public Trace p;

    private static Intent A(Context context) {
        return new Intent(context, (Class<?>) AuthorizationManagementActivity.class);
    }

    public static Intent B(Context context, Uri uri) {
        Intent A = A(context);
        A.setData(uri);
        A.addFlags(603979776);
        return A;
    }

    public static Intent C(Context context, gl.b bVar, Intent intent) {
        return D(context, bVar, intent, null, null);
    }

    public static Intent D(Context context, gl.b bVar, Intent intent, PendingIntent pendingIntent, PendingIntent pendingIntent2) {
        Intent A = A(context);
        A.putExtra("authIntent", intent);
        A.putExtra("authRequest", bVar.b());
        A.putExtra("authRequestType", c.c(bVar));
        A.putExtra("completeIntent", pendingIntent);
        A.putExtra("cancelIntent", pendingIntent2);
        return A;
    }

    private Intent E(Uri uri) {
        if (uri.getQueryParameterNames().contains("error")) {
            return AuthorizationException.j(uri).n();
        }
        gl.c d = c.d(this.e, uri);
        if ((this.e.getState() != null || d.a() == null) && (this.e.getState() == null || this.e.getState().equals(d.a()))) {
            return d.d();
        }
        jl.a.h("State returned in authorization response (%s) does not match state from request (%s) - discarding response", d.a(), this.e.getState());
        return AuthorizationException.a.j.n();
    }

    private void F(Bundle bundle) {
        if (bundle == null) {
            jl.a.h("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.k = (PendingIntent) bundle.getParcelable("completeIntent");
        this.n = (PendingIntent) bundle.getParcelable("cancelIntent");
        try {
            String string = bundle.getString("authRequest", null);
            this.e = string != null ? c.b(string, bundle.getString("authRequestType", null)) : null;
        } catch (JSONException unused) {
            J(this.n, AuthorizationException.a.a.n(), 0);
        }
    }

    private void G() {
        jl.a.a("Authorization flow canceled by user", new Object[0]);
        J(this.n, AuthorizationException.l(AuthorizationException.b.b, null).n(), 0);
    }

    private void H() {
        Uri data = getIntent().getData();
        Intent E = E(data);
        if (E == null) {
            jl.a.c("Failed to extract OAuth2 response from redirect", new Object[0]);
        } else {
            E.setData(data);
            J(this.k, E, -1);
        }
    }

    private void I() {
        jl.a.a("Authorization flow canceled due to missing browser", new Object[0]);
        J(this.n, AuthorizationException.l(AuthorizationException.b.c, null).n(), 0);
    }

    private void J(PendingIntent pendingIntent, Intent intent, int i) {
        if (pendingIntent == null) {
            setResult(i, intent);
            return;
        }
        try {
            pendingIntent.send((Context) this, 0, intent);
        } catch (PendingIntent.CanceledException e) {
            jl.a.c("Failed to send cancel intent", e);
        }
    }

    protected void onCreate(Bundle bundle) {
        TraceMachine.startTracing("AuthorizationManagementActivity");
        try {
            TraceMachine.enterMethod(this.p, "AuthorizationManagementActivity#onCreate", (ArrayList) null);
        } catch (NoSuchFieldError unused) {
            TraceMachine.enterMethod((Trace) null, "AuthorizationManagementActivity#onCreate", (ArrayList) null);
        }
        super/*androidx.fragment.app.FragmentActivity*/.onCreate(bundle);
        if (bundle == null) {
            F(getIntent().getExtras());
        } else {
            F(bundle);
        }
        TraceMachine.exitMethod();
    }

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

    protected void onResume() {
        super/*androidx.fragment.app.FragmentActivity*/.onResume();
        if (this.c) {
            if (getIntent().getData() != null) {
                H();
            } else {
                G();
            }
            finish();
            return;
        }
        try {
            startActivity(this.d);
            this.c = true;
        } catch (ActivityNotFoundException unused) {
            I();
            finish();
        }
    }

    protected 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.b());
        bundle.putString("authRequestType", c.c(this.e));
        bundle.putParcelable("completeIntent", this.k);
        bundle.putParcelable("cancelIntent", this.n);
    }

    protected void onStart() {
        super.onStart();
        ApplicationStateMonitor.getInstance().activityStarted();
    }

    protected void onStop() {
        super.onStop();
        ApplicationStateMonitor.getInstance().activityStopped();
    }
}