Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Teams app check removed #2467

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@

package com.microsoft.identity.common.internal.broker;

import static com.microsoft.identity.common.adal.internal.AuthenticationConstants.Broker.IPPHONE_APP_DEBUG_SIGNATURE;
import static com.microsoft.identity.common.adal.internal.AuthenticationConstants.Broker.IPPHONE_APP_PACKAGE_NAME;
import static com.microsoft.identity.common.adal.internal.AuthenticationConstants.Broker.IPPHONE_APP_SIGNATURE;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
Expand All @@ -38,7 +34,6 @@

import androidx.annotation.NonNull;

import com.microsoft.identity.common.BuildConfig;
import com.microsoft.identity.common.adal.internal.AuthenticationConstants;
import com.microsoft.identity.common.adal.internal.util.StringExtensions;
import com.microsoft.identity.common.logging.Logger;
Expand Down Expand Up @@ -256,26 +251,4 @@ public static PackageInfo getPackageInfo(@NonNull PackageManager packageManager,
public static Signature[] getSignatures(@NonNull Context context) throws PackageManager.NameNotFoundException {
return getSignatures(getPackageInfo(context.getPackageManager(), context.getPackageName()));
}

/**
* Validate if provided package name is a valid teams app package
* @return true if context is from Teams app, false otherwise
*/
public boolean verifyIfValidTeamsPackage(final String packageName) {
// Bypass if the request made on a debug MSAL build.
if (BuildConfig.DEBUG) {
return true;
}

if (packageName.equals(IPPHONE_APP_PACKAGE_NAME) &&
isPackageInstalledAndEnabled(IPPHONE_APP_PACKAGE_NAME)) {
final String currentSignatureForTeamsApp = getSha1SignatureForPackage(IPPHONE_APP_PACKAGE_NAME);
if (IPPHONE_APP_SIGNATURE.equals(currentSignatureForTeamsApp) ||
IPPHONE_APP_DEBUG_SIGNATURE.equals(currentSignatureForTeamsApp)) {
return true;
}
}

return false;
}
}
Loading