Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.
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
20 changes: 13 additions & 7 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@ group 'za.co.britehouse.flutter_microsoft_authentication'
version '1.0-SNAPSHOT'

buildscript {
ext.kotlin_version = '1.3.60'
ext.kotlin_version = '1.5.10'
repositories {
google()
jcenter()
maven {
url 'https://pkgs.dev.azure.com/MicrosoftDeviceSDK/DuoSDK-Public/_packaging/Duo-SDK-Feed/maven/v1'
}
}

dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.android.tools.build:gradle:4.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
}
Expand All @@ -19,6 +22,9 @@ rootProject.allprojects {
repositories {
google()
jcenter()
maven {
url 'https://pkgs.dev.azure.com/MicrosoftDeviceSDK/DuoSDK-Public/_packaging/Duo-SDK-Feed/maven/v1'
}
}
}

Expand All @@ -27,7 +33,7 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlinx-serialization'

android {
compileSdkVersion 28
compileSdkVersion 30

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -42,15 +48,15 @@ android {
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.9.1"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.20.0"
if (findProject(':msal') != null) {
// For developer team only.
localImplementation project(':msal')
externalImplementation 'com.microsoft.identity.client:msal:1.4.0'
externalImplementation 'com.microsoft.identity.client:msal:2.0.+'
}
else {
// Downloads and Builds MSAL from maven central.
implementation 'com.microsoft.identity.client:msal:1.4.0'
implementation 'com.microsoft.identity.client:msal:2.0.+'
}
}
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
Original file line number Diff line number Diff line change
Expand Up @@ -38,29 +38,10 @@ class FlutterMicrosoftAuthenticationPlugin: MethodCallHandler {

override fun onMethodCall(call: MethodCall, result: Result) {

val scopesArg : ArrayList<String>? = call.argument("kScopes")
val scopes: Array<String>? = scopesArg?.toTypedArray()
val authority: String? = call.argument("kAuthority")
val configPath: String? = call.argument("configPath")


if (configPath == null) {
Log.d(TAG, "no config")
result.error("NO_CONFIG","Call must include a config file path", null)
return
}

if(scopes == null){
Log.d(TAG, "no scope")
result.error("NO_SCOPE","Call must include a scope", null)
return
}

if(authority == null){
Log.d(TAG,"error no authority")
result.error("NO_AUTHORITY", "Call must include an authority", null)
return
}
val scopesArg : ArrayList<String> = call.argument("scopes")!!
val scopes: Array<String> = scopesArg?.toTypedArray()!!
val authority: String = call.argument("authority")!!
val configPath: String = call.argument("configPath")!!

when(call.method){
"acquireTokenInteractively" -> acquireTokenInteractively(scopes, authority, result)
Expand Down Expand Up @@ -126,7 +107,7 @@ class FlutterMicrosoftAuthenticationPlugin: MethodCallHandler {
}

override fun onError(exception: MsalException) {
Log.e(TAG, exception.message)
Log.e(TAG, exception.message!!)
}
})
}
Expand Down Expand Up @@ -158,7 +139,7 @@ class FlutterMicrosoftAuthenticationPlugin: MethodCallHandler {
}

override fun onError(exception: MsalException) {
Log.e(TAG, exception.message)
Log.e(TAG, exception.message!!)
result.error("ERROR", exception.errorCode, null)
}
})
Expand Down Expand Up @@ -261,7 +242,7 @@ class FlutterMicrosoftAuthenticationPlugin: MethodCallHandler {
}

override fun onError(exception: MsalException) {
Log.e(TAG, exception.message)
Log.e(TAG, exception.message!!)
result.error("MsalException", exception.message, null)
}
})
Expand Down
2 changes: 1 addition & 1 deletion example/.flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"flutter_microsoft_authentication","dependencies":[]}]}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_microsoft_authentication","path":"C:\\\\Users\\\\crist\\\\Desktop\\\\GitHub\\\\flutter-microsoft-authentication\\\\","dependencies":[]}],"android":[{"name":"flutter_microsoft_authentication","path":"C:\\\\Users\\\\crist\\\\Desktop\\\\GitHub\\\\flutter-microsoft-authentication\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_microsoft_authentication","dependencies":[]}],"date_created":"2021-05-26 12:55:26.478563","version":"2.2.0"}
10 changes: 3 additions & 7 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 28
compileSdkVersion 30

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -40,10 +40,9 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "za.co.britehouse.flutter_microsoft_authentication_example"
minSdkVersion 19
targetSdkVersion 28
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

buildTypes {
Expand All @@ -64,8 +63,5 @@ flutter {
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}
7 changes: 0 additions & 7 deletions example/android/app/src/debug/AndroidManifest.xml

This file was deleted.

47 changes: 22 additions & 25 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,45 +1,42 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="za.co.britehouse.flutter_microsoft_authentication_example">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="flutter_microsoft_authentication_example"
android:icon="@mipmap/ic_launcher">
<meta-data
android:name="flutterEmbedding"
android:value="2" />

<activity
android:name="com.microsoft.identity.client.BrowserTabActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="msauth"
android:host="za.co.britehouse.flutter_microsoft_authentication_example"
android:path="/1wIqXSqBj7w+h11ZifsnqwgyKrY=" />
</intent-filter>
</activity>

<activity
android:name=".MainActivity"
android:name="io.flutter.embedding.android.FlutterActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in @style/LaunchTheme). -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />

<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

<activity android:name="com.microsoft.identity.client.BrowserTabActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="com.azuresamples.msalandroidkotlinapp"
android:path="/1wIqXSqBj7w+h11ZifsnqwgyKrY="
android:scheme="msauth" />
</intent-filter>
</activity>

</application>
</manifest>

This file was deleted.

7 changes: 0 additions & 7 deletions example/android/app/src/profile/AndroidManifest.xml

This file was deleted.

4 changes: 2 additions & 2 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.3.60'
ext.kotlin_version = '1.5.10'
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.android.tools.build:gradle:4.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
2 changes: 1 addition & 1 deletion example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
org.gradle.jvmargs=-Xmx1536M

android.enableR8=true
android.useAndroidX=true
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
Loading