react-native-msal2 1.0.11 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/reactnativemsal/RNMSALModule.kt +11 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +2 -2
- package/dist/src/publicClientApplication.d.ts +1 -0
- package/dist/src/types.d.ts +8 -0
- package/package.json +3 -2
- package/src/publicClientApplication.ts +9 -0
- package/src/types.ts +9 -0
- package/app/.bundle/config +0 -2
- package/app/.eslintrc.js +0 -4
- package/app/.prettierrc.js +0 -7
- package/app/.watchman-cookie-Sandeeps-Mac-541-3381 +0 -0
- package/app/.watchmanconfig +0 -1
- package/app/Gemfile +0 -9
- package/app/README.md +0 -79
- package/app/android/app/build.gradle +0 -119
- package/app/android/app/debug.keystore +0 -0
- package/app/android/app/proguard-rules.pro +0 -10
- package/app/android/app/src/debug/AndroidManifest.xml +0 -9
- package/app/android/app/src/main/AndroidManifest.xml +0 -25
- package/app/android/app/src/main/java/com/msal2app/MainActivity.kt +0 -22
- package/app/android/app/src/main/java/com/msal2app/MainApplication.kt +0 -45
- package/app/android/app/src/main/res/drawable/rn_edit_text_material.xml +0 -36
- package/app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/app/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/app/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/app/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/app/android/app/src/main/res/values/strings.xml +0 -3
- package/app/android/app/src/main/res/values/styles.xml +0 -9
- package/app/android/build.gradle +0 -21
- package/app/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/app/android/gradle/wrapper/gradle-wrapper.properties +0 -7
- package/app/android/gradle.properties +0 -41
- package/app/android/gradlew +0 -249
- package/app/android/gradlew.bat +0 -92
- package/app/android/settings.gradle +0 -4
- package/app/app.json +0 -4
- package/app/babel.config.js +0 -3
- package/app/index.js +0 -9
- package/app/ios/.xcode.env +0 -11
- package/app/ios/Msal2App/AppDelegate.h +0 -6
- package/app/ios/Msal2App/AppDelegate.mm +0 -31
- package/app/ios/Msal2App/Images.xcassets/AppIcon.appiconset/Contents.json +0 -53
- package/app/ios/Msal2App/Images.xcassets/Contents.json +0 -6
- package/app/ios/Msal2App/Info.plist +0 -52
- package/app/ios/Msal2App/LaunchScreen.storyboard +0 -47
- package/app/ios/Msal2App/main.m +0 -10
- package/app/ios/Msal2App.xcodeproj/project.pbxproj +0 -698
- package/app/ios/Msal2App.xcodeproj/xcshareddata/xcschemes/Msal2App.xcscheme +0 -88
- package/app/ios/Msal2App.xcworkspace/contents.xcworkspacedata +0 -10
- package/app/ios/Msal2AppTests/Info.plist +0 -24
- package/app/ios/Msal2AppTests/Msal2AppTests.m +0 -66
- package/app/ios/Podfile +0 -56
- package/app/ios/Podfile.lock +0 -1384
- package/app/jest.config.js +0 -3
- package/app/metro.config.js +0 -11
- package/app/package-lock.json +0 -20038
- package/app/package.json +0 -37
- package/app/react-native-msal2-1.0.0.tgz +0 -0
- package/app/src/App.tsx +0 -150
- package/app/src/b2cClient.ts +0 -199
- package/app/src/msalConfig.ts +0 -20
- package/app/tsconfig.json +0 -3
- package/app/yarn.lock +0 -6771
|
@@ -36,6 +36,7 @@ import java.security.MessageDigest
|
|
|
36
36
|
import java.util.AbstractMap
|
|
37
37
|
import java.util.regex.Matcher
|
|
38
38
|
import java.util.regex.Pattern
|
|
39
|
+
import com.microsoft.identity.common.internal.ui.browser.AndroidBrowserSelector
|
|
39
40
|
|
|
40
41
|
class RNMSALModule(reactContext: ReactApplicationContext?) :
|
|
41
42
|
ReactContextBaseJavaModule(reactContext) {
|
|
@@ -124,6 +125,16 @@ class RNMSALModule(reactContext: ReactApplicationContext?) :
|
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
127
|
|
|
128
|
+
@ReactMethod
|
|
129
|
+
fun getSelectedBrowser(promise: Promise) {
|
|
130
|
+
publicClientApplication?.configuration?.browserSafeList?.let {
|
|
131
|
+
AndroidBrowserSelector(reactApplicationContext).selectBrowser(it, null)?.let { browser ->
|
|
132
|
+
promise.resolve("${browser.packageName} ${browser.version} ${if (browser.isCustomTabsServiceSupported) "CustomTab" else "NoCustomTab"}")
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
promise.resolve ("Unknown")
|
|
136
|
+
}
|
|
137
|
+
|
|
127
138
|
@Throws(JSONException::class, IllegalArgumentException::class)
|
|
128
139
|
private fun makeAuthoritiesJsonArray(
|
|
129
140
|
authorityUrls: MutableList<String>,
|
package/dist/index.js
CHANGED
|
@@ -41,6 +41,13 @@ var PublicClientApplication = class {
|
|
|
41
41
|
default: async () => await RNMSAL.removeAccount(params.account)
|
|
42
42
|
})();
|
|
43
43
|
}
|
|
44
|
+
async getSelectedBrowser() {
|
|
45
|
+
this.validateIsInitialized();
|
|
46
|
+
return await Platform.select({
|
|
47
|
+
android: async () => await RNMSAL.getSelectedBrowser(),
|
|
48
|
+
default: async () => "N/A"
|
|
49
|
+
})();
|
|
50
|
+
}
|
|
44
51
|
validateIsInitialized() {
|
|
45
52
|
if (!this.isInitialized) {
|
|
46
53
|
throw new Error(
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/publicClientApplication.ts", "../src/types.ts", "../index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Platform } from 'react-native'\n\nimport type {\n MSALConfiguration,\n MSALInteractiveParams,\n MSALSilentParams,\n MSALAccount,\n MSALSignoutParams,\n IPublicClientApplication,\n MSALResult,\n} from './types'\n\nimport { NativeModules } from 'react-native'\n\ntype RNMSALNativeModule = {\n createPublicClientApplication(config: MSALConfiguration): Promise<void>\n acquireToken(params: MSALInteractiveParams): Promise<MSALResult | undefined>\n acquireTokenSilent(params: MSALSilentParams): Promise<MSALResult | undefined>\n getAccounts(): Promise<MSALAccount[]>\n getAccount(accountIdentifier: string): Promise<MSALAccount | undefined>\n removeAccount(account: MSALAccount): Promise<boolean>\n signout(params: MSALSignoutParams): Promise<boolean>\n}\n\nconst RNMSAL: RNMSALNativeModule = NativeModules.RNMSAL\n\n// export default RNMSAL\n\nexport class PublicClientApplication implements IPublicClientApplication {\n private isInitialized: boolean = false\n\n constructor(private readonly config: MSALConfiguration) {}\n\n public async init() {\n if (!this.isInitialized) {\n await RNMSAL.createPublicClientApplication(this.config)\n this.isInitialized = true\n }\n return this\n }\n\n public async acquireToken(params: MSALInteractiveParams) {\n this.validateIsInitialized()\n return await RNMSAL.acquireToken(params)\n }\n\n public async acquireTokenSilent(params: MSALSilentParams) {\n this.validateIsInitialized()\n return await RNMSAL.acquireTokenSilent(params)\n }\n\n public async getAccounts() {\n this.validateIsInitialized()\n return await RNMSAL.getAccounts()\n }\n\n public async getAccount(accountIdentifier: string) {\n this.validateIsInitialized()\n return await RNMSAL.getAccount(accountIdentifier)\n }\n\n public async removeAccount(account: MSALAccount) {\n this.validateIsInitialized()\n return await RNMSAL.removeAccount(account)\n }\n\n public async signOut(params: MSALSignoutParams) {\n this.validateIsInitialized()\n return await Platform.select({\n ios: async () => await RNMSAL.signout(params),\n default: async () => await RNMSAL.removeAccount(params.account),\n })()\n }\n\n private validateIsInitialized() {\n if (!this.isInitialized) {\n throw new Error(\n 'PublicClientApplication is not initialized. You must call the `init` method before any other method.',\n )\n }\n }\n}\n", "export interface IPublicClientApplication {\n /**\n * Acquire a token interactively\n * @param {MSALInteractiveParams} params\n * @return Result containing an access token and account identifier\n * used for acquiring subsequent tokens silently\n */\n acquireToken(params: MSALInteractiveParams): Promise<MSALResult | undefined>\n\n /**\n * Acquire a token silently\n * @param {MSALSilentParams} params - Includes the account identifer retrieved from a\n * previous interactive login\n * @return Result containing an access token and account identifier\n * used for acquiring subsequent tokens silently\n */\n acquireTokenSilent(params: MSALSilentParams): Promise<MSALResult | undefined>\n\n /**\n * Get all accounts for which this application has refresh tokens\n * @return Promise containing array of MSALAccount objects for which this application\n * has refresh tokens.\n */\n getAccounts(): Promise<MSALAccount[]>\n\n /**\n * Retrieve the account matching the identifier\n * @return Promise containing MSALAccount object\n */\n getAccount(accountIdentifier: string): Promise<MSALAccount | undefined>\n\n /**\n * Removes all tokens from the cache for this application for the provided\n * account.\n * @param {MSALAccount} account\n * @return A promise containing a boolean = true if account removal was successful\n * otherwise rejects\n */\n removeAccount(account: MSALAccount): Promise<boolean>\n\n /**\n * Removes all tokens from the cache for this application for the provided\n * account. Additionally, this will remove the account from the system browser.\n * NOTE: iOS only. On Android and web this is the same as `removeAccount`.\n * @param {MSALSignoutParams} params\n * @return A promise which resolves if sign out is successful,\n * otherwise rejects\n * @platform ios\n */\n signOut(params: MSALSignoutParams): Promise<boolean>\n}\n\nexport interface MSALConfiguration {\n auth: {\n /**\n * The client ID of the application, this should come from the app developer portal.\n */\n clientId: string\n /**\n * The authority the application will use to obtain tokens.\n */\n authority?: string\n /**\n * List of known authorities that the application should trust.\n */\n knownAuthorities?: string[]\n /**\n * The redirect URI of the application.\n *\n * If you are providing this property, you should probably use `Platform.select`,\n * because the redirect uris will be different for each platform.\n */\n redirectUri?: string\n }\n /**\n * Options as described here: {@link https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-configuration}\n * @platform android\n */\n androidConfigOptions?: MSALAndroidConfigOptions\n}\n\nexport interface MSALAndroidConfigOptions {\n authorization_user_agent?: 'DEFAULT' | 'BROWSER' | 'WEBVIEW'\n broker_redirect_uri_registered?: boolean\n browser_safelist?: {\n browser_package_name: string\n browser_signature_hashes: string[]\n browser_use_customTab: boolean\n }[]\n http?: {\n connect_timeout?: number\n read_timeout?: number\n }\n logging?: {\n pii_enabled?: boolean\n log_level?: 'ERROR' | 'WARNING' | 'INFO' | 'VERBOSE'\n logcat_enabled?: boolean\n }\n multiple_clouds_supported?: boolean\n}\n\nexport interface MSALInteractiveParams {\n /**\n * Permissions you want included in the access token received in the result.\n * Not all scopes are guaranteed to be included in the access token returned.\n */\n scopes: string[]\n /**\n * The authority that MSAL will use to obtain tokens. If not included, authority from\n * MSALConfiguration will be used.\n */\n authority?: string\n /**\n * A specific prompt type for the interactive authentication flow.\n */\n promptType?: MSALPromptType\n /**\n * A loginHint (usually an email) to pass to the service at the beginning of the\n * interactive authentication flow. The account returned is not guaranteed to match\n * the loginHint.\n */\n loginHint?: string\n /**\n * Key-value pairs to pass to the /authorize and /token endpoints.\n */\n extraQueryParameters?: Record<string, string>\n /**\n * Permissions you want the account to consent to in the same authentication flow,\n * but won\u2019t be included in the returned access token.\n */\n extraScopesToConsent?: string[]\n /**\n * User Interface configuration that MSAL uses when getting a token interactively or\n * authorizing an end user.\n */\n webviewParameters?: MSALWebviewParams\n}\n\n/**\n * OIDC prompt parameter that specifies whether the Authorization Server prompts the\n * End-User for reauthentication and consent.\n */\nexport enum MSALPromptType {\n /**\n * If no user is specified the authentication webview will present a list of users\n * currently signed in for the user to select among.\n */\n SELECT_ACCOUNT,\n /**\n * Require the user to authenticate in the webview.\n */\n LOGIN,\n /**\n * Require the user to consent to the current set of scopes for the request.\n */\n CONSENT,\n /**\n * The SSO experience will be determined by the presence of cookies in the webview and\n * account type. User won\u2019t be prompted unless necessary. If multiple users are signed in,\n * select account experience will be presented.\n */\n WHEN_REQUIRED,\n /**\n * Default is MSALPromptType.WHEN_REQUIRED.\n */\n DEFAULT = WHEN_REQUIRED,\n}\n\nexport interface MSALSilentParams {\n /**\n * Permissions you want included in the access token received in the result.\n * Not all scopes are guaranteed to be included in the access token returned.\n */\n scopes: string[]\n /**\n * An account object for which tokens should be returned.\n */\n account: MSALAccount\n /**\n * The authority that MSAL will use to obtain tokens. If not included, authority from\n * MSALConfiguration will be used.\n */\n authority?: string\n /**\n * Ignore any existing access token in the cache and force MSAL to get a new access token\n * from the service.\n */\n forceRefresh?: boolean\n}\n\nexport interface MSALSignoutParams {\n /**\n * The account object for which to sign out of.\n */\n account: MSALAccount\n /**\n * Specifies whether signout should also open the browser and send a network request to the end_session_endpoint.\n * false by default.\n */\n signoutFromBrowser?: boolean\n /**\n * User Interface configuration that MSAL uses when getting a token interactively or\n * authorizing an end user.\n */\n webviewParameters?: MSALWebviewParams\n}\n\nexport interface MSALResult {\n /**\n * The Access Token requested, or empty string if no access token is returned in response\n */\n accessToken: string\n /**\n * The account object that holds account information.\n */\n account: MSALAccount\n /**\n * The time that the access token returned in the accessToken property ceases to be valid.\n * This value is calculated based on current UTC time measured locally and the value expiresIn returned from the service\n */\n expiresOn: number\n /**\n * The raw id token if it\u2019s returned by the service or undefined if no id token is returned.\n */\n idToken?: string\n /**\n * The scope values returned from the service.\n */\n scopes: string[]\n /**\n * Identifier for the directory where account is locally represented\n */\n tenantId?: string\n}\n\nexport interface MSALAccount {\n /**\n * Unique identifier for the account.\n */\n identifier: string\n /**\n * Host part of the authority string used for authentication based on the issuer identifier.\n */\n environment?: string\n /**\n * An identifier for the AAD tenant that the account was acquired from.\n */\n tenantId: string\n /**\n * Shorthand name by which the End-User wishes to be referred to at the RP, such as janedoe or j.doe.\n */\n username: string\n /**\n * ID token claims for the account. Can be used to read additional information about the account, e.g. name.\n */\n claims?: object\n}\n\n/**\n * Mostly, if not all, iOS webview parameters\n * See https://azuread.github.io/microsoft-authentication-library-for-objc/Classes/MSALWebviewParameters.html\n */\nexport interface MSALWebviewParams {\n /**\n * A Boolean value that indicates whether the ASWebAuthenticationSession should ask the\n * browser for a private authentication session.\n * For more info see here: https://developer.apple.com/documentation/authenticationservices/aswebauthenticationsession/3237231-prefersephemeralwebbrowsersessio?language=objc\n * @platform iOS 13+\n */\n ios_prefersEphemeralWebBrowserSession?: boolean\n /**\n * MSAL requires a web browser for interactive authentication.\n * There are multiple web browsers available to complete authentication.\n * MSAL will default to the web browser that provides best security and user experience for a given platform.\n * Ios_MSALWebviewType allows changing the experience by customizing the configuration to other options for\n * displaying web content\n * @platform iOS\n */\n ios_webviewType?: Ios_MSALWebviewType\n /**\n * Note: Has no effect when ios_webviewType === `Ios_MSALWebviewType.DEFAULT` or\n * ios_webviewType === `Ios_MSALWebviewType.AUTHENTICATION_SESSION`\n * @platform iOS\n */\n ios_presentationStyle?: Ios_ModalPresentationStyle\n}\n\n/**\n * See https://developer.apple.com/documentation/uikit/uimodalpresentationstyle\n */\nexport enum Ios_ModalPresentationStyle {\n fullScreen = 0,\n pageSheet,\n formSheet,\n currentContext,\n custom,\n overFullScreen,\n overCurrentContext,\n popover,\n blurOverFullScreen,\n none = -1,\n automatic = -2,\n}\n\n/**\n * See https://azuread.github.io/microsoft-authentication-library-for-objc/Enums/MSALWebviewType.html\n */\nexport enum Ios_MSALWebviewType {\n DEFAULT = 0,\n AUTHENTICATION_SESSION,\n SAFARI_VIEW_CONTROLLER,\n WK_WEB_VIEW,\n}\n", "import { PublicClientApplication } from './src/publicClientApplication'\nexport default PublicClientApplication\nexport * from './src/types'\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,gBAAgB;AAYzB,SAAS,qBAAqB;
|
|
4
|
+
"sourcesContent": ["import { Platform } from 'react-native'\n\nimport type {\n MSALConfiguration,\n MSALInteractiveParams,\n MSALSilentParams,\n MSALAccount,\n MSALSignoutParams,\n IPublicClientApplication,\n MSALResult,\n} from './types'\n\nimport { NativeModules } from 'react-native'\n\ntype RNMSALNativeModule = {\n createPublicClientApplication(config: MSALConfiguration): Promise<void>\n acquireToken(params: MSALInteractiveParams): Promise<MSALResult | undefined>\n acquireTokenSilent(params: MSALSilentParams): Promise<MSALResult | undefined>\n getAccounts(): Promise<MSALAccount[]>\n getAccount(accountIdentifier: string): Promise<MSALAccount | undefined>\n removeAccount(account: MSALAccount): Promise<boolean>\n signout(params: MSALSignoutParams): Promise<boolean>\n getSelectedBrowser(): Promise<string>\n}\n\nconst RNMSAL: RNMSALNativeModule = NativeModules.RNMSAL\n\n// export default RNMSAL\n\nexport class PublicClientApplication implements IPublicClientApplication {\n private isInitialized: boolean = false\n\n constructor(private readonly config: MSALConfiguration) {}\n\n public async init() {\n if (!this.isInitialized) {\n await RNMSAL.createPublicClientApplication(this.config)\n this.isInitialized = true\n }\n return this\n }\n\n public async acquireToken(params: MSALInteractiveParams) {\n this.validateIsInitialized()\n return await RNMSAL.acquireToken(params)\n }\n\n public async acquireTokenSilent(params: MSALSilentParams) {\n this.validateIsInitialized()\n return await RNMSAL.acquireTokenSilent(params)\n }\n\n public async getAccounts() {\n this.validateIsInitialized()\n return await RNMSAL.getAccounts()\n }\n\n public async getAccount(accountIdentifier: string) {\n this.validateIsInitialized()\n return await RNMSAL.getAccount(accountIdentifier)\n }\n\n public async removeAccount(account: MSALAccount) {\n this.validateIsInitialized()\n return await RNMSAL.removeAccount(account)\n }\n\n public async signOut(params: MSALSignoutParams) {\n this.validateIsInitialized()\n return await Platform.select({\n ios: async () => await RNMSAL.signout(params),\n default: async () => await RNMSAL.removeAccount(params.account),\n })()\n }\n\n public async getSelectedBrowser() {\n this.validateIsInitialized()\n return await Platform.select({\n android: async () => await RNMSAL.getSelectedBrowser(),\n default: async () => 'N/A',\n })()\n }\n\n private validateIsInitialized() {\n if (!this.isInitialized) {\n throw new Error(\n 'PublicClientApplication is not initialized. You must call the `init` method before any other method.',\n )\n }\n }\n}\n", "export interface IPublicClientApplication {\n /**\n * Acquire a token interactively\n * @param {MSALInteractiveParams} params\n * @return Result containing an access token and account identifier\n * used for acquiring subsequent tokens silently\n */\n acquireToken(params: MSALInteractiveParams): Promise<MSALResult | undefined>\n\n /**\n * Acquire a token silently\n * @param {MSALSilentParams} params - Includes the account identifer retrieved from a\n * previous interactive login\n * @return Result containing an access token and account identifier\n * used for acquiring subsequent tokens silently\n */\n acquireTokenSilent(params: MSALSilentParams): Promise<MSALResult | undefined>\n\n /**\n * Get all accounts for which this application has refresh tokens\n * @return Promise containing array of MSALAccount objects for which this application\n * has refresh tokens.\n */\n getAccounts(): Promise<MSALAccount[]>\n\n /**\n * Retrieve the account matching the identifier\n * @return Promise containing MSALAccount object\n */\n getAccount(accountIdentifier: string): Promise<MSALAccount | undefined>\n\n /**\n * Removes all tokens from the cache for this application for the provided\n * account.\n * @param {MSALAccount} account\n * @return A promise containing a boolean = true if account removal was successful\n * otherwise rejects\n */\n removeAccount(account: MSALAccount): Promise<boolean>\n\n /**\n * Removes all tokens from the cache for this application for the provided\n * account. Additionally, this will remove the account from the system browser.\n * NOTE: iOS only. On Android and web this is the same as `removeAccount`.\n * @param {MSALSignoutParams} params\n * @return A promise which resolves if sign out is successful,\n * otherwise rejects\n * @platform ios\n */\n signOut(params: MSALSignoutParams): Promise<boolean>\n\n /**\n * Returns the browser that will be used for interactive authentication.\n * NOTE: Android only. On iOS this will always return 'N/A'.\n * @return Promise resolving to the package name and version of the browser that will be used\n * for interactive authentication.\n * @platform android\n */\n getSelectedBrowser(): Promise<string>\n}\n\nexport interface MSALConfiguration {\n auth: {\n /**\n * The client ID of the application, this should come from the app developer portal.\n */\n clientId: string\n /**\n * The authority the application will use to obtain tokens.\n */\n authority?: string\n /**\n * List of known authorities that the application should trust.\n */\n knownAuthorities?: string[]\n /**\n * The redirect URI of the application.\n *\n * If you are providing this property, you should probably use `Platform.select`,\n * because the redirect uris will be different for each platform.\n */\n redirectUri?: string\n }\n /**\n * Options as described here: {@link https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-configuration}\n * @platform android\n */\n androidConfigOptions?: MSALAndroidConfigOptions\n}\n\nexport interface MSALAndroidConfigOptions {\n authorization_user_agent?: 'DEFAULT' | 'BROWSER' | 'WEBVIEW'\n broker_redirect_uri_registered?: boolean\n browser_safelist?: {\n browser_package_name: string\n browser_signature_hashes: string[]\n browser_use_customTab: boolean\n }[]\n http?: {\n connect_timeout?: number\n read_timeout?: number\n }\n logging?: {\n pii_enabled?: boolean\n log_level?: 'ERROR' | 'WARNING' | 'INFO' | 'VERBOSE'\n logcat_enabled?: boolean\n }\n multiple_clouds_supported?: boolean\n}\n\nexport interface MSALInteractiveParams {\n /**\n * Permissions you want included in the access token received in the result.\n * Not all scopes are guaranteed to be included in the access token returned.\n */\n scopes: string[]\n /**\n * The authority that MSAL will use to obtain tokens. If not included, authority from\n * MSALConfiguration will be used.\n */\n authority?: string\n /**\n * A specific prompt type for the interactive authentication flow.\n */\n promptType?: MSALPromptType\n /**\n * A loginHint (usually an email) to pass to the service at the beginning of the\n * interactive authentication flow. The account returned is not guaranteed to match\n * the loginHint.\n */\n loginHint?: string\n /**\n * Key-value pairs to pass to the /authorize and /token endpoints.\n */\n extraQueryParameters?: Record<string, string>\n /**\n * Permissions you want the account to consent to in the same authentication flow,\n * but won\u2019t be included in the returned access token.\n */\n extraScopesToConsent?: string[]\n /**\n * User Interface configuration that MSAL uses when getting a token interactively or\n * authorizing an end user.\n */\n webviewParameters?: MSALWebviewParams\n}\n\n/**\n * OIDC prompt parameter that specifies whether the Authorization Server prompts the\n * End-User for reauthentication and consent.\n */\nexport enum MSALPromptType {\n /**\n * If no user is specified the authentication webview will present a list of users\n * currently signed in for the user to select among.\n */\n SELECT_ACCOUNT,\n /**\n * Require the user to authenticate in the webview.\n */\n LOGIN,\n /**\n * Require the user to consent to the current set of scopes for the request.\n */\n CONSENT,\n /**\n * The SSO experience will be determined by the presence of cookies in the webview and\n * account type. User won\u2019t be prompted unless necessary. If multiple users are signed in,\n * select account experience will be presented.\n */\n WHEN_REQUIRED,\n /**\n * Default is MSALPromptType.WHEN_REQUIRED.\n */\n DEFAULT = WHEN_REQUIRED,\n}\n\nexport interface MSALSilentParams {\n /**\n * Permissions you want included in the access token received in the result.\n * Not all scopes are guaranteed to be included in the access token returned.\n */\n scopes: string[]\n /**\n * An account object for which tokens should be returned.\n */\n account: MSALAccount\n /**\n * The authority that MSAL will use to obtain tokens. If not included, authority from\n * MSALConfiguration will be used.\n */\n authority?: string\n /**\n * Ignore any existing access token in the cache and force MSAL to get a new access token\n * from the service.\n */\n forceRefresh?: boolean\n}\n\nexport interface MSALSignoutParams {\n /**\n * The account object for which to sign out of.\n */\n account: MSALAccount\n /**\n * Specifies whether signout should also open the browser and send a network request to the end_session_endpoint.\n * false by default.\n */\n signoutFromBrowser?: boolean\n /**\n * User Interface configuration that MSAL uses when getting a token interactively or\n * authorizing an end user.\n */\n webviewParameters?: MSALWebviewParams\n}\n\nexport interface MSALResult {\n /**\n * The Access Token requested, or empty string if no access token is returned in response\n */\n accessToken: string\n /**\n * The account object that holds account information.\n */\n account: MSALAccount\n /**\n * The time that the access token returned in the accessToken property ceases to be valid.\n * This value is calculated based on current UTC time measured locally and the value expiresIn returned from the service\n */\n expiresOn: number\n /**\n * The raw id token if it\u2019s returned by the service or undefined if no id token is returned.\n */\n idToken?: string\n /**\n * The scope values returned from the service.\n */\n scopes: string[]\n /**\n * Identifier for the directory where account is locally represented\n */\n tenantId?: string\n}\n\nexport interface MSALAccount {\n /**\n * Unique identifier for the account.\n */\n identifier: string\n /**\n * Host part of the authority string used for authentication based on the issuer identifier.\n */\n environment?: string\n /**\n * An identifier for the AAD tenant that the account was acquired from.\n */\n tenantId: string\n /**\n * Shorthand name by which the End-User wishes to be referred to at the RP, such as janedoe or j.doe.\n */\n username: string\n /**\n * ID token claims for the account. Can be used to read additional information about the account, e.g. name.\n */\n claims?: object\n}\n\n/**\n * Mostly, if not all, iOS webview parameters\n * See https://azuread.github.io/microsoft-authentication-library-for-objc/Classes/MSALWebviewParameters.html\n */\nexport interface MSALWebviewParams {\n /**\n * A Boolean value that indicates whether the ASWebAuthenticationSession should ask the\n * browser for a private authentication session.\n * For more info see here: https://developer.apple.com/documentation/authenticationservices/aswebauthenticationsession/3237231-prefersephemeralwebbrowsersessio?language=objc\n * @platform iOS 13+\n */\n ios_prefersEphemeralWebBrowserSession?: boolean\n /**\n * MSAL requires a web browser for interactive authentication.\n * There are multiple web browsers available to complete authentication.\n * MSAL will default to the web browser that provides best security and user experience for a given platform.\n * Ios_MSALWebviewType allows changing the experience by customizing the configuration to other options for\n * displaying web content\n * @platform iOS\n */\n ios_webviewType?: Ios_MSALWebviewType\n /**\n * Note: Has no effect when ios_webviewType === `Ios_MSALWebviewType.DEFAULT` or\n * ios_webviewType === `Ios_MSALWebviewType.AUTHENTICATION_SESSION`\n * @platform iOS\n */\n ios_presentationStyle?: Ios_ModalPresentationStyle\n}\n\n/**\n * See https://developer.apple.com/documentation/uikit/uimodalpresentationstyle\n */\nexport enum Ios_ModalPresentationStyle {\n fullScreen = 0,\n pageSheet,\n formSheet,\n currentContext,\n custom,\n overFullScreen,\n overCurrentContext,\n popover,\n blurOverFullScreen,\n none = -1,\n automatic = -2,\n}\n\n/**\n * See https://azuread.github.io/microsoft-authentication-library-for-objc/Enums/MSALWebviewType.html\n */\nexport enum Ios_MSALWebviewType {\n DEFAULT = 0,\n AUTHENTICATION_SESSION,\n SAFARI_VIEW_CONTROLLER,\n WK_WEB_VIEW,\n}\n", "import { PublicClientApplication } from './src/publicClientApplication'\nexport default PublicClientApplication\nexport * from './src/types'\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,gBAAgB;AAYzB,SAAS,qBAAqB;AAa9B,IAAM,SAA6B,cAAc;AAI1C,IAAM,0BAAN,MAAkE;AAAA,EAGvE,YAA6B,QAA2B;AAA3B;AAAA,EAA4B;AAAA,EAFjD,gBAAyB;AAAA,EAIjC,MAAa,OAAO;AAClB,QAAI,CAAC,KAAK,eAAe;AACvB,YAAM,OAAO,8BAA8B,KAAK,MAAM;AACtD,WAAK,gBAAgB;AAAA,IACvB;AACA,WAAO;AAAA,EACT;AAAA,EAEA,MAAa,aAAa,QAA+B;AACvD,SAAK,sBAAsB;AAC3B,WAAO,MAAM,OAAO,aAAa,MAAM;AAAA,EACzC;AAAA,EAEA,MAAa,mBAAmB,QAA0B;AACxD,SAAK,sBAAsB;AAC3B,WAAO,MAAM,OAAO,mBAAmB,MAAM;AAAA,EAC/C;AAAA,EAEA,MAAa,cAAc;AACzB,SAAK,sBAAsB;AAC3B,WAAO,MAAM,OAAO,YAAY;AAAA,EAClC;AAAA,EAEA,MAAa,WAAW,mBAA2B;AACjD,SAAK,sBAAsB;AAC3B,WAAO,MAAM,OAAO,WAAW,iBAAiB;AAAA,EAClD;AAAA,EAEA,MAAa,cAAc,SAAsB;AAC/C,SAAK,sBAAsB;AAC3B,WAAO,MAAM,OAAO,cAAc,OAAO;AAAA,EAC3C;AAAA,EAEA,MAAa,QAAQ,QAA2B;AAC9C,SAAK,sBAAsB;AAC3B,WAAO,MAAM,SAAS,OAAO;AAAA,MAC3B,KAAK,YAAY,MAAM,OAAO,QAAQ,MAAM;AAAA,MAC5C,SAAS,YAAY,MAAM,OAAO,cAAc,OAAO,OAAO;AAAA,IAChE,CAAC,EAAE;AAAA,EACL;AAAA,EAEA,MAAa,qBAAqB;AAChC,SAAK,sBAAsB;AAC3B,WAAO,MAAM,SAAS,OAAO;AAAA,MAC3B,SAAS,YAAY,MAAM,OAAO,mBAAmB;AAAA,MACrD,SAAS,YAAY;AAAA,IACvB,CAAC,EAAE;AAAA,EACL;AAAA,EAEQ,wBAAwB;AAC9B,QAAI,CAAC,KAAK,eAAe;AACvB,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;AC6DO,IAAK,iBAAL,kBAAKA,oBAAL;AAKL,EAAAA,gCAAA;AAIA,EAAAA,gCAAA;AAIA,EAAAA,gCAAA;AAMA,EAAAA,gCAAA;AAIA,EAAAA,gCAAA,aAAU,yBAAV;AAvBU,SAAAA;AAAA,GAAA;AAoJL,IAAK,6BAAL,kBAAKC,gCAAL;AACL,EAAAA,wDAAA,gBAAa,KAAb;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA,UAAO,MAAP;AACA,EAAAA,wDAAA,eAAY,MAAZ;AAXU,SAAAA;AAAA,GAAA;AAiBL,IAAK,sBAAL,kBAAKC,yBAAL;AACL,EAAAA,0CAAA,aAAU,KAAV;AACA,EAAAA,0CAAA;AACA,EAAAA,0CAAA;AACA,EAAAA,0CAAA;AAJU,SAAAA;AAAA,GAAA;;;AC3TZ,IAAO,6BAAQ;",
|
|
6
6
|
"names": ["MSALPromptType", "Ios_ModalPresentationStyle", "Ios_MSALWebviewType"]
|
|
7
7
|
}
|
|
@@ -10,5 +10,6 @@ export declare class PublicClientApplication implements IPublicClientApplication
|
|
|
10
10
|
getAccount(accountIdentifier: string): Promise<MSALAccount | undefined>;
|
|
11
11
|
removeAccount(account: MSALAccount): Promise<boolean>;
|
|
12
12
|
signOut(params: MSALSignoutParams): Promise<boolean>;
|
|
13
|
+
getSelectedBrowser(): Promise<string>;
|
|
13
14
|
private validateIsInitialized;
|
|
14
15
|
}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -43,6 +43,14 @@ export interface IPublicClientApplication {
|
|
|
43
43
|
* @platform ios
|
|
44
44
|
*/
|
|
45
45
|
signOut(params: MSALSignoutParams): Promise<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* Returns the browser that will be used for interactive authentication.
|
|
48
|
+
* NOTE: Android only. On iOS this will always return 'N/A'.
|
|
49
|
+
* @return Promise resolving to the package name and version of the browser that will be used
|
|
50
|
+
* for interactive authentication.
|
|
51
|
+
* @platform android
|
|
52
|
+
*/
|
|
53
|
+
getSelectedBrowser(): Promise<string>;
|
|
46
54
|
}
|
|
47
55
|
export interface MSALConfiguration {
|
|
48
56
|
auth: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-msal2",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "MSAL React Native wrapper for iOS and Android",
|
|
6
6
|
"homepage": "https://github.com/bittu/react-native-msal2#readme",
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"test": "jest",
|
|
20
20
|
"test:watch": "jest --watchAll",
|
|
21
21
|
"lint": "eslint . --fix --ext .js,.jsx,.ts,.tsx",
|
|
22
|
-
"format": "prettier \"{,!(app|dist)/**/}*.{ts,tsx}\" --write"
|
|
22
|
+
"format": "prettier \"{,!(app|dist)/**/}*.{ts,tsx}\" --write",
|
|
23
|
+
"prepublishOnly": "npm run build"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"@react-native/babel-preset": "^0.74.0",
|
|
@@ -20,6 +20,7 @@ type RNMSALNativeModule = {
|
|
|
20
20
|
getAccount(accountIdentifier: string): Promise<MSALAccount | undefined>
|
|
21
21
|
removeAccount(account: MSALAccount): Promise<boolean>
|
|
22
22
|
signout(params: MSALSignoutParams): Promise<boolean>
|
|
23
|
+
getSelectedBrowser(): Promise<string>
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
const RNMSAL: RNMSALNativeModule = NativeModules.RNMSAL
|
|
@@ -72,6 +73,14 @@ export class PublicClientApplication implements IPublicClientApplication {
|
|
|
72
73
|
})()
|
|
73
74
|
}
|
|
74
75
|
|
|
76
|
+
public async getSelectedBrowser() {
|
|
77
|
+
this.validateIsInitialized()
|
|
78
|
+
return await Platform.select({
|
|
79
|
+
android: async () => await RNMSAL.getSelectedBrowser(),
|
|
80
|
+
default: async () => 'N/A',
|
|
81
|
+
})()
|
|
82
|
+
}
|
|
83
|
+
|
|
75
84
|
private validateIsInitialized() {
|
|
76
85
|
if (!this.isInitialized) {
|
|
77
86
|
throw new Error(
|
package/src/types.ts
CHANGED
|
@@ -48,6 +48,15 @@ export interface IPublicClientApplication {
|
|
|
48
48
|
* @platform ios
|
|
49
49
|
*/
|
|
50
50
|
signOut(params: MSALSignoutParams): Promise<boolean>
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Returns the browser that will be used for interactive authentication.
|
|
54
|
+
* NOTE: Android only. On iOS this will always return 'N/A'.
|
|
55
|
+
* @return Promise resolving to the package name and version of the browser that will be used
|
|
56
|
+
* for interactive authentication.
|
|
57
|
+
* @platform android
|
|
58
|
+
*/
|
|
59
|
+
getSelectedBrowser(): Promise<string>
|
|
51
60
|
}
|
|
52
61
|
|
|
53
62
|
export interface MSALConfiguration {
|
package/app/.bundle/config
DELETED
package/app/.eslintrc.js
DELETED
package/app/.prettierrc.js
DELETED
|
File without changes
|
package/app/.watchmanconfig
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
package/app/Gemfile
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
source 'https://rubygems.org'
|
|
2
|
-
|
|
3
|
-
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
|
|
4
|
-
ruby ">= 2.6.10"
|
|
5
|
-
|
|
6
|
-
# Cocoapods 1.15 introduced a bug which break the build. We will remove the upper
|
|
7
|
-
# bound in the template on Cocoapods with next React Native release.
|
|
8
|
-
gem 'cocoapods', '>= 1.13', '< 1.15'
|
|
9
|
-
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
|
package/app/README.md
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).
|
|
2
|
-
|
|
3
|
-
# Getting Started
|
|
4
|
-
|
|
5
|
-
>**Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.
|
|
6
|
-
|
|
7
|
-
## Step 1: Start the Metro Server
|
|
8
|
-
|
|
9
|
-
First, you will need to start **Metro**, the JavaScript _bundler_ that ships _with_ React Native.
|
|
10
|
-
|
|
11
|
-
To start Metro, run the following command from the _root_ of your React Native project:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
# using npm
|
|
15
|
-
npm start
|
|
16
|
-
|
|
17
|
-
# OR using Yarn
|
|
18
|
-
yarn start
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Step 2: Start your Application
|
|
22
|
-
|
|
23
|
-
Let Metro Bundler run in its _own_ terminal. Open a _new_ terminal from the _root_ of your React Native project. Run the following command to start your _Android_ or _iOS_ app:
|
|
24
|
-
|
|
25
|
-
### For Android
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
# using npm
|
|
29
|
-
npm run android
|
|
30
|
-
|
|
31
|
-
# OR using Yarn
|
|
32
|
-
yarn android
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### For iOS
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
# using npm
|
|
39
|
-
npm run ios
|
|
40
|
-
|
|
41
|
-
# OR using Yarn
|
|
42
|
-
yarn ios
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
If everything is set up _correctly_, you should see your new app running in your _Android Emulator_ or _iOS Simulator_ shortly provided you have set up your emulator/simulator correctly.
|
|
46
|
-
|
|
47
|
-
This is one way to run your app — you can also run it directly from within Android Studio and Xcode respectively.
|
|
48
|
-
|
|
49
|
-
## Step 3: Modifying your App
|
|
50
|
-
|
|
51
|
-
Now that you have successfully run the app, let's modify it.
|
|
52
|
-
|
|
53
|
-
1. Open `App.tsx` in your text editor of choice and edit some lines.
|
|
54
|
-
2. For **Android**: Press the <kbd>R</kbd> key twice or select **"Reload"** from the **Developer Menu** (<kbd>Ctrl</kbd> + <kbd>M</kbd> (on Window and Linux) or <kbd>Cmd ⌘</kbd> + <kbd>M</kbd> (on macOS)) to see your changes!
|
|
55
|
-
|
|
56
|
-
For **iOS**: Hit <kbd>Cmd ⌘</kbd> + <kbd>R</kbd> in your iOS Simulator to reload the app and see your changes!
|
|
57
|
-
|
|
58
|
-
## Congratulations! :tada:
|
|
59
|
-
|
|
60
|
-
You've successfully run and modified your React Native App. :partying_face:
|
|
61
|
-
|
|
62
|
-
### Now what?
|
|
63
|
-
|
|
64
|
-
- If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps).
|
|
65
|
-
- If you're curious to learn more about React Native, check out the [Introduction to React Native](https://reactnative.dev/docs/getting-started).
|
|
66
|
-
|
|
67
|
-
# Troubleshooting
|
|
68
|
-
|
|
69
|
-
If you can't get this to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.
|
|
70
|
-
|
|
71
|
-
# Learn More
|
|
72
|
-
|
|
73
|
-
To learn more about React Native, take a look at the following resources:
|
|
74
|
-
|
|
75
|
-
- [React Native Website](https://reactnative.dev) - learn more about React Native.
|
|
76
|
-
- [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment.
|
|
77
|
-
- [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**.
|
|
78
|
-
- [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.
|
|
79
|
-
- [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
apply plugin: "com.android.application"
|
|
2
|
-
apply plugin: "org.jetbrains.kotlin.android"
|
|
3
|
-
apply plugin: "com.facebook.react"
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* This is the configuration block to customize your React Native Android app.
|
|
7
|
-
* By default you don't need to apply any configuration, just uncomment the lines you need.
|
|
8
|
-
*/
|
|
9
|
-
react {
|
|
10
|
-
/* Folders */
|
|
11
|
-
// The root of your project, i.e. where "package.json" lives. Default is '..'
|
|
12
|
-
// root = file("../")
|
|
13
|
-
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
|
|
14
|
-
// reactNativeDir = file("../node_modules/react-native")
|
|
15
|
-
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
|
|
16
|
-
// codegenDir = file("../node_modules/@react-native/codegen")
|
|
17
|
-
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
|
|
18
|
-
// cliFile = file("../node_modules/react-native/cli.js")
|
|
19
|
-
|
|
20
|
-
/* Variants */
|
|
21
|
-
// The list of variants to that are debuggable. For those we're going to
|
|
22
|
-
// skip the bundling of the JS bundle and the assets. By default is just 'debug'.
|
|
23
|
-
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
|
|
24
|
-
// debuggableVariants = ["liteDebug", "prodDebug"]
|
|
25
|
-
|
|
26
|
-
/* Bundling */
|
|
27
|
-
// A list containing the node command and its flags. Default is just 'node'.
|
|
28
|
-
// nodeExecutableAndArgs = ["node"]
|
|
29
|
-
//
|
|
30
|
-
// The command to run when bundling. By default is 'bundle'
|
|
31
|
-
// bundleCommand = "ram-bundle"
|
|
32
|
-
//
|
|
33
|
-
// The path to the CLI configuration file. Default is empty.
|
|
34
|
-
// bundleConfig = file(../rn-cli.config.js)
|
|
35
|
-
//
|
|
36
|
-
// The name of the generated asset file containing your JS bundle
|
|
37
|
-
// bundleAssetName = "MyApplication.android.bundle"
|
|
38
|
-
//
|
|
39
|
-
// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
|
|
40
|
-
// entryFile = file("../js/MyApplication.android.js")
|
|
41
|
-
//
|
|
42
|
-
// A list of extra flags to pass to the 'bundle' commands.
|
|
43
|
-
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
|
|
44
|
-
// extraPackagerArgs = []
|
|
45
|
-
|
|
46
|
-
/* Hermes Commands */
|
|
47
|
-
// The hermes compiler command to run. By default it is 'hermesc'
|
|
48
|
-
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
|
|
49
|
-
//
|
|
50
|
-
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
|
|
51
|
-
// hermesFlags = ["-O", "-output-source-map"]
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
|
|
56
|
-
*/
|
|
57
|
-
def enableProguardInReleaseBuilds = false
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* The preferred build flavor of JavaScriptCore (JSC)
|
|
61
|
-
*
|
|
62
|
-
* For example, to use the international variant, you can use:
|
|
63
|
-
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
|
|
64
|
-
*
|
|
65
|
-
* The international variant includes ICU i18n library and necessary data
|
|
66
|
-
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
|
|
67
|
-
* give correct results when using with locales other than en-US. Note that
|
|
68
|
-
* this variant is about 6MiB larger per architecture than default.
|
|
69
|
-
*/
|
|
70
|
-
def jscFlavor = 'org.webkit:android-jsc:+'
|
|
71
|
-
|
|
72
|
-
android {
|
|
73
|
-
ndkVersion rootProject.ext.ndkVersion
|
|
74
|
-
buildToolsVersion rootProject.ext.buildToolsVersion
|
|
75
|
-
compileSdk rootProject.ext.compileSdkVersion
|
|
76
|
-
|
|
77
|
-
namespace "com.msal2app"
|
|
78
|
-
defaultConfig {
|
|
79
|
-
applicationId "com.msal2app"
|
|
80
|
-
minSdkVersion rootProject.ext.minSdkVersion
|
|
81
|
-
targetSdkVersion rootProject.ext.targetSdkVersion
|
|
82
|
-
versionCode 1
|
|
83
|
-
versionName "1.0"
|
|
84
|
-
}
|
|
85
|
-
signingConfigs {
|
|
86
|
-
debug {
|
|
87
|
-
storeFile file('debug.keystore')
|
|
88
|
-
storePassword 'android'
|
|
89
|
-
keyAlias 'androiddebugkey'
|
|
90
|
-
keyPassword 'android'
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
buildTypes {
|
|
94
|
-
debug {
|
|
95
|
-
signingConfig signingConfigs.debug
|
|
96
|
-
}
|
|
97
|
-
release {
|
|
98
|
-
// Caution! In production, you need to generate your own keystore file.
|
|
99
|
-
// see https://reactnative.dev/docs/signed-apk-android.
|
|
100
|
-
signingConfig signingConfigs.debug
|
|
101
|
-
minifyEnabled enableProguardInReleaseBuilds
|
|
102
|
-
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
dependencies {
|
|
108
|
-
// The version of react-native is set by the React Native Gradle Plugin
|
|
109
|
-
implementation("com.facebook.react:react-android")
|
|
110
|
-
implementation("com.facebook.react:flipper-integration")
|
|
111
|
-
|
|
112
|
-
if (hermesEnabled.toBoolean()) {
|
|
113
|
-
implementation("com.facebook.react:hermes-android")
|
|
114
|
-
} else {
|
|
115
|
-
implementation jscFlavor
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
|
|
Binary file
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# Add project specific ProGuard rules here.
|
|
2
|
-
# By default, the flags in this file are appended to flags specified
|
|
3
|
-
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
|
|
4
|
-
# You can edit the include path and order by changing the proguardFiles
|
|
5
|
-
# directive in build.gradle.
|
|
6
|
-
#
|
|
7
|
-
# For more details, see
|
|
8
|
-
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
9
|
-
|
|
10
|
-
# Add any project specific keep options here:
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
-
xmlns:tools="http://schemas.android.com/tools">
|
|
4
|
-
|
|
5
|
-
<application
|
|
6
|
-
android:usesCleartextTraffic="true"
|
|
7
|
-
tools:targetApi="28"
|
|
8
|
-
tools:ignore="GoogleAppIndexingWarning"/>
|
|
9
|
-
</manifest>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
2
|
-
|
|
3
|
-
<uses-permission android:name="android.permission.INTERNET" />
|
|
4
|
-
|
|
5
|
-
<application
|
|
6
|
-
android:name=".MainApplication"
|
|
7
|
-
android:label="@string/app_name"
|
|
8
|
-
android:icon="@mipmap/ic_launcher"
|
|
9
|
-
android:roundIcon="@mipmap/ic_launcher_round"
|
|
10
|
-
android:allowBackup="false"
|
|
11
|
-
android:theme="@style/AppTheme">
|
|
12
|
-
<activity
|
|
13
|
-
android:name=".MainActivity"
|
|
14
|
-
android:label="@string/app_name"
|
|
15
|
-
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
|
|
16
|
-
android:launchMode="singleTask"
|
|
17
|
-
android:windowSoftInputMode="adjustResize"
|
|
18
|
-
android:exported="true">
|
|
19
|
-
<intent-filter>
|
|
20
|
-
<action android:name="android.intent.action.MAIN" />
|
|
21
|
-
<category android:name="android.intent.category.LAUNCHER" />
|
|
22
|
-
</intent-filter>
|
|
23
|
-
</activity>
|
|
24
|
-
</application>
|
|
25
|
-
</manifest>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
package com.msal2app
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.ReactActivity
|
|
4
|
-
import com.facebook.react.ReactActivityDelegate
|
|
5
|
-
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
|
|
6
|
-
import com.facebook.react.defaults.DefaultReactActivityDelegate
|
|
7
|
-
|
|
8
|
-
class MainActivity : ReactActivity() {
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Returns the name of the main component registered from JavaScript. This is used to schedule
|
|
12
|
-
* rendering of the component.
|
|
13
|
-
*/
|
|
14
|
-
override fun getMainComponentName(): String = "Msal2App"
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
|
|
18
|
-
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
|
|
19
|
-
*/
|
|
20
|
-
override fun createReactActivityDelegate(): ReactActivityDelegate =
|
|
21
|
-
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
|
|
22
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
package com.msal2app
|
|
2
|
-
|
|
3
|
-
import android.app.Application
|
|
4
|
-
import com.facebook.react.PackageList
|
|
5
|
-
import com.facebook.react.ReactApplication
|
|
6
|
-
import com.facebook.react.ReactHost
|
|
7
|
-
import com.facebook.react.ReactNativeHost
|
|
8
|
-
import com.facebook.react.ReactPackage
|
|
9
|
-
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
|
|
10
|
-
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
|
|
11
|
-
import com.facebook.react.defaults.DefaultReactNativeHost
|
|
12
|
-
import com.facebook.react.flipper.ReactNativeFlipper
|
|
13
|
-
import com.facebook.soloader.SoLoader
|
|
14
|
-
|
|
15
|
-
class MainApplication : Application(), ReactApplication {
|
|
16
|
-
|
|
17
|
-
override val reactNativeHost: ReactNativeHost =
|
|
18
|
-
object : DefaultReactNativeHost(this) {
|
|
19
|
-
override fun getPackages(): List<ReactPackage> =
|
|
20
|
-
PackageList(this).packages.apply {
|
|
21
|
-
// Packages that cannot be autolinked yet can be added manually here, for example:
|
|
22
|
-
// add(MyReactNativePackage())
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
override fun getJSMainModuleName(): String = "index"
|
|
26
|
-
|
|
27
|
-
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
|
|
28
|
-
|
|
29
|
-
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
|
|
30
|
-
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
override val reactHost: ReactHost
|
|
34
|
-
get() = getDefaultReactHost(this.applicationContext, reactNativeHost)
|
|
35
|
-
|
|
36
|
-
override fun onCreate() {
|
|
37
|
-
super.onCreate()
|
|
38
|
-
SoLoader.init(this, false)
|
|
39
|
-
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
|
40
|
-
// If you opted-in for the New Architecture, we load the native entry point for this app.
|
|
41
|
-
load()
|
|
42
|
-
}
|
|
43
|
-
ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager)
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<!-- Copyright (C) 2014 The Android Open Source Project
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
-->
|
|
16
|
-
<inset xmlns:android="http://schemas.android.com/apk/res/android"
|
|
17
|
-
android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material"
|
|
18
|
-
android:insetRight="@dimen/abc_edit_text_inset_horizontal_material"
|
|
19
|
-
android:insetTop="@dimen/abc_edit_text_inset_top_material"
|
|
20
|
-
android:insetBottom="@dimen/abc_edit_text_inset_bottom_material">
|
|
21
|
-
|
|
22
|
-
<selector>
|
|
23
|
-
<!--
|
|
24
|
-
This file is a copy of abc_edit_text_material (https://bit.ly/3k8fX7I).
|
|
25
|
-
The item below with state_pressed="false" and state_focused="false" causes a NullPointerException.
|
|
26
|
-
NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)'
|
|
27
|
-
|
|
28
|
-
<item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
|
|
29
|
-
|
|
30
|
-
For more info, see https://bit.ly/3CdLStv (react-native/pull/29452) and https://bit.ly/3nxOMoR.
|
|
31
|
-
-->
|
|
32
|
-
<item android:state_enabled="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
|
|
33
|
-
<item android:drawable="@drawable/abc_textfield_activated_mtrl_alpha"/>
|
|
34
|
-
</selector>
|
|
35
|
-
|
|
36
|
-
</inset>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<resources>
|
|
2
|
-
|
|
3
|
-
<!-- Base application theme. -->
|
|
4
|
-
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
|
|
5
|
-
<!-- Customize your theme here. -->
|
|
6
|
-
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
|
|
7
|
-
</style>
|
|
8
|
-
|
|
9
|
-
</resources>
|