├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── android ├── .gitignore ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── settings.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── kotlin │ └── za │ └── co │ └── britehouse │ └── flutter_microsoft_authentication │ └── FlutterMicrosoftAuthenticationPlugin.kt ├── example ├── .flutter-plugins-dependencies ├── .gitignore ├── .metadata ├── README.md ├── android │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── za │ │ │ │ │ └── co │ │ │ │ │ └── britehouse │ │ │ │ │ └── flutter_microsoft_authentication_example │ │ │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── raw │ │ │ │ └── auth_config_single_account.json │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── assets │ └── android_auth_config.json ├── ios │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Podfile │ ├── Podfile.lock │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ ├── Runner-Bridging-Header.h │ │ └── Runner.entitlements ├── lib │ └── main.dart ├── pubspec.lock ├── pubspec.yaml └── test │ └── widget_test.dart ├── flutter_microsoft_authentication.iml ├── ios ├── .gitignore ├── Assets │ └── .gitkeep ├── Classes │ ├── FlutterMicrosoftAuthenticationPlugin.h │ ├── FlutterMicrosoftAuthenticationPlugin.m │ └── SwiftFlutterMicrosoftAuthenticationPlugin.swift └── flutter_microsoft_authentication.podspec ├── lib └── flutter_microsoft_authentication.dart ├── pubspec.lock ├── pubspec.yaml └── test └── flutter_microsoft_authentication_test.dart /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | 9 | .idea 10 | .vscode -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 68587a0916366e9512a78df22c44163d041dd5f3 8 | channel: stable 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.1.1 2 | 3 | * Upgraded Android dependancy com.microsoft.identity.client:msal to latest version 4 | 5 | ## 0.1.0 6 | 7 | * Fixed issue on error where plugin would not initialise properly on first method call 8 | 9 | 10 | ## 0.0.4 11 | 12 | * Fixed dismiss error message on Android 13 | 14 | 15 | ## 0.0.3 16 | 17 | * Added error response messages to iOS 18 | 19 | 20 | ## 0.0.2 21 | 22 | * Android release 23 | 24 | 25 | ## 0.0.1 26 | 27 | * Initial release. 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Britehouse Mobility 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Getting Started 2 | 3 | ```dart 4 | import 'package:flutter_microsoft_authentication/flutter_microsoft_authentication.dart'; 5 | ... 6 | FlutterMicrosoftAuthentication fma = FlutterMicrosoftAuthentication( 7 | kClientID: "", 8 | kAuthority: "https://login.microsoftonline.com/organizations", 9 | kScopes: ["User.Read", "User.ReadBasic.All"], 10 | androidConfigAssetPath: "assets/auth_config.json" // Android MSAL Config file 11 | ); 12 | 13 | // Sign in interactively 14 | String authToken = await this.fma.acquireTokenInteractively; 15 | 16 | // Sign in silently 17 | String authToken = await this.fma.acquireTokenSilently; 18 | 19 | // Sign out 20 | await this.fma.signOut; 21 | 22 | // Android load account username 23 | await this.fma.loadAccount; 24 | ``` 25 | 26 | ### Flutter 27 | 28 | Import the [Flutter Microsoft Authentication package](https://pub.dev/packages/flutter_microsoft_authentication/) into your flutter application by adding it to the list of dependencies in your pubsec.yaml file. 29 | 30 | ``` 31 | dependencies: 32 | flutter_microsoft_authentication: ^0.1.0 33 | ``` 34 | 35 | ### Configuring MSAL for Android 36 | 37 | | [Getting Started](https://docs.microsoft.com/azure/active-directory/develop/guidedsetups/active-directory-android)| [Library](https://github.com/AzureAD/microsoft-authentication-library-for-android) | [API Reference](http://javadoc.io/doc/com.microsoft.identity.client/msal) | [Support](README.md#community-help-and-support) 38 | | --- | --- | --- | --- | 39 | 40 | 1) Register your app 41 | - Create App Registration in Azure Portal 42 | - In Authentication, add Android platform and fill in your bundle id 43 | - Make note of the MSAL Configuration 44 | 45 | 2) Add BrowserTabActivity with RedirectUri to Android Manifest.xml 46 | ```xml 47 | 48 | 49 | 50 | 51 | 52 | 56 | 57 | 58 | ``` 59 | 60 | 3) Create Msal Configuration JSON file 61 | ```json 62 | { 63 | "client_id": "", 64 | "authorization_user_agent": "DEFAULT", 65 | "redirect_uri": "", 66 | "account_mode": "SINGLE", 67 | "broker_redirect_uri_registered": true, 68 | "shared_device_mode_supported": true, 69 | "authorities": [ 70 | { 71 | "type": "", 72 | "audience": { 73 | "type": "", 74 | "tenant_id": "" 75 | } 76 | } 77 | ] 78 | } 79 | ``` 80 | 81 | 4) Add android MSAL config file to pubspec.yaml assets 82 | ``` 83 | assets 84 | - assets/auth_config.json 85 | ``` 86 | 87 | ### Configuring MSAL for iOS 88 | 89 | Library: 90 | https://github.com/AzureAD/microsoft-authentication-library-for-objc 91 | 92 | 1) Register your app 93 | - Create App Registration in Azure Portal 94 | - In Authentication, add iOS platform and fill in your bundle id 95 | - Make note of the MSAL Configuration 96 | 97 | 2) Add Keychain Sharing capability 98 | - In Xcode, under your applications Signing and Capabilities, add Keychain Sharing 99 | - Keychain Group should be `com.microsoft.adalcache` 100 | - Completely fine to have multiple Keychain Groups 101 | - This allows MSAL to use the keychain to share Microsoft Authentication sessions 102 | 103 | 3) Set up URL Schemes 104 | - Add the following CFBundleURLTypes to your `Info.plist` file. 105 | - Remember to replace the bundle id. 106 | ```xml 107 | CFBundleURLTypes 108 | 109 | 110 | CFBundleURLSchemes 111 | 112 | msauth.[BUNDLE_ID] 113 | 114 | 115 | 116 | ``` 117 | 118 | 4) Allow MSAL to use Microsoft Authenticator if it is installed 119 | - Add the following LSApplicationQueriesSchemes to your `Info.plist` file. 120 | ```xml 121 | LSApplicationQueriesSchemes 122 | 123 | msauthv2 124 | msauthv3 125 | 126 | ``` 127 | 128 | 5) Handle the redirect callback 129 | - Import MSAL 130 | ```swift 131 | ... 132 | import MSAL 133 | ... 134 | ``` 135 | 136 | - Within your AppDelegate.swift file add the following method 137 | 138 | ```swift 139 | override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { 140 | return MSALPublicClientApplication.handleMSALResponse(url, sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String) 141 | } 142 | ``` 143 | 144 | 6) Ensure that the minimum target is set to iOS 11 145 | - In Xcode, under General > Deployment info > Set the target to be no less than iOS 11 146 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'za.co.britehouse.flutter_microsoft_authentication' 2 | version '1.0-SNAPSHOT' 3 | 4 | buildscript { 5 | ext.kotlin_version = '1.3.60' 6 | repositories { 7 | google() 8 | jcenter() 9 | } 10 | 11 | dependencies { 12 | classpath 'com.android.tools.build:gradle:3.5.2' 13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 14 | classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" 15 | } 16 | } 17 | 18 | rootProject.allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | } 23 | } 24 | 25 | apply plugin: 'com.android.library' 26 | apply plugin: 'kotlin-android' 27 | apply plugin: 'kotlinx-serialization' 28 | 29 | android { 30 | compileSdkVersion 28 31 | 32 | sourceSets { 33 | main.java.srcDirs += 'src/main/kotlin' 34 | } 35 | defaultConfig { 36 | minSdkVersion 19 37 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 38 | } 39 | lintOptions { 40 | disable 'InvalidPackage' 41 | } 42 | } 43 | 44 | dependencies { 45 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 46 | implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.9.1" 47 | if (findProject(':msal') != null) { 48 | // For developer team only. 49 | localImplementation project(':msal') 50 | externalImplementation 'com.microsoft.identity.client:msal:1.4.0' 51 | } 52 | else { 53 | // Downloads and Builds MSAL from maven central. 54 | implementation 'com.microsoft.identity.client:msal:1.4.0' 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | kotlin.code.style=official -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 6 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'flutter_microsoft_authentication' 2 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /android/src/main/kotlin/za/co/britehouse/flutter_microsoft_authentication/FlutterMicrosoftAuthenticationPlugin.kt: -------------------------------------------------------------------------------- 1 | package za.co.britehouse.flutter_microsoft_authentication 2 | 3 | import android.app.Activity 4 | import android.content.Context 5 | import android.util.Log 6 | import com.microsoft.identity.client.* 7 | import com.microsoft.identity.client.exception.MsalClientException 8 | import com.microsoft.identity.client.exception.MsalException 9 | import com.microsoft.identity.client.exception.MsalServiceException 10 | import com.microsoft.identity.client.exception.MsalUiRequiredException 11 | import io.flutter.plugin.common.MethodCall 12 | import io.flutter.plugin.common.MethodChannel 13 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler 14 | import io.flutter.plugin.common.MethodChannel.Result 15 | import io.flutter.plugin.common.PluginRegistry.Registrar 16 | import java.io.File 17 | import java.io.FileOutputStream 18 | import java.io.IOException 19 | 20 | 21 | class FlutterMicrosoftAuthenticationPlugin: MethodCallHandler { 22 | private var mSingleAccountApp: ISingleAccountPublicClientApplication? = null 23 | 24 | companion object { 25 | 26 | lateinit var mainActivity: Activity 27 | lateinit var mRegistrar: Registrar 28 | private const val TAG = "FMAuthPlugin" 29 | 30 | @JvmStatic 31 | fun registerWith(registrar: Registrar) { 32 | val channel = MethodChannel(registrar.messenger(), "flutter_microsoft_authentication") 33 | channel.setMethodCallHandler(FlutterMicrosoftAuthenticationPlugin()) 34 | mainActivity = registrar.activity() 35 | mRegistrar = registrar 36 | } 37 | } 38 | 39 | override fun onMethodCall(call: MethodCall, result: Result) { 40 | 41 | val scopesArg : ArrayList? = call.argument("kScopes") 42 | val scopes: Array? = scopesArg?.toTypedArray() 43 | val authority: String? = call.argument("kAuthority") 44 | val configPath: String? = call.argument("configPath") 45 | 46 | 47 | if (configPath == null) { 48 | Log.d(TAG, "no config") 49 | result.error("NO_CONFIG","Call must include a config file path", null) 50 | return 51 | } 52 | 53 | if(scopes == null){ 54 | Log.d(TAG, "no scope") 55 | result.error("NO_SCOPE","Call must include a scope", null) 56 | return 57 | } 58 | 59 | if(authority == null){ 60 | Log.d(TAG,"error no authority") 61 | result.error("NO_AUTHORITY", "Call must include an authority", null) 62 | return 63 | } 64 | 65 | when(call.method){ 66 | "acquireTokenInteractively" -> acquireTokenInteractively(scopes, authority, result) 67 | "acquireTokenSilently" -> acquireTokenSilently(scopes, authority, result) 68 | "loadAccount" -> loadAccount(result) 69 | "signOut" -> signOut(result) 70 | "init" -> initPlugin(configPath) 71 | else -> result.notImplemented() 72 | } 73 | 74 | 75 | } 76 | 77 | @Throws(IOException::class) 78 | private fun getConfigFile(path: String): File { 79 | val key: String = mRegistrar.lookupKeyForAsset(path) 80 | val configFile = File(mainActivity.applicationContext.cacheDir, "config.json") 81 | 82 | 83 | 84 | try { 85 | val assetManager = mRegistrar.context().assets 86 | 87 | val inputStream = assetManager.open(key) 88 | val outputStream = FileOutputStream(configFile) 89 | try { 90 | Log.d(TAG, "File exists: ${configFile.exists()}") 91 | if (configFile.exists()) { 92 | outputStream.write("".toByteArray()) 93 | } 94 | inputStream.copyTo(outputStream) 95 | } finally { 96 | inputStream.close() 97 | outputStream.close() 98 | } 99 | return configFile 100 | 101 | } catch (e: IOException) { 102 | throw IOException("Could not open config file", e) 103 | } 104 | } 105 | 106 | private fun initPlugin(assetPath: String) { 107 | createSingleAccountPublicClientApplication(assetPath) 108 | } 109 | 110 | private fun createSingleAccountPublicClientApplication(assetPath: String) { 111 | val configFile = getConfigFile(assetPath) 112 | val context: Context = mainActivity.applicationContext 113 | 114 | PublicClientApplication.createSingleAccountPublicClientApplication( 115 | context, 116 | configFile, 117 | object : IPublicClientApplication.ISingleAccountApplicationCreatedListener { 118 | override fun onCreated(application: ISingleAccountPublicClientApplication) { 119 | /** 120 | * This test app assumes that the app is only going to support one account. 121 | * This requires "account_mode" : "SINGLE" in the config json file. 122 | * 123 | */ 124 | Log.d(TAG, "INITIALIZED") 125 | mSingleAccountApp = application 126 | } 127 | 128 | override fun onError(exception: MsalException) { 129 | Log.e(TAG, exception.message) 130 | } 131 | }) 132 | } 133 | 134 | private fun acquireTokenInteractively(scopes: Array, authority: String, result: Result) { 135 | if (mSingleAccountApp == null) { 136 | result.error("MsalClientException", "Account not initialized", null) 137 | } 138 | 139 | return mSingleAccountApp!!.signIn(mainActivity, "", scopes, getAuthInteractiveCallback(result)) 140 | } 141 | 142 | private fun acquireTokenSilently(scopes: Array, authority: String, result: Result) { 143 | if (mSingleAccountApp == null) { 144 | result.error("MsalClientException", "Account not initialized", null) 145 | } 146 | 147 | return mSingleAccountApp!!.acquireTokenSilentAsync(scopes, authority, getAuthSilentCallback(result)) 148 | } 149 | 150 | private fun signOut(result: Result){ 151 | if (mSingleAccountApp == null) { 152 | result.error("MsalClientException", "Account not initialized", null) 153 | } 154 | 155 | return mSingleAccountApp!!.signOut(object : ISingleAccountPublicClientApplication.SignOutCallback { 156 | override fun onSignOut() { 157 | result.success("SUCCESS") 158 | } 159 | 160 | override fun onError(exception: MsalException) { 161 | Log.e(TAG, exception.message) 162 | result.error("ERROR", exception.errorCode, null) 163 | } 164 | }) 165 | 166 | } 167 | 168 | private fun getAuthInteractiveCallback(result: Result): AuthenticationCallback { 169 | 170 | return object : AuthenticationCallback { 171 | 172 | override fun onSuccess(authenticationResult: IAuthenticationResult) { 173 | /* Successfully got a token, use it to call a protected resource - MSGraph */ 174 | Log.d(TAG, "Successfully authenticated") 175 | Log.d(TAG, "ID Token: " + authenticationResult.account.claims!!["id_token"]) 176 | val accessToken = authenticationResult.accessToken 177 | result.success(accessToken) 178 | } 179 | 180 | override fun onError(exception: MsalException) { 181 | /* Failed to acquireToken */ 182 | 183 | Log.d(TAG, "Authentication failed: ${exception.errorCode}") 184 | 185 | if (exception is MsalClientException) { 186 | /* Exception inside MSAL, more info inside MsalError.java */ 187 | Log.d(TAG, "Authentication failed: MsalClientException") 188 | result.error("MsalClientException",exception.errorCode, null) 189 | 190 | } else if (exception is MsalServiceException) { 191 | /* Exception when communicating with the STS, likely config issue */ 192 | Log.d(TAG, "Authentication failed: MsalServiceException") 193 | result.error("MsalServiceException",exception.errorCode, null) 194 | } 195 | } 196 | 197 | override fun onCancel() { 198 | /* User canceled the authentication */ 199 | Log.d(TAG, "User cancelled login.") 200 | result.error("MsalUserCancel", "User cancelled login.", null) 201 | } 202 | } 203 | } 204 | 205 | private fun getAuthSilentCallback(result: Result): AuthenticationCallback { 206 | return object : AuthenticationCallback { 207 | 208 | override fun onSuccess(authenticationResult: IAuthenticationResult) { 209 | Log.d(TAG, "Successfully authenticated") 210 | val accessToken = authenticationResult.accessToken 211 | result.success(accessToken) 212 | } 213 | 214 | override fun onError(exception: MsalException) { 215 | /* Failed to acquireToken */ 216 | Log.d(TAG, "Authentication failed: ${exception.message}") 217 | 218 | when (exception) { 219 | is MsalClientException -> { 220 | /* Exception inside MSAL, more info inside MsalError.java */ 221 | result.error("MsalClientException",exception.message, null) 222 | } 223 | is MsalServiceException -> { 224 | /* Exception when communicating with the STS, likely config issue */ 225 | result.error("MsalServiceException",exception.message, null) 226 | } 227 | is MsalUiRequiredException -> { 228 | /* Tokens expired or no session, retry with interactive */ 229 | result.error("MsalUiRequiredException",exception.message, null) 230 | } 231 | } 232 | } 233 | 234 | override fun onCancel() { 235 | /* User cancelled the authentication */ 236 | Log.d(TAG, "User cancelled login.") 237 | result.error("MsalUserCancel", "User cancelled login.", null) 238 | } 239 | } 240 | } 241 | 242 | private fun loadAccount(result: Result) { 243 | if (mSingleAccountApp == null) { 244 | result.error("MsalClientException", "Account not initialized", null) 245 | } 246 | 247 | return mSingleAccountApp!!.getCurrentAccountAsync(object : 248 | ISingleAccountPublicClientApplication.CurrentAccountCallback { 249 | override fun onAccountLoaded(activeAccount: IAccount?) { 250 | if (activeAccount != null) { 251 | result.success(activeAccount.username) 252 | } 253 | } 254 | 255 | override fun onAccountChanged(priorAccount: IAccount?, currentAccount: IAccount?) { 256 | if (currentAccount == null) { 257 | // Perform a cleanup task as the signed-in account changed. 258 | Log.d(TAG, "No Account") 259 | result.success(null) 260 | } 261 | } 262 | 263 | override fun onError(exception: MsalException) { 264 | Log.e(TAG, exception.message) 265 | result.error("MsalException", exception.message, null) 266 | } 267 | }) 268 | } 269 | 270 | } 271 | -------------------------------------------------------------------------------- /example/.flutter-plugins-dependencies: -------------------------------------------------------------------------------- 1 | {"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"flutter_microsoft_authentication","dependencies":[]}]} -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .packages 28 | .pub-cache/ 29 | .pub/ 30 | /build/ 31 | 32 | # Android related 33 | **/android/**/gradle-wrapper.jar 34 | **/android/.gradle 35 | **/android/captures/ 36 | **/android/gradlew 37 | **/android/gradlew.bat 38 | **/android/local.properties 39 | **/android/**/GeneratedPluginRegistrant.java 40 | 41 | # iOS/XCode related 42 | **/ios/**/*.mode1v3 43 | **/ios/**/*.mode2v3 44 | **/ios/**/*.moved-aside 45 | **/ios/**/*.pbxuser 46 | **/ios/**/*.perspectivev3 47 | **/ios/**/*sync/ 48 | **/ios/**/.sconsign.dblite 49 | **/ios/**/.tags* 50 | **/ios/**/.vagrant/ 51 | **/ios/**/DerivedData/ 52 | **/ios/**/Icon? 53 | **/ios/**/Pods/ 54 | **/ios/**/.symlinks/ 55 | **/ios/**/profile 56 | **/ios/**/xcuserdata 57 | **/ios/.generated/ 58 | **/ios/Flutter/App.framework 59 | **/ios/Flutter/Flutter.framework 60 | **/ios/Flutter/Generated.xcconfig 61 | **/ios/Flutter/app.flx 62 | **/ios/Flutter/app.zip 63 | **/ios/Flutter/flutter_assets/ 64 | **/ios/Flutter/flutter_export_environment.sh 65 | **/ios/ServiceDefinitions.json 66 | **/ios/Runner/GeneratedPluginRegistrant.* 67 | 68 | # Exceptions to above rules. 69 | !**/ios/**/default.mode1v3 70 | !**/ios/**/default.mode2v3 71 | !**/ios/**/default.pbxuser 72 | !**/ios/**/default.perspectivev3 73 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 74 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 68587a0916366e9512a78df22c44163d041dd5f3 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # flutter_microsoft_authentication_example 2 | 3 | Demonstrates how to use the flutter_microsoft_authentication plugin. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "za.co.britehouse.flutter_microsoft_authentication_example" 42 | minSdkVersion 19 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 47 | } 48 | 49 | buildTypes { 50 | release { 51 | // TODO: Add your own signing config for the release build. 52 | // Signing with the debug keys for now, so `flutter run --release` works. 53 | signingConfig signingConfigs.debug 54 | } 55 | } 56 | 57 | // aaptOptions { 58 | // noCompress "json" 59 | // } 60 | } 61 | 62 | flutter { 63 | source '../..' 64 | } 65 | 66 | dependencies { 67 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 68 | testImplementation 'junit:junit:4.12' 69 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 70 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 71 | } 72 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 13 | 20 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/za/co/britehouse/flutter_microsoft_authentication_example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package za.co.britehouse.flutter_microsoft_authentication_example 2 | 3 | import android.os.Bundle 4 | 5 | import io.flutter.app.FlutterActivity 6 | import io.flutter.plugins.GeneratedPluginRegistrant 7 | 8 | class MainActivity: FlutterActivity() { 9 | override fun onCreate(savedInstanceState: Bundle?) { 10 | super.onCreate(savedInstanceState) 11 | GeneratedPluginRegistrant.registerWith(this) 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/raw/auth_config_single_account.json: -------------------------------------------------------------------------------- 1 | { 2 | "client_id" : "0984a7b6-bc13-4141-8b0d-8f767e136bb7", 3 | "authorization_user_agent" : "DEFAULT", 4 | "redirect_uri" : "msauth://com.azuresamples.msalandroidkotlinapp/1wIqXSqBj7w%2Bh11ZifsnqwgyKrY%3D", 5 | "account_mode" : "SINGLE", 6 | "broker_redirect_uri_registered": true, 7 | "shared_device_mode_supported": false, 8 | "authorities" : [ 9 | { 10 | "type": "AAD", 11 | "audience": { 12 | "type": "AzureADandPersonalMicrosoftAccount", 13 | "tenant_id": "common" 14 | } 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.60' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.3.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | 3 | android.enableR8=true 4 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /example/assets/android_auth_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "client_id": "0984a7b6-bc13-4141-8b0d-8f767e136bb7", 3 | "authorization_user_agent": "DEFAULT", 4 | "redirect_uri": "msauth://com.azuresamples.msalandroidkotlinapp/1wIqXSqBj7w%2Bh11ZifsnqwgyKrY%3D", 5 | "account_mode": "SINGLE", 6 | "broker_redirect_uri_registered": true, 7 | "shared_device_mode_supported": true, 8 | "authorities": [ 9 | { 10 | "type": "AAD", 11 | "audience": { 12 | "type": "AzureADandPersonalMicrosoftAccount", 13 | "tenant_id": "common" 14 | } 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '10.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def parse_KV_file(file, separator='=') 14 | file_abs_path = File.expand_path(file) 15 | if !File.exists? file_abs_path 16 | return []; 17 | end 18 | pods_ary = [] 19 | skip_line_start_symbols = ["#", "/"] 20 | File.foreach(file_abs_path) { |line| 21 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } 22 | plugin = line.split(pattern=separator) 23 | if plugin.length == 2 24 | podname = plugin[0].strip() 25 | path = plugin[1].strip() 26 | podpath = File.expand_path("#{path}", file_abs_path) 27 | pods_ary.push({:name => podname, :path => podpath}); 28 | else 29 | puts "Invalid plugin specification: #{line}" 30 | end 31 | } 32 | return pods_ary 33 | end 34 | 35 | target 'Runner' do 36 | use_frameworks! 37 | 38 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock 39 | # referring to absolute paths on developers' machines. 40 | system('rm -rf .symlinks') 41 | system('mkdir -p .symlinks/plugins') 42 | 43 | # Flutter Pods 44 | generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') 45 | if generated_xcode_build_settings.empty? 46 | puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first." 47 | end 48 | generated_xcode_build_settings.map { |p| 49 | if p[:name] == 'FLUTTER_FRAMEWORK_DIR' 50 | symlink = File.join('.symlinks', 'flutter') 51 | File.symlink(File.dirname(p[:path]), symlink) 52 | pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) 53 | end 54 | } 55 | 56 | # Plugin Pods 57 | plugin_pods = parse_KV_file('../.flutter-plugins') 58 | plugin_pods.map { |p| 59 | symlink = File.join('.symlinks', 'plugins', p[:name]) 60 | File.symlink(p[:path], symlink) 61 | pod p[:name], :path => File.join(symlink, 'ios') 62 | } 63 | end 64 | 65 | # Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system. 66 | install! 'cocoapods', :disable_input_output_paths => true 67 | 68 | post_install do |installer| 69 | installer.pods_project.targets.each do |target| 70 | target.build_configurations.each do |config| 71 | config.build_settings['ENABLE_BITCODE'] = 'NO' 72 | end 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - flutter_microsoft_authentication (0.0.3): 4 | - Flutter 5 | - MSAL (~> 1.0.3) 6 | - MSAL (1.0.3): 7 | - MSAL/app-lib (= 1.0.3) 8 | - MSAL/app-lib (1.0.3) 9 | 10 | DEPENDENCIES: 11 | - Flutter (from `.symlinks/flutter/ios-release`) 12 | - flutter_microsoft_authentication (from `.symlinks/plugins/flutter_microsoft_authentication/ios`) 13 | 14 | SPEC REPOS: 15 | trunk: 16 | - MSAL 17 | 18 | EXTERNAL SOURCES: 19 | Flutter: 20 | :path: ".symlinks/flutter/ios-release" 21 | flutter_microsoft_authentication: 22 | :path: ".symlinks/plugins/flutter_microsoft_authentication/ios" 23 | 24 | SPEC CHECKSUMS: 25 | Flutter: 0e3d915762c693b495b44d77113d4970485de6ec 26 | flutter_microsoft_authentication: 121074a9b2f1babd8a335043111eb05820f1b6ac 27 | MSAL: 351711995bd31170a2e887941115a3ed17b178e8 28 | 29 | PODFILE CHECKSUM: 2c78efac486a5a4c55cbdb75659105e9a24d1328 30 | 31 | COCOAPODS: 1.8.4 32 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 4BB764561769CAA2B5558B0A /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8C6EA8BF6A93F04B367BAF59 /* Pods_Runner.framework */; }; 15 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 16 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 17 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 18 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 19 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 20 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 21 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXCopyFilesBuildPhase section */ 25 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 26 | isa = PBXCopyFilesBuildPhase; 27 | buildActionMask = 2147483647; 28 | dstPath = ""; 29 | dstSubfolderSpec = 10; 30 | files = ( 31 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 32 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 33 | ); 34 | name = "Embed Frameworks"; 35 | runOnlyForDeploymentPostprocessing = 0; 36 | }; 37 | /* End PBXCopyFilesBuildPhase section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 41 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 42 | 22E32F21BDE328FCCBC592B2 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 43 | 3666DD9933BD5521EA6171E0 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 44 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 45 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 46 | 5CA87B612384557200177C78 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; 47 | 6462C52E7C5B977722ADBCB5 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 48 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 49 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 50 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 51 | 8C6EA8BF6A93F04B367BAF59 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 53 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 54 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 55 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 56 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 57 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 58 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 59 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 60 | /* End PBXFileReference section */ 61 | 62 | /* Begin PBXFrameworksBuildPhase section */ 63 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 64 | isa = PBXFrameworksBuildPhase; 65 | buildActionMask = 2147483647; 66 | files = ( 67 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 68 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 69 | 4BB764561769CAA2B5558B0A /* Pods_Runner.framework in Frameworks */, 70 | ); 71 | runOnlyForDeploymentPostprocessing = 0; 72 | }; 73 | /* End PBXFrameworksBuildPhase section */ 74 | 75 | /* Begin PBXGroup section */ 76 | 90543E0EC5ED96DDD66FD3EC /* Pods */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | 3666DD9933BD5521EA6171E0 /* Pods-Runner.debug.xcconfig */, 80 | 6462C52E7C5B977722ADBCB5 /* Pods-Runner.release.xcconfig */, 81 | 22E32F21BDE328FCCBC592B2 /* Pods-Runner.profile.xcconfig */, 82 | ); 83 | path = Pods; 84 | sourceTree = ""; 85 | }; 86 | 9740EEB11CF90186004384FC /* Flutter */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 3B80C3931E831B6300D905FE /* App.framework */, 90 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 91 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 92 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 93 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 94 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 95 | ); 96 | name = Flutter; 97 | sourceTree = ""; 98 | }; 99 | 97C146E51CF9000F007C117D = { 100 | isa = PBXGroup; 101 | children = ( 102 | 9740EEB11CF90186004384FC /* Flutter */, 103 | 97C146F01CF9000F007C117D /* Runner */, 104 | 97C146EF1CF9000F007C117D /* Products */, 105 | 90543E0EC5ED96DDD66FD3EC /* Pods */, 106 | D760A4A368BF59E8450296B3 /* Frameworks */, 107 | ); 108 | sourceTree = ""; 109 | }; 110 | 97C146EF1CF9000F007C117D /* Products */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 97C146EE1CF9000F007C117D /* Runner.app */, 114 | ); 115 | name = Products; 116 | sourceTree = ""; 117 | }; 118 | 97C146F01CF9000F007C117D /* Runner */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | 5CA87B612384557200177C78 /* Runner.entitlements */, 122 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 123 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 124 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 125 | 97C147021CF9000F007C117D /* Info.plist */, 126 | 97C146F11CF9000F007C117D /* Supporting Files */, 127 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 128 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 129 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 130 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 131 | ); 132 | path = Runner; 133 | sourceTree = ""; 134 | }; 135 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | ); 139 | name = "Supporting Files"; 140 | sourceTree = ""; 141 | }; 142 | D760A4A368BF59E8450296B3 /* Frameworks */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | 8C6EA8BF6A93F04B367BAF59 /* Pods_Runner.framework */, 146 | ); 147 | name = Frameworks; 148 | sourceTree = ""; 149 | }; 150 | /* End PBXGroup section */ 151 | 152 | /* Begin PBXNativeTarget section */ 153 | 97C146ED1CF9000F007C117D /* Runner */ = { 154 | isa = PBXNativeTarget; 155 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 156 | buildPhases = ( 157 | 61BF9800A14F5B5EE9708C27 /* [CP] Check Pods Manifest.lock */, 158 | 9740EEB61CF901F6004384FC /* Run Script */, 159 | 97C146EA1CF9000F007C117D /* Sources */, 160 | 97C146EB1CF9000F007C117D /* Frameworks */, 161 | 97C146EC1CF9000F007C117D /* Resources */, 162 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 163 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 164 | 2756B0993B66F391E96A5435 /* [CP] Embed Pods Frameworks */, 165 | ); 166 | buildRules = ( 167 | ); 168 | dependencies = ( 169 | ); 170 | name = Runner; 171 | productName = Runner; 172 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 173 | productType = "com.apple.product-type.application"; 174 | }; 175 | /* End PBXNativeTarget section */ 176 | 177 | /* Begin PBXProject section */ 178 | 97C146E61CF9000F007C117D /* Project object */ = { 179 | isa = PBXProject; 180 | attributes = { 181 | LastUpgradeCheck = 1020; 182 | ORGANIZATIONNAME = "The Chromium Authors"; 183 | TargetAttributes = { 184 | 97C146ED1CF9000F007C117D = { 185 | CreatedOnToolsVersion = 7.3.1; 186 | DevelopmentTeam = W4BE9LK8UC; 187 | LastSwiftMigration = 0910; 188 | }; 189 | }; 190 | }; 191 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 192 | compatibilityVersion = "Xcode 3.2"; 193 | developmentRegion = en; 194 | hasScannedForEncodings = 0; 195 | knownRegions = ( 196 | en, 197 | Base, 198 | ); 199 | mainGroup = 97C146E51CF9000F007C117D; 200 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 201 | projectDirPath = ""; 202 | projectRoot = ""; 203 | targets = ( 204 | 97C146ED1CF9000F007C117D /* Runner */, 205 | ); 206 | }; 207 | /* End PBXProject section */ 208 | 209 | /* Begin PBXResourcesBuildPhase section */ 210 | 97C146EC1CF9000F007C117D /* Resources */ = { 211 | isa = PBXResourcesBuildPhase; 212 | buildActionMask = 2147483647; 213 | files = ( 214 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 215 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 216 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 217 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 218 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 219 | ); 220 | runOnlyForDeploymentPostprocessing = 0; 221 | }; 222 | /* End PBXResourcesBuildPhase section */ 223 | 224 | /* Begin PBXShellScriptBuildPhase section */ 225 | 2756B0993B66F391E96A5435 /* [CP] Embed Pods Frameworks */ = { 226 | isa = PBXShellScriptBuildPhase; 227 | buildActionMask = 2147483647; 228 | files = ( 229 | ); 230 | inputPaths = ( 231 | ); 232 | name = "[CP] Embed Pods Frameworks"; 233 | outputPaths = ( 234 | ); 235 | runOnlyForDeploymentPostprocessing = 0; 236 | shellPath = /bin/sh; 237 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 238 | showEnvVarsInLog = 0; 239 | }; 240 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 241 | isa = PBXShellScriptBuildPhase; 242 | buildActionMask = 2147483647; 243 | files = ( 244 | ); 245 | inputPaths = ( 246 | ); 247 | name = "Thin Binary"; 248 | outputPaths = ( 249 | ); 250 | runOnlyForDeploymentPostprocessing = 0; 251 | shellPath = /bin/sh; 252 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 253 | }; 254 | 61BF9800A14F5B5EE9708C27 /* [CP] Check Pods Manifest.lock */ = { 255 | isa = PBXShellScriptBuildPhase; 256 | buildActionMask = 2147483647; 257 | files = ( 258 | ); 259 | inputFileListPaths = ( 260 | ); 261 | inputPaths = ( 262 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 263 | "${PODS_ROOT}/Manifest.lock", 264 | ); 265 | name = "[CP] Check Pods Manifest.lock"; 266 | outputFileListPaths = ( 267 | ); 268 | outputPaths = ( 269 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 270 | ); 271 | runOnlyForDeploymentPostprocessing = 0; 272 | shellPath = /bin/sh; 273 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 274 | showEnvVarsInLog = 0; 275 | }; 276 | 9740EEB61CF901F6004384FC /* Run Script */ = { 277 | isa = PBXShellScriptBuildPhase; 278 | buildActionMask = 2147483647; 279 | files = ( 280 | ); 281 | inputPaths = ( 282 | ); 283 | name = "Run Script"; 284 | outputPaths = ( 285 | ); 286 | runOnlyForDeploymentPostprocessing = 0; 287 | shellPath = /bin/sh; 288 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 289 | }; 290 | /* End PBXShellScriptBuildPhase section */ 291 | 292 | /* Begin PBXSourcesBuildPhase section */ 293 | 97C146EA1CF9000F007C117D /* Sources */ = { 294 | isa = PBXSourcesBuildPhase; 295 | buildActionMask = 2147483647; 296 | files = ( 297 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 298 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 299 | ); 300 | runOnlyForDeploymentPostprocessing = 0; 301 | }; 302 | /* End PBXSourcesBuildPhase section */ 303 | 304 | /* Begin PBXVariantGroup section */ 305 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 306 | isa = PBXVariantGroup; 307 | children = ( 308 | 97C146FB1CF9000F007C117D /* Base */, 309 | ); 310 | name = Main.storyboard; 311 | sourceTree = ""; 312 | }; 313 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 314 | isa = PBXVariantGroup; 315 | children = ( 316 | 97C147001CF9000F007C117D /* Base */, 317 | ); 318 | name = LaunchScreen.storyboard; 319 | sourceTree = ""; 320 | }; 321 | /* End PBXVariantGroup section */ 322 | 323 | /* Begin XCBuildConfiguration section */ 324 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 325 | isa = XCBuildConfiguration; 326 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 327 | buildSettings = { 328 | ALWAYS_SEARCH_USER_PATHS = NO; 329 | CLANG_ANALYZER_NONNULL = YES; 330 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 331 | CLANG_CXX_LIBRARY = "libc++"; 332 | CLANG_ENABLE_MODULES = YES; 333 | CLANG_ENABLE_OBJC_ARC = YES; 334 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 335 | CLANG_WARN_BOOL_CONVERSION = YES; 336 | CLANG_WARN_COMMA = YES; 337 | CLANG_WARN_CONSTANT_CONVERSION = YES; 338 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 339 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 340 | CLANG_WARN_EMPTY_BODY = YES; 341 | CLANG_WARN_ENUM_CONVERSION = YES; 342 | CLANG_WARN_INFINITE_RECURSION = YES; 343 | CLANG_WARN_INT_CONVERSION = YES; 344 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 345 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 346 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 347 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 348 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 349 | CLANG_WARN_STRICT_PROTOTYPES = YES; 350 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 351 | CLANG_WARN_UNREACHABLE_CODE = YES; 352 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 353 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 354 | COPY_PHASE_STRIP = NO; 355 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 356 | ENABLE_NS_ASSERTIONS = NO; 357 | ENABLE_STRICT_OBJC_MSGSEND = YES; 358 | GCC_C_LANGUAGE_STANDARD = gnu99; 359 | GCC_NO_COMMON_BLOCKS = YES; 360 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 361 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 362 | GCC_WARN_UNDECLARED_SELECTOR = YES; 363 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 364 | GCC_WARN_UNUSED_FUNCTION = YES; 365 | GCC_WARN_UNUSED_VARIABLE = YES; 366 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 367 | MTL_ENABLE_DEBUG_INFO = NO; 368 | SDKROOT = iphoneos; 369 | TARGETED_DEVICE_FAMILY = "1,2"; 370 | VALIDATE_PRODUCT = YES; 371 | }; 372 | name = Profile; 373 | }; 374 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 375 | isa = XCBuildConfiguration; 376 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 377 | buildSettings = { 378 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 379 | CLANG_ENABLE_MODULES = YES; 380 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; 381 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 382 | DEVELOPMENT_TEAM = W4BE9LK8UC; 383 | ENABLE_BITCODE = NO; 384 | FRAMEWORK_SEARCH_PATHS = ( 385 | "$(inherited)", 386 | "$(PROJECT_DIR)/Flutter", 387 | ); 388 | INFOPLIST_FILE = Runner/Info.plist; 389 | IPHONEOS_DEPLOYMENT_TARGET = 11.3; 390 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 391 | LIBRARY_SEARCH_PATHS = ( 392 | "$(inherited)", 393 | "$(PROJECT_DIR)/Flutter", 394 | ); 395 | PRODUCT_BUNDLE_IDENTIFIER = za.co.britehouse.flutterMicrosoftAuthenticationExample; 396 | PRODUCT_NAME = "$(TARGET_NAME)"; 397 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 398 | SWIFT_VERSION = 4.0; 399 | VERSIONING_SYSTEM = "apple-generic"; 400 | }; 401 | name = Profile; 402 | }; 403 | 97C147031CF9000F007C117D /* Debug */ = { 404 | isa = XCBuildConfiguration; 405 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 406 | buildSettings = { 407 | ALWAYS_SEARCH_USER_PATHS = NO; 408 | CLANG_ANALYZER_NONNULL = YES; 409 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 410 | CLANG_CXX_LIBRARY = "libc++"; 411 | CLANG_ENABLE_MODULES = YES; 412 | CLANG_ENABLE_OBJC_ARC = YES; 413 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 414 | CLANG_WARN_BOOL_CONVERSION = YES; 415 | CLANG_WARN_COMMA = YES; 416 | CLANG_WARN_CONSTANT_CONVERSION = YES; 417 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 418 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 419 | CLANG_WARN_EMPTY_BODY = YES; 420 | CLANG_WARN_ENUM_CONVERSION = YES; 421 | CLANG_WARN_INFINITE_RECURSION = YES; 422 | CLANG_WARN_INT_CONVERSION = YES; 423 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 424 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 425 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 426 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 427 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 428 | CLANG_WARN_STRICT_PROTOTYPES = YES; 429 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 430 | CLANG_WARN_UNREACHABLE_CODE = YES; 431 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 432 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 433 | COPY_PHASE_STRIP = NO; 434 | DEBUG_INFORMATION_FORMAT = dwarf; 435 | ENABLE_STRICT_OBJC_MSGSEND = YES; 436 | ENABLE_TESTABILITY = YES; 437 | GCC_C_LANGUAGE_STANDARD = gnu99; 438 | GCC_DYNAMIC_NO_PIC = NO; 439 | GCC_NO_COMMON_BLOCKS = YES; 440 | GCC_OPTIMIZATION_LEVEL = 0; 441 | GCC_PREPROCESSOR_DEFINITIONS = ( 442 | "DEBUG=1", 443 | "$(inherited)", 444 | ); 445 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 446 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 447 | GCC_WARN_UNDECLARED_SELECTOR = YES; 448 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 449 | GCC_WARN_UNUSED_FUNCTION = YES; 450 | GCC_WARN_UNUSED_VARIABLE = YES; 451 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 452 | MTL_ENABLE_DEBUG_INFO = YES; 453 | ONLY_ACTIVE_ARCH = YES; 454 | SDKROOT = iphoneos; 455 | TARGETED_DEVICE_FAMILY = "1,2"; 456 | }; 457 | name = Debug; 458 | }; 459 | 97C147041CF9000F007C117D /* Release */ = { 460 | isa = XCBuildConfiguration; 461 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 462 | buildSettings = { 463 | ALWAYS_SEARCH_USER_PATHS = NO; 464 | CLANG_ANALYZER_NONNULL = YES; 465 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 466 | CLANG_CXX_LIBRARY = "libc++"; 467 | CLANG_ENABLE_MODULES = YES; 468 | CLANG_ENABLE_OBJC_ARC = YES; 469 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 470 | CLANG_WARN_BOOL_CONVERSION = YES; 471 | CLANG_WARN_COMMA = YES; 472 | CLANG_WARN_CONSTANT_CONVERSION = YES; 473 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 474 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 475 | CLANG_WARN_EMPTY_BODY = YES; 476 | CLANG_WARN_ENUM_CONVERSION = YES; 477 | CLANG_WARN_INFINITE_RECURSION = YES; 478 | CLANG_WARN_INT_CONVERSION = YES; 479 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 480 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 481 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 482 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 483 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 484 | CLANG_WARN_STRICT_PROTOTYPES = YES; 485 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 486 | CLANG_WARN_UNREACHABLE_CODE = YES; 487 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 488 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 489 | COPY_PHASE_STRIP = NO; 490 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 491 | ENABLE_NS_ASSERTIONS = NO; 492 | ENABLE_STRICT_OBJC_MSGSEND = YES; 493 | GCC_C_LANGUAGE_STANDARD = gnu99; 494 | GCC_NO_COMMON_BLOCKS = YES; 495 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 496 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 497 | GCC_WARN_UNDECLARED_SELECTOR = YES; 498 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 499 | GCC_WARN_UNUSED_FUNCTION = YES; 500 | GCC_WARN_UNUSED_VARIABLE = YES; 501 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 502 | MTL_ENABLE_DEBUG_INFO = NO; 503 | SDKROOT = iphoneos; 504 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 505 | TARGETED_DEVICE_FAMILY = "1,2"; 506 | VALIDATE_PRODUCT = YES; 507 | }; 508 | name = Release; 509 | }; 510 | 97C147061CF9000F007C117D /* Debug */ = { 511 | isa = XCBuildConfiguration; 512 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 513 | buildSettings = { 514 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 515 | CLANG_ENABLE_MODULES = YES; 516 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; 517 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 518 | DEVELOPMENT_TEAM = W4BE9LK8UC; 519 | ENABLE_BITCODE = NO; 520 | FRAMEWORK_SEARCH_PATHS = ( 521 | "$(inherited)", 522 | "$(PROJECT_DIR)/Flutter", 523 | ); 524 | INFOPLIST_FILE = Runner/Info.plist; 525 | IPHONEOS_DEPLOYMENT_TARGET = 11.3; 526 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 527 | LIBRARY_SEARCH_PATHS = ( 528 | "$(inherited)", 529 | "$(PROJECT_DIR)/Flutter", 530 | ); 531 | PRODUCT_BUNDLE_IDENTIFIER = za.co.britehouse.flutterMicrosoftAuthenticationExample; 532 | PRODUCT_NAME = "$(TARGET_NAME)"; 533 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 534 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 535 | SWIFT_VERSION = 4.0; 536 | VERSIONING_SYSTEM = "apple-generic"; 537 | }; 538 | name = Debug; 539 | }; 540 | 97C147071CF9000F007C117D /* Release */ = { 541 | isa = XCBuildConfiguration; 542 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 543 | buildSettings = { 544 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 545 | CLANG_ENABLE_MODULES = YES; 546 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; 547 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 548 | DEVELOPMENT_TEAM = W4BE9LK8UC; 549 | ENABLE_BITCODE = NO; 550 | FRAMEWORK_SEARCH_PATHS = ( 551 | "$(inherited)", 552 | "$(PROJECT_DIR)/Flutter", 553 | ); 554 | INFOPLIST_FILE = Runner/Info.plist; 555 | IPHONEOS_DEPLOYMENT_TARGET = 11.3; 556 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 557 | LIBRARY_SEARCH_PATHS = ( 558 | "$(inherited)", 559 | "$(PROJECT_DIR)/Flutter", 560 | ); 561 | PRODUCT_BUNDLE_IDENTIFIER = za.co.britehouse.flutterMicrosoftAuthenticationExample; 562 | PRODUCT_NAME = "$(TARGET_NAME)"; 563 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 564 | SWIFT_VERSION = 4.0; 565 | VERSIONING_SYSTEM = "apple-generic"; 566 | }; 567 | name = Release; 568 | }; 569 | /* End XCBuildConfiguration section */ 570 | 571 | /* Begin XCConfigurationList section */ 572 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 573 | isa = XCConfigurationList; 574 | buildConfigurations = ( 575 | 97C147031CF9000F007C117D /* Debug */, 576 | 97C147041CF9000F007C117D /* Release */, 577 | 249021D3217E4FDB00AE95B9 /* Profile */, 578 | ); 579 | defaultConfigurationIsVisible = 0; 580 | defaultConfigurationName = Release; 581 | }; 582 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 583 | isa = XCConfigurationList; 584 | buildConfigurations = ( 585 | 97C147061CF9000F007C117D /* Debug */, 586 | 97C147071CF9000F007C117D /* Release */, 587 | 249021D4217E4FDB00AE95B9 /* Profile */, 588 | ); 589 | defaultConfigurationIsVisible = 0; 590 | defaultConfigurationName = Release; 591 | }; 592 | /* End XCConfigurationList section */ 593 | }; 594 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 595 | } 596 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | import MSAL 4 | 5 | @UIApplicationMain 6 | @objc class AppDelegate: FlutterAppDelegate { 7 | override func application( 8 | _ application: UIApplication, 9 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 10 | ) -> Bool { 11 | 12 | GeneratedPluginRegistrant.register(with: self) 13 | 14 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 15 | } 16 | 17 | override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { 18 | return MSALPublicClientApplication.handleMSALResponse(url, sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleURLTypes 6 | 7 | 8 | CFBundleURLSchemes 9 | 10 | msauth.za.co.britehouse.flutterMicrosoftAuthenticationExample 11 | 12 | 13 | 14 | LSApplicationQueriesSchemes 15 | 16 | msauthv2 17 | msauthv3 18 | 19 | CFBundleDevelopmentRegion 20 | $(DEVELOPMENT_LANGUAGE) 21 | CFBundleExecutable 22 | $(EXECUTABLE_NAME) 23 | CFBundleIdentifier 24 | $(PRODUCT_BUNDLE_IDENTIFIER) 25 | CFBundleInfoDictionaryVersion 26 | 6.0 27 | CFBundleName 28 | flutter_microsoft_authentication_example 29 | CFBundlePackageType 30 | APPL 31 | CFBundleShortVersionString 32 | $(FLUTTER_BUILD_NAME) 33 | CFBundleSignature 34 | ???? 35 | CFBundleVersion 36 | $(FLUTTER_BUILD_NUMBER) 37 | LSRequiresIPhoneOS 38 | 39 | UILaunchStoryboardName 40 | LaunchScreen 41 | UIMainStoryboardFile 42 | Main 43 | UISupportedInterfaceOrientations 44 | 45 | UIInterfaceOrientationPortrait 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | UISupportedInterfaceOrientations~ipad 50 | 51 | UIInterfaceOrientationPortrait 52 | UIInterfaceOrientationPortraitUpsideDown 53 | UIInterfaceOrientationLandscapeLeft 54 | UIInterfaceOrientationLandscapeRight 55 | 56 | UIViewControllerBasedStatusBarAppearance 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" -------------------------------------------------------------------------------- /example/ios/Runner/Runner.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | keychain-access-groups 6 | 7 | $(AppIdentifierPrefix)com.microsoft.adalcache 8 | $(AppIdentifierPrefix)za.co.britehouse.flutterMicrosoftAuthenticationExample 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'dart:async'; 3 | import 'dart:convert'; 4 | import 'dart:io'; 5 | import 'package:http/http.dart' as http; 6 | import 'package:flutter/services.dart'; 7 | import 'package:flutter_microsoft_authentication/flutter_microsoft_authentication.dart'; 8 | 9 | void main() => runApp(MyApp()); 10 | 11 | class MyApp extends StatefulWidget { 12 | @override 13 | _MyAppState createState() => _MyAppState(); 14 | } 15 | 16 | class _MyAppState extends State { 17 | 18 | String _graphURI = "https://graph.microsoft.com/v1.0/me/"; 19 | 20 | String _authToken = 'Unknown Auth Token'; 21 | String _username = 'No Account'; 22 | String _msProfile = 'Unknown Profile'; 23 | 24 | FlutterMicrosoftAuthentication fma; 25 | 26 | @override 27 | void initState() { 28 | super.initState(); 29 | 30 | fma = FlutterMicrosoftAuthentication( 31 | kClientID: "", 32 | kAuthority: "https://login.microsoftonline.com/organizations", 33 | kScopes: ["User.Read", "User.ReadBasic.All"], 34 | androidConfigAssetPath: "assets/android_auth_config.json" 35 | ); 36 | print('INITIALIZED FMA'); 37 | } 38 | 39 | Future _acquireTokenInteractively() async { 40 | String authToken; 41 | try { 42 | authToken = await this.fma.acquireTokenInteractively; 43 | } on PlatformException catch(e) { 44 | authToken = 'Failed to get token.'; 45 | print(e.message); 46 | } 47 | setState(() { 48 | _authToken = authToken; 49 | }); 50 | } 51 | 52 | Future _acquireTokenSilently() async { 53 | String authToken; 54 | try { 55 | authToken = await this.fma.acquireTokenSilently; 56 | } on PlatformException catch(e) { 57 | authToken = 'Failed to get token silently.'; 58 | print(e.message); 59 | } 60 | setState(() { 61 | _authToken = authToken; 62 | }); 63 | } 64 | 65 | Future _signOut() async { 66 | String authToken; 67 | try { 68 | authToken = await this.fma.signOut; 69 | } on PlatformException catch(e) { 70 | authToken = 'Failed to sign out.'; 71 | print(e.message); 72 | } 73 | setState(() { 74 | _authToken = authToken; 75 | }); 76 | } 77 | 78 | Future _loadAccount() async { 79 | String username = await this.fma.loadAccount; 80 | setState(() { 81 | _username = username; 82 | }); 83 | } 84 | 85 | _fetchMicrosoftProfile() async { 86 | var response = await http.get(this._graphURI, headers: { 87 | "Authorization": "Bearer " + this._authToken 88 | }); 89 | 90 | setState(() { 91 | _msProfile = json.decode(response.body).toString(); 92 | }); 93 | } 94 | 95 | @override 96 | Widget build(BuildContext context) { 97 | return MaterialApp( 98 | home: Scaffold( 99 | appBar: AppBar( 100 | title: const Text('Microsoft Authentication'), 101 | ), 102 | body: SingleChildScrollView( 103 | child: Container( 104 | width: double.infinity, 105 | padding: EdgeInsets.all(8), 106 | child: Column( 107 | mainAxisAlignment: MainAxisAlignment.start, 108 | children: [ 109 | RaisedButton( onPressed: _acquireTokenInteractively, 110 | child: Text('Acquire Token'),), 111 | RaisedButton( onPressed: _acquireTokenSilently, 112 | child: Text('Acquire Token Silently')), 113 | RaisedButton( onPressed: _signOut, 114 | child: Text('Sign Out')), 115 | RaisedButton( onPressed: _fetchMicrosoftProfile, 116 | child: Text('Fetch Profile')), 117 | if (Platform.isAndroid == true) 118 | RaisedButton( onPressed: _loadAccount, 119 | child: Text('Load account')), 120 | SizedBox(height: 8,), 121 | if (Platform.isAndroid == true) 122 | Text( "Username: $_username"), 123 | SizedBox(height: 8,), 124 | Text( "Profile: $_msProfile"), 125 | SizedBox(height: 8,), 126 | Text( "Token: $_authToken"), 127 | ], 128 | ), 129 | ), 130 | ) 131 | ), 132 | ); 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | archive: 5 | dependency: transitive 6 | description: 7 | name: archive 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.0.11" 11 | args: 12 | dependency: transitive 13 | description: 14 | name: args 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.5.2" 18 | async: 19 | dependency: transitive 20 | description: 21 | name: async 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.4.0" 25 | boolean_selector: 26 | dependency: transitive 27 | description: 28 | name: boolean_selector 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.0.5" 32 | charcode: 33 | dependency: transitive 34 | description: 35 | name: charcode 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.2" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.14.11" 46 | convert: 47 | dependency: transitive 48 | description: 49 | name: convert 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "2.1.1" 53 | crypto: 54 | dependency: transitive 55 | description: 56 | name: crypto 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "2.1.3" 60 | cupertino_icons: 61 | dependency: "direct main" 62 | description: 63 | name: cupertino_icons 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "0.1.2" 67 | flutter: 68 | dependency: "direct main" 69 | description: flutter 70 | source: sdk 71 | version: "0.0.0" 72 | flutter_microsoft_authentication: 73 | dependency: "direct dev" 74 | description: 75 | path: ".." 76 | relative: true 77 | source: path 78 | version: "0.1.1" 79 | flutter_test: 80 | dependency: "direct dev" 81 | description: flutter 82 | source: sdk 83 | version: "0.0.0" 84 | http: 85 | dependency: "direct main" 86 | description: 87 | name: http 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "0.12.0+2" 91 | http_parser: 92 | dependency: transitive 93 | description: 94 | name: http_parser 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "3.1.3" 98 | image: 99 | dependency: transitive 100 | description: 101 | name: image 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "2.1.4" 105 | matcher: 106 | dependency: transitive 107 | description: 108 | name: matcher 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "0.12.6" 112 | meta: 113 | dependency: transitive 114 | description: 115 | name: meta 116 | url: "https://pub.dartlang.org" 117 | source: hosted 118 | version: "1.1.8" 119 | path: 120 | dependency: transitive 121 | description: 122 | name: path 123 | url: "https://pub.dartlang.org" 124 | source: hosted 125 | version: "1.6.4" 126 | pedantic: 127 | dependency: transitive 128 | description: 129 | name: pedantic 130 | url: "https://pub.dartlang.org" 131 | source: hosted 132 | version: "1.8.0+1" 133 | petitparser: 134 | dependency: transitive 135 | description: 136 | name: petitparser 137 | url: "https://pub.dartlang.org" 138 | source: hosted 139 | version: "2.4.0" 140 | quiver: 141 | dependency: transitive 142 | description: 143 | name: quiver 144 | url: "https://pub.dartlang.org" 145 | source: hosted 146 | version: "2.0.5" 147 | sky_engine: 148 | dependency: transitive 149 | description: flutter 150 | source: sdk 151 | version: "0.0.99" 152 | source_span: 153 | dependency: transitive 154 | description: 155 | name: source_span 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "1.5.5" 159 | stack_trace: 160 | dependency: transitive 161 | description: 162 | name: stack_trace 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "1.9.3" 166 | stream_channel: 167 | dependency: transitive 168 | description: 169 | name: stream_channel 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "2.0.0" 173 | string_scanner: 174 | dependency: transitive 175 | description: 176 | name: string_scanner 177 | url: "https://pub.dartlang.org" 178 | source: hosted 179 | version: "1.0.5" 180 | term_glyph: 181 | dependency: transitive 182 | description: 183 | name: term_glyph 184 | url: "https://pub.dartlang.org" 185 | source: hosted 186 | version: "1.1.0" 187 | test_api: 188 | dependency: transitive 189 | description: 190 | name: test_api 191 | url: "https://pub.dartlang.org" 192 | source: hosted 193 | version: "0.2.11" 194 | typed_data: 195 | dependency: transitive 196 | description: 197 | name: typed_data 198 | url: "https://pub.dartlang.org" 199 | source: hosted 200 | version: "1.1.6" 201 | vector_math: 202 | dependency: transitive 203 | description: 204 | name: vector_math 205 | url: "https://pub.dartlang.org" 206 | source: hosted 207 | version: "2.0.8" 208 | xml: 209 | dependency: transitive 210 | description: 211 | name: xml 212 | url: "https://pub.dartlang.org" 213 | source: hosted 214 | version: "3.5.0" 215 | sdks: 216 | dart: ">=2.4.0 <3.0.0" 217 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_microsoft_authentication_example 2 | description: Demonstrates how to use the flutter_microsoft_authentication plugin. 3 | publish_to: 'none' 4 | 5 | environment: 6 | sdk: ">=2.1.0 <3.0.0" 7 | 8 | dependencies: 9 | flutter: 10 | sdk: flutter 11 | 12 | http: ^0.12.0+2 13 | 14 | # The following adds the Cupertino Icons font to your application. 15 | # Use with the CupertinoIcons class for iOS style icons. 16 | cupertino_icons: ^0.1.2 17 | 18 | dev_dependencies: 19 | flutter_test: 20 | sdk: flutter 21 | 22 | flutter_microsoft_authentication: 23 | path: ../ 24 | 25 | # For information on the generic Dart part of this file, see the 26 | # following page: https://dart.dev/tools/pub/pubspec 27 | 28 | # The following section is specific to Flutter. 29 | flutter: 30 | 31 | # The following line ensures that the Material Icons font is 32 | # included with your application, so that you can use the icons in 33 | # the material Icons class. 34 | uses-material-design: true 35 | 36 | assets: 37 | - assets/android_auth_config.json 38 | 39 | # To add assets to your application, add an assets section, like this: 40 | # assets: 41 | # - images/a_dot_burr.jpeg 42 | # - images/a_dot_ham.jpeg 43 | 44 | # An image asset can refer to one or more resolution-specific "variants", see 45 | # https://flutter.dev/assets-and-images/#resolution-aware. 46 | 47 | # For details regarding adding assets from package dependencies, see 48 | # https://flutter.dev/assets-and-images/#from-packages 49 | 50 | # To add custom fonts to your application, add a fonts section here, 51 | # in this "flutter" section. Each entry in this list should have a 52 | # "family" key with the font family name, and a "fonts" key with a 53 | # list giving the asset and other descriptors for the font. For 54 | # example: 55 | # fonts: 56 | # - family: Schyler 57 | # fonts: 58 | # - asset: fonts/Schyler-Regular.ttf 59 | # - asset: fonts/Schyler-Italic.ttf 60 | # style: italic 61 | # - family: Trajan Pro 62 | # fonts: 63 | # - asset: fonts/TrajanPro.ttf 64 | # - asset: fonts/TrajanPro_Bold.ttf 65 | # weight: 700 66 | # 67 | # For details regarding fonts from package dependencies, 68 | # see https://flutter.dev/custom-fonts/#from-packages 69 | -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:flutter_microsoft_authentication_example/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Verify Platform version', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that platform version is retrieved. 19 | expect( 20 | find.byWidgetPredicate( 21 | (Widget widget) => widget is Text && 22 | widget.data.startsWith('Running on:'), 23 | ), 24 | findsOneWidget, 25 | ); 26 | }); 27 | } 28 | -------------------------------------------------------------------------------- /flutter_microsoft_authentication.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/Generated.xcconfig 37 | /Flutter/flutter_export_environment.sh -------------------------------------------------------------------------------- /ios/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BritehouseMobile/flutter-microsoft-authentication/130891645690a8fce21a12a666b6741465ed54c4/ios/Assets/.gitkeep -------------------------------------------------------------------------------- /ios/Classes/FlutterMicrosoftAuthenticationPlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface FlutterMicrosoftAuthenticationPlugin : NSObject 4 | @end 5 | -------------------------------------------------------------------------------- /ios/Classes/FlutterMicrosoftAuthenticationPlugin.m: -------------------------------------------------------------------------------- 1 | #import "FlutterMicrosoftAuthenticationPlugin.h" 2 | #import 3 | 4 | @implementation FlutterMicrosoftAuthenticationPlugin 5 | + (void)registerWithRegistrar:(NSObject*)registrar { 6 | [SwiftFlutterMicrosoftAuthenticationPlugin registerWithRegistrar:registrar]; 7 | } 8 | @end 9 | -------------------------------------------------------------------------------- /ios/Classes/SwiftFlutterMicrosoftAuthenticationPlugin.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import MSAL 4 | 5 | // Using: https://github.com/AzureAD/microsoft-authentication-library-for-objc 6 | // Example code from: https://github.com/Azure-Samples/ms-identity-mobile-apple-swift-objc 7 | 8 | public class SwiftFlutterMicrosoftAuthenticationPlugin: NSObject, FlutterPlugin { 9 | 10 | public static func register(with registrar: FlutterPluginRegistrar) { 11 | let channel = FlutterMethodChannel(name: "flutter_microsoft_authentication", binaryMessenger: registrar.messenger()) 12 | let instance = SwiftFlutterMicrosoftAuthenticationPlugin() 13 | registrar.addMethodCallDelegate(instance, channel: channel) 14 | } 15 | 16 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { 17 | 18 | let dict = call.arguments! as! NSDictionary 19 | let clientId = dict["kClientID"] as! String 20 | let scopes = dict["kScopes"] as! [String] 21 | let authority = dict["kAuthority"] as! String 22 | 23 | let msalView = ViewController() 24 | msalView.onInit(clientId: clientId, scopes: scopes, authority: authority, flutterResult: result) 25 | 26 | if(call.method == "acquireTokenInteractively") { 27 | msalView.acquireTokenInteractively(flutterResult: result) 28 | } else if(call.method == "acquireTokenSilently") { 29 | msalView.acquireTokenSilently(flutterResult: result) 30 | } else if(call.method == "signOut") { 31 | msalView.signOut(flutterResult: result) 32 | } else { 33 | result(FlutterError(code:"INVALID_METHOD", message: "The method called is invalid", details: nil)) 34 | } 35 | 36 | } 37 | } 38 | 39 | private class ViewController: UIViewController, UITextFieldDelegate, URLSessionDelegate { 40 | 41 | var kClientID = "" 42 | var kScopes: [String] = [] 43 | var kAuthority = "" 44 | 45 | var accessToken = "Temporary Placeholder" 46 | var applicationContext : MSALPublicClientApplication? 47 | var webViewParamaters : MSALWebviewParameters? 48 | 49 | public func onInit(clientId: String, scopes: [String], authority: String, flutterResult: @escaping FlutterResult) { 50 | self.kClientID = clientId 51 | self.kScopes = scopes 52 | self.kAuthority = authority 53 | do { 54 | try self.initMSAL(flutterResult: flutterResult) 55 | } catch let error { 56 | print("Unable to create Application Context \(error)") 57 | flutterResult(FlutterError(code: "CONFIG_ERROR", message: "Unable to create MSALPublicClientApplication", details: nil)) 58 | } 59 | } 60 | } 61 | 62 | 63 | // MARK: Initialization 64 | 65 | extension ViewController { 66 | 67 | /** 68 | 69 | Initialize a MSALPublicClientApplication with a given clientID and authority 70 | 71 | - clientId: The clientID of your application, you should get this from the app portal. 72 | - redirectUri: A redirect URI of your application, you should get this from the app portal. 73 | If nil, MSAL will create one by default. i.e./ msauth.://auth 74 | - authority: A URL indicating a directory that MSAL can use to obtain tokens. In Azure AD 75 | it is of the form https://, where is the 76 | directory host (e.g. https://login.microsoftonline.com) and is a 77 | identifier within the directory itself (e.g. a domain associated to the 78 | tenant, such as contoso.onmicrosoft.com, or the GUID representing the 79 | TenantID property of the directory) 80 | - error The error that occurred creating the application object, if any, if you're 81 | not interested in the specific error pass in nil. 82 | */ 83 | func initMSAL(flutterResult: @escaping FlutterResult) throws { 84 | 85 | guard let authorityURL = URL(string: kAuthority) else { 86 | print("Unable to create authority URL") 87 | flutterResult(FlutterError(code: "INVALID_AUTHORITY", message: "Unable to create authority URL", details: nil)) 88 | return 89 | } 90 | 91 | let authority = try MSALAADAuthority(url: authorityURL) 92 | 93 | let msalConfiguration = MSALPublicClientApplicationConfig(clientId: kClientID, redirectUri: nil, authority: authority) 94 | self.applicationContext = try MSALPublicClientApplication(configuration: msalConfiguration) 95 | 96 | let viewController: UIViewController = (UIApplication.shared.delegate?.window??.rootViewController)!; 97 | 98 | self.webViewParamaters = MSALWebviewParameters(parentViewController: viewController) 99 | } 100 | } 101 | 102 | 103 | // MARK: Acquiring and using token 104 | 105 | extension ViewController { 106 | 107 | func acquireTokenInteractively(flutterResult: @escaping FlutterResult) { 108 | 109 | guard let applicationContext = self.applicationContext else { return } 110 | guard let webViewParameters = self.webViewParamaters else { return } 111 | 112 | let parameters = MSALInteractiveTokenParameters(scopes: kScopes, webviewParameters: webViewParameters) 113 | parameters.promptType = .selectAccount; 114 | 115 | applicationContext.acquireToken(with: parameters) { (result, error) in 116 | 117 | if let error = error { 118 | flutterResult(FlutterError(code: "AUTH_ERROR", message: "Could not acquire token", details: nil)) 119 | print("Could not acquire token: \(error)") 120 | return 121 | } 122 | 123 | guard let result = result else { 124 | flutterResult(FlutterError(code: "AUTH_ERROR", message: "Could not acquire token: No result returned", details: nil)) 125 | print("Could not acquire token: No result returned") 126 | return 127 | } 128 | 129 | self.accessToken = result.accessToken 130 | print("Access token is \(self.accessToken)") 131 | flutterResult(self.accessToken) 132 | } 133 | 134 | } 135 | 136 | func acquireTokenSilently(flutterResult: @escaping FlutterResult) { 137 | 138 | guard let applicationContext = self.applicationContext else { return } 139 | 140 | /** 141 | 142 | Acquire a token for an existing account silently 143 | 144 | - forScopes: Permissions you want included in the access token received 145 | in the result in the completionBlock. Not all scopes are 146 | guaranteed to be included in the access token returned. 147 | - account: An account object that we retrieved from the application object before that the 148 | authentication flow will be locked down to. 149 | - completionBlock: The completion block that will be called when the authentication 150 | flow completes, or encounters an error. 151 | */ 152 | 153 | let currentAccount = self.currentAccount(flutterResult: flutterResult); 154 | 155 | if(currentAccount == nil) { 156 | DispatchQueue.main.async { 157 | self.acquireTokenInteractively(flutterResult: flutterResult) 158 | } 159 | return 160 | } 161 | 162 | let parameters = MSALSilentTokenParameters(scopes: kScopes, account: currentAccount!) 163 | 164 | applicationContext.acquireTokenSilent(with: parameters) { (result, error) in 165 | 166 | if let error = error { 167 | 168 | let nsError = error as NSError 169 | 170 | // interactionRequired means we need to ask the user to sign-in. This usually happens 171 | // when the user's Refresh Token is expired or if the user has changed their password 172 | // among other possible reasons. 173 | 174 | if (nsError.domain == MSALErrorDomain) { 175 | 176 | if (nsError.code == MSALError.interactionRequired.rawValue) { 177 | 178 | DispatchQueue.main.async { 179 | self.acquireTokenInteractively(flutterResult: flutterResult) 180 | } 181 | return 182 | } 183 | } 184 | 185 | print("Could not acquire token silently: \(error)") 186 | return 187 | } 188 | 189 | guard let result = result else { 190 | flutterResult(FlutterError(code: "AUTH_ERROR", message: "Could not acquire token: No result returned", details: nil)) 191 | print("Could not acquire token: No result returned") 192 | return 193 | } 194 | 195 | self.accessToken = result.accessToken 196 | print("Refreshed Access token is \(self.accessToken)") 197 | 198 | flutterResult(self.accessToken) 199 | } 200 | } 201 | 202 | } 203 | 204 | 205 | // MARK: Get account and removing cache 206 | 207 | extension ViewController { 208 | func currentAccount(flutterResult: @escaping FlutterResult) -> MSALAccount? { 209 | 210 | guard let applicationContext = self.applicationContext else { return nil } 211 | 212 | // We retrieve our current account by getting the first account from cache 213 | // In multi-account applications, account should be retrieved by home account identifier or username instead 214 | 215 | do { 216 | 217 | let cachedAccounts = try applicationContext.allAccounts() 218 | 219 | if !cachedAccounts.isEmpty { 220 | return cachedAccounts.first 221 | } 222 | 223 | } catch let error as NSError { 224 | flutterResult(FlutterError(code: "NO_ACCOUNT", message: "Didn't find any accounts in cache", details: nil)) 225 | print("Didn't find any accounts in cache: \(error)") 226 | } 227 | 228 | return nil 229 | } 230 | 231 | /** 232 | This action will invoke the remove account APIs to clear the token cache 233 | to sign out a user from this application. 234 | */ 235 | func signOut(flutterResult: @escaping FlutterResult) { 236 | 237 | guard let applicationContext = self.applicationContext else { return } 238 | 239 | guard let account = self.currentAccount(flutterResult: flutterResult) else { return } 240 | 241 | do { 242 | 243 | /** 244 | Removes all tokens from the cache for this application for the provided account 245 | 246 | - account: The account to remove from the cache 247 | */ 248 | 249 | try applicationContext.remove(account) 250 | 251 | self.accessToken = "" 252 | 253 | flutterResult(self.accessToken) 254 | 255 | } catch let error as NSError { 256 | flutterResult(FlutterError(code: "SIGN_OUT", message: "Received error signing account out", details: nil)) 257 | print("Received error signing account out: \(error)") 258 | } 259 | } 260 | } 261 | -------------------------------------------------------------------------------- /ios/flutter_microsoft_authentication.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 3 | # 4 | Pod::Spec.new do |s| 5 | s.name = 'flutter_microsoft_authentication' 6 | s.version = '0.0.3' 7 | s.summary = 'Flutter Wrapper for Microsoft Authentication Library' 8 | s.description = <<-DESC 9 | Flutter Wrapper for Microsoft Authentication Library. 10 | https://github.com/AzureAD/microsoft-authentication-library-for-objc 11 | DESC 12 | s.homepage = 'https://www.britehouse.co.za' 13 | s.license = { :file => '../LICENSE' } 14 | s.author = { 'Britehouse Mobility' => 'gerrit.vanhuyssteen@britehouse.co.za' } 15 | s.source = { :path => '.' } 16 | s.source_files = 'Classes/**/*' 17 | s.public_header_files = 'Classes/**/*.h' 18 | s.dependency 'Flutter' 19 | s.dependency 'MSAL', '~> 1.0.3' 20 | s.ios.deployment_target = '11.0' 21 | end 22 | 23 | -------------------------------------------------------------------------------- /lib/flutter_microsoft_authentication.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io' show Platform; 3 | import 'package:flutter/services.dart'; 4 | 5 | class FlutterMicrosoftAuthentication { 6 | static const MethodChannel _channel = 7 | const MethodChannel('flutter_microsoft_authentication'); 8 | 9 | List _kScopes; 10 | String _kClientID, _kAuthority; 11 | String _androidConfigAssetPath; 12 | 13 | FlutterMicrosoftAuthentication( 14 | {String kClientID, 15 | String kAuthority, 16 | List kScopes, 17 | String androidConfigAssetPath}) { 18 | _kClientID = kClientID; 19 | _kAuthority = kAuthority; 20 | _kScopes = kScopes; 21 | _androidConfigAssetPath = androidConfigAssetPath; 22 | 23 | if (Platform.isAndroid) 24 | _channel.invokeMethod("init", _createMethodcallArguments()); 25 | } 26 | 27 | Map _createMethodcallArguments() { 28 | var res = { 29 | "kScopes": _kScopes, 30 | "kClientID": _kClientID, 31 | "kAuthority": _kAuthority 32 | }; 33 | if (Platform.isAndroid && _androidConfigAssetPath != null) { 34 | res.addAll({"configPath": _androidConfigAssetPath}); 35 | } 36 | print(res); 37 | return res; 38 | } 39 | 40 | /// Acquire auth token with interactive flow. 41 | Future get acquireTokenInteractively async { 42 | final String token = await _channel.invokeMethod( 43 | 'acquireTokenInteractively', _createMethodcallArguments()); 44 | return token; 45 | } 46 | 47 | /// Acquire auth token silently. 48 | Future get acquireTokenSilently async { 49 | final String token = await _channel.invokeMethod( 50 | 'acquireTokenSilently', _createMethodcallArguments()); 51 | return token; 52 | } 53 | 54 | /// Android only. Get username of current active account. 55 | Future get loadAccount async { 56 | final result = await _channel.invokeMethod( 57 | 'loadAccount', _createMethodcallArguments()); 58 | return result; 59 | } 60 | 61 | /// Sign out of current active account. 62 | Future get signOut async { 63 | final String token = 64 | await _channel.invokeMethod('signOut', _createMethodcallArguments()); 65 | return token; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | archive: 5 | dependency: transitive 6 | description: 7 | name: archive 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.0.11" 11 | args: 12 | dependency: transitive 13 | description: 14 | name: args 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.5.2" 18 | async: 19 | dependency: transitive 20 | description: 21 | name: async 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.4.0" 25 | boolean_selector: 26 | dependency: transitive 27 | description: 28 | name: boolean_selector 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.0.5" 32 | charcode: 33 | dependency: transitive 34 | description: 35 | name: charcode 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.2" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.14.11" 46 | convert: 47 | dependency: transitive 48 | description: 49 | name: convert 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "2.1.1" 53 | crypto: 54 | dependency: transitive 55 | description: 56 | name: crypto 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "2.1.3" 60 | flutter: 61 | dependency: "direct main" 62 | description: flutter 63 | source: sdk 64 | version: "0.0.0" 65 | flutter_test: 66 | dependency: "direct dev" 67 | description: flutter 68 | source: sdk 69 | version: "0.0.0" 70 | image: 71 | dependency: transitive 72 | description: 73 | name: image 74 | url: "https://pub.dartlang.org" 75 | source: hosted 76 | version: "2.1.4" 77 | matcher: 78 | dependency: transitive 79 | description: 80 | name: matcher 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "0.12.6" 84 | meta: 85 | dependency: transitive 86 | description: 87 | name: meta 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "1.1.8" 91 | path: 92 | dependency: transitive 93 | description: 94 | name: path 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "1.6.4" 98 | pedantic: 99 | dependency: transitive 100 | description: 101 | name: pedantic 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "1.8.0+1" 105 | petitparser: 106 | dependency: transitive 107 | description: 108 | name: petitparser 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "2.4.0" 112 | quiver: 113 | dependency: transitive 114 | description: 115 | name: quiver 116 | url: "https://pub.dartlang.org" 117 | source: hosted 118 | version: "2.0.5" 119 | sky_engine: 120 | dependency: transitive 121 | description: flutter 122 | source: sdk 123 | version: "0.0.99" 124 | source_span: 125 | dependency: transitive 126 | description: 127 | name: source_span 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "1.5.5" 131 | stack_trace: 132 | dependency: transitive 133 | description: 134 | name: stack_trace 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "1.9.3" 138 | stream_channel: 139 | dependency: transitive 140 | description: 141 | name: stream_channel 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "2.0.0" 145 | string_scanner: 146 | dependency: transitive 147 | description: 148 | name: string_scanner 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "1.0.5" 152 | term_glyph: 153 | dependency: transitive 154 | description: 155 | name: term_glyph 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "1.1.0" 159 | test_api: 160 | dependency: transitive 161 | description: 162 | name: test_api 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "0.2.11" 166 | typed_data: 167 | dependency: transitive 168 | description: 169 | name: typed_data 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "1.1.6" 173 | vector_math: 174 | dependency: transitive 175 | description: 176 | name: vector_math 177 | url: "https://pub.dartlang.org" 178 | source: hosted 179 | version: "2.0.8" 180 | xml: 181 | dependency: transitive 182 | description: 183 | name: xml 184 | url: "https://pub.dartlang.org" 185 | source: hosted 186 | version: "3.5.0" 187 | sdks: 188 | dart: ">=2.4.0 <3.0.0" 189 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_microsoft_authentication 2 | description: Flutter Wrapper for Microsoft Authentication Library to enable SSO across Android and iOS. 3 | version: 0.1.1 4 | homepage: https://github.com/BritehouseMobile/flutter-microsoft-authentication 5 | 6 | environment: 7 | sdk: ">=2.1.0 <3.0.0" 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | 13 | dev_dependencies: 14 | flutter_test: 15 | sdk: flutter 16 | 17 | # For information on the generic Dart part of this file, see the 18 | # following page: https://dart.dev/tools/pub/pubspec 19 | 20 | # The following section is specific to Flutter. 21 | flutter: 22 | # This section identifies this Flutter project as a plugin project. 23 | # The androidPackage and pluginClass identifiers should not ordinarily 24 | # be modified. They are used by the tooling to maintain consistency when 25 | # adding or updating assets for this project. 26 | plugin: 27 | androidPackage: za.co.britehouse.flutter_microsoft_authentication 28 | pluginClass: FlutterMicrosoftAuthenticationPlugin 29 | 30 | # To add assets to your plugin package, add an assets section, like this: 31 | # assets: 32 | # - images/a_dot_burr.jpeg 33 | # - images/a_dot_ham.jpeg 34 | # 35 | # For details regarding assets in packages, see 36 | # https://flutter.dev/assets-and-images/#from-packages 37 | # 38 | # An image asset can refer to one or more resolution-specific "variants", see 39 | # https://flutter.dev/assets-and-images/#resolution-aware. 40 | 41 | # To add custom fonts to your plugin package, add a fonts section here, 42 | # in this "flutter" section. Each entry in this list should have a 43 | # "family" key with the font family name, and a "fonts" key with a 44 | # list giving the asset and other descriptors for the font. For 45 | # example: 46 | # fonts: 47 | # - family: Schyler 48 | # fonts: 49 | # - asset: fonts/Schyler-Regular.ttf 50 | # - asset: fonts/Schyler-Italic.ttf 51 | # style: italic 52 | # - family: Trajan Pro 53 | # fonts: 54 | # - asset: fonts/TrajanPro.ttf 55 | # - asset: fonts/TrajanPro_Bold.ttf 56 | # weight: 700 57 | # 58 | # For details regarding fonts in packages, see 59 | # https://flutter.dev/custom-fonts/#from-packages 60 | -------------------------------------------------------------------------------- /test/flutter_microsoft_authentication_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | // import 'package:flutter_microsoft_authentication/flutter_microsoft_authentication.dart'; 4 | 5 | void main() { 6 | const MethodChannel channel = MethodChannel('flutter_microsoft_authentication'); 7 | 8 | setUp(() { 9 | channel.setMockMethodCallHandler((MethodCall methodCall) async { 10 | return '42'; 11 | }); 12 | }); 13 | 14 | tearDown(() { 15 | channel.setMockMethodCallHandler(null); 16 | }); 17 | 18 | // test('getPlatformVersion', () async { 19 | // expect(await FlutterMicrosoftAuthentication.platformVersion, '42'); 20 | // }); 21 | } 22 | --------------------------------------------------------------------------------