Skip to content

upgraded masl lib to 4.1.+ #20

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
29 changes: 13 additions & 16 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ allprojects {
password System.getenv("ENV_VSTS_MVN_ANDROIDADAL_ACCESSTOKEN") != null ? System.getenv("ENV_VSTS_MVN_ANDROIDADAL_ACCESSTOKEN") : project.findProperty("vstsMavenAccessToken")
}
}
jcenter()
}
}

Expand All @@ -29,12 +28,11 @@ android {
keyPassword 'android'
}
}
compileSdkVersion 28
buildToolsVersion "29.0.0"
compileSdkVersion 32
defaultConfig {
applicationId "com.azuresamples.msalandroidkotlinapp"
minSdkVersion 19
targetSdkVersion 28
minSdkVersion 23
targetSdkVersion 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -60,23 +58,22 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.android.volley:volley:1.1.1'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.android.material:material:1.6.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.5.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'com.android.volley:volley:1.2.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
if (findProject(':msal') != null) {
// For developer team only.
localImplementation project(':msal')
externalImplementation 'com.microsoft.identity.client:msal:1.0.+'
externalImplementation 'com.microsoft.identity.client:msal:4.1.+'
}
else {
// Downloads and Builds MSAL from maven central.
implementation 'com.microsoft.identity.client:msal:1.0.+'
implementation 'com.microsoft.identity.client:msal:4.1.+'
}
}
6 changes: 4 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:exported="true"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
Expand All @@ -23,7 +23,9 @@
</intent-filter>
</activity>

<activity android:name="com.microsoft.identity.client.BrowserTabActivity">
<activity
android:name="com.microsoft.identity.client.BrowserTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class B2CModeFragment : Fragment() {


// Creates a PublicClientApplication object with res/raw/auth_config_single_account.json
PublicClientApplication.createMultipleAccountPublicClientApplication(context!!,
PublicClientApplication.createMultipleAccountPublicClientApplication(requireContext(),
R.raw.auth_config_b2c,
object : IMultipleAccountApplicationCreatedListener {
override fun onCreated(application: IMultipleAccountPublicClientApplication) {
Expand All @@ -94,7 +94,7 @@ class B2CModeFragment : Fragment() {
private fun initializeUI() {

val dataAdapter = ArrayAdapter<String>(
context, android.R.layout.simple_spinner_item,
requireContext(), android.R.layout.simple_spinner_item,
object : ArrayList<String?>() {
init {
for (policyName in B2CConfiguration.Policies) add(policyName)
Expand Down Expand Up @@ -301,7 +301,7 @@ class B2CModeFragment : Fragment() {
btn_acquireTokenSilently!!.isEnabled = false
}
val dataAdapter = ArrayAdapter<String>(
context, android.R.layout.simple_spinner_item,
requireContext(), android.R.layout.simple_spinner_item,
object : ArrayList<String?>() {
init {
for (user in users) add(user.displayName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import com.microsoft.identity.client.IMultipleAccountPublicClientApplication.Rem
import com.microsoft.identity.client.SilentAuthenticationCallback
import com.microsoft.identity.client.exception.MsalException
import com.microsoft.identity.client.exception.MsalUiRequiredException
import com.microsoft.identity.common.internal.providers.oauth2.IDToken
import com.microsoft.identity.common.java.providers.oauth2.IDToken
import java.util.*

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class MultipleAccountModeFragment : Fragment() {
}

val dataAdapter = ArrayAdapter(
context!!, android.R.layout.simple_spinner_item,
requireContext(), android.R.layout.simple_spinner_item,
object : ArrayList<String>() {
init {
for (account in result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class SingleAccountModeFragment : Fragment() {
* - the resource you're acquiring a token for has a stricter set of requirement than your SSO refresh token.
* - you're introducing a new scope which the user has never consented for.
*/
mSingleAccountApp!!.acquireToken(activity!!, getScopes(), getAuthInteractiveCallback())
mSingleAccountApp!!.acquireToken(requireActivity(), getScopes(), getAuthInteractiveCallback())
})

btn_callGraphSilently.setOnClickListener(View.OnClickListener {
Expand Down Expand Up @@ -266,15 +266,15 @@ class SingleAccountModeFragment : Fragment() {
*/
private fun callGraphAPI(authenticationResult: IAuthenticationResult) {
MSGraphRequestWrapper.callGraphAPIWithVolley(
context as Context,
requireContext(),
msgraph_url.text.toString(),
authenticationResult.accessToken,
Response.Listener<JSONObject> { response ->
{ response ->
/* Successfully called graph, process data and send to UI */
Log.d(TAG, "Response: $response")
displayGraphResult(response)
},
Response.ErrorListener { error ->
{ error ->
Log.d(TAG, "Error: $error")
displayError(error)
})
Expand Down
8 changes: 0 additions & 8 deletions app/src/main/res/values-v21/styles.xml

This file was deleted.

2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<resources>
<string name="app_name">My Application</string>
<string name="app_name">MSAL Sample</string>
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>
<string name="nav_header_title">Android Studio</string>
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
Expand All @@ -11,6 +11,7 @@
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
Expand Down
12 changes: 7 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.31'
ext.kotlin_version = '1.7.10'
repositories {
google()
jcenter()
mavenCentral()
maven {
name "vsts-maven-adal-android"
url "https://identitydivision.pkgs.visualstudio.com/_packaging/AndroidADAL/maven/v1"
Expand All @@ -16,7 +16,7 @@ buildscript {

}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.android.tools.build:gradle:4.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -26,8 +26,10 @@ buildscript {
allprojects {
repositories {
google()
jcenter()

mavenCentral()
maven {
url 'https://pkgs.dev.azure.com/MicrosoftDeviceSDK/DuoSDK-Public/_packaging/Duo-SDK-Feed/maven/v1'
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Sep 16 19:55:15 PDT 2019
#Fri Jan 13 11:52:09 AEDT 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
zipStoreBase=GRADLE_USER_HOME