@equinor/mad-auth 0.1.24 → 0.2.0
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/CHANGELOG.md +10 -0
- package/dist/Expo-AuthSession/authenticationHandler/auth.d.ts +32 -0
- package/dist/Expo-AuthSession/authenticationHandler/auth.js +23 -0
- package/dist/Expo-AuthSession/authenticationHandler/index.d.ts +8 -0
- package/dist/Expo-AuthSession/authenticationHandler/index.js +31 -0
- package/dist/Expo-AuthSession/authenticationHandler/web/authWeb.d.ts +39 -0
- package/dist/Expo-AuthSession/authenticationHandler/web/authWeb.js +22 -0
- package/dist/Expo-AuthSession/authenticationHandler/web/index.d.ts +4 -0
- package/dist/Expo-AuthSession/authenticationHandler/web/index.js +33 -0
- package/dist/Expo-AuthSession/authenticationHandler/web/publicClientApplication.d.ts +13 -0
- package/dist/Expo-AuthSession/authenticationHandler/web/publicClientApplication.js +8 -0
- package/dist/Expo-AuthSession/authenticationHandler/web/types.d.ts +304 -0
- package/dist/Expo-AuthSession/authenticationHandler/web/types.js +11 -0
- package/dist/Expo-AuthSession/components/LoginButton.d.ts +4 -0
- package/dist/Expo-AuthSession/components/LoginButton.js +19 -0
- package/dist/Expo-AuthSession/hooks/useAccount.d.ts +4 -0
- package/dist/Expo-AuthSession/hooks/useAccount.js +22 -0
- package/dist/Expo-AuthSession/hooks/useAuthenticate.d.ts +20 -0
- package/dist/Expo-AuthSession/hooks/useAuthenticate.js +18 -0
- package/dist/Expo-AuthSession/index.d.ts +6 -0
- package/dist/Expo-AuthSession/index.js +76 -0
- package/dist/Expo-AuthSession/store/authStore.d.ts +36 -0
- package/dist/Expo-AuthSession/store/authStore.js +32 -0
- package/dist/Expo-AuthSession/store/encryption.d.ts +4 -0
- package/dist/Expo-AuthSession/store/encryption.js +11 -0
- package/dist/Expo-AuthSession/types.d.ts +16 -0
- package/dist/Expo-AuthSession/types.js +1 -0
- package/dist/Expo-AuthSession/utils/decodeToken.d.ts +8 -0
- package/dist/Expo-AuthSession/utils/decodeToken.js +7 -0
- package/dist/Expo-AuthSession/utils/tokenRefresh.d.ts +2 -0
- package/dist/Expo-AuthSession/utils/tokenRefresh.js +9 -0
- package/dist/_internal/translationLayer.d.ts +1 -1
- package/dist/_internal/translationLayer.js +2 -1
- package/dist/auth.d.ts +4 -0
- package/dist/auth.js +5 -2
- package/dist/chunk-2APLN7PB.js +63 -0
- package/dist/chunk-5WASXW2G.js +49 -0
- package/dist/chunk-6Q5OCWP7.js +21 -0
- package/dist/chunk-6UTWP7VI.js +123 -0
- package/dist/{chunk-ZTEWSERJ.js → chunk-7FYKB6SB.js} +2 -2
- package/dist/chunk-7SOSXNKP.js +17 -0
- package/dist/{chunk-HIGCNJNC.js → chunk-AD532AOW.js} +2 -2
- package/dist/chunk-CFM3MLGB.js +39 -0
- package/dist/chunk-D7L44FRV.js +17 -0
- package/dist/chunk-DXZ4T5LX.js +87 -0
- package/dist/chunk-FF7UDUOZ.js +33 -0
- package/dist/chunk-GCVP36UH.js +10 -0
- package/dist/chunk-JVCNKTCD.js +76 -0
- package/dist/chunk-MWXZHQN3.js +36 -0
- package/dist/chunk-NP4GJ5X5.js +0 -0
- package/dist/chunk-OFQ6U2BU.js +103 -0
- package/dist/{chunk-UT6IGOV7.js → chunk-TTVDYDVO.js} +9 -3
- package/dist/{chunk-763B4HQC.js → chunk-WEAGW6MQ.js} +10 -16
- package/dist/chunk-WQQ3TZZU.js +127 -0
- package/dist/{chunk-GCZJ767T.js → chunk-XAS776NQ.js} +2 -2
- package/dist/chunk-XHVESUQ2.js +60 -0
- package/dist/components/LoginButton.js +5 -4
- package/dist/components/index.js +5 -4
- package/dist/hooks/index.js +7 -6
- package/dist/hooks/useAccount.js +4 -3
- package/dist/hooks/useAuthenticate.js +4 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +27 -8
- package/package.json +65 -46
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @equinor/mad-auth
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 14d79cb: Implemented Expo-Auth-Session as authentication alternative from mad-auth
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 1fe26dc: Added msal-browser client implementation
|
|
12
|
+
|
|
3
13
|
## 0.1.24
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AuthRequestConfig, DiscoveryDocument } from "expo-auth-session";
|
|
2
|
+
import { MadAccount, MadAuthenticationResult } from "../../types";
|
|
3
|
+
import "core-js/stable/atob";
|
|
4
|
+
/**
|
|
5
|
+
* Initiates the auth client by setting the needed properties in the zustand store
|
|
6
|
+
* @param config -- contains app specific configurations for authentication such as clientId, redirectUri etc.
|
|
7
|
+
* @param discovery -- equivalent to authority from msal but with some more properties
|
|
8
|
+
*/
|
|
9
|
+
export declare function initiateAuthenticationClient(config: AuthRequestConfig, discovery: DiscoveryDocument): void;
|
|
10
|
+
export declare function authenticationClientExists(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Authenticate interactively. This will open an in-app browser, or the Microsoft Authenticator app if the
|
|
13
|
+
* user has it installed
|
|
14
|
+
* @returns {MadAuthenticationResult | null} an object containing the access token and the account, or null
|
|
15
|
+
*/
|
|
16
|
+
export declare const authenticateInteractively: () => Promise<MadAuthenticationResult | null>;
|
|
17
|
+
/**
|
|
18
|
+
* Authenticate silently.
|
|
19
|
+
* @returns {MadAuthenticationResult | null} an object containing the access token and the account, or null
|
|
20
|
+
*/
|
|
21
|
+
export declare const authenticateSilently: () => Promise<MadAuthenticationResult | null>;
|
|
22
|
+
export declare function getAccount(): MadAccount | null;
|
|
23
|
+
/**
|
|
24
|
+
* Sign out the account.
|
|
25
|
+
* @returns {boolean} whether we successfully signed out.
|
|
26
|
+
* Only needed as backwards compatibility for the react-native-msal implementation.
|
|
27
|
+
*/
|
|
28
|
+
export declare function signOut(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* resets the config properties of the auth client
|
|
31
|
+
*/
|
|
32
|
+
export declare function reset(): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
authenticateInteractively,
|
|
3
|
+
authenticateSilently,
|
|
4
|
+
authenticationClientExists,
|
|
5
|
+
getAccount,
|
|
6
|
+
initiateAuthenticationClient,
|
|
7
|
+
reset,
|
|
8
|
+
signOut
|
|
9
|
+
} from "../../chunk-OFQ6U2BU.js";
|
|
10
|
+
import "../../chunk-D7L44FRV.js";
|
|
11
|
+
import "../../chunk-6Q5OCWP7.js";
|
|
12
|
+
import "../../chunk-DXZ4T5LX.js";
|
|
13
|
+
import "../../chunk-5WASXW2G.js";
|
|
14
|
+
import "../../chunk-WEAGW6MQ.js";
|
|
15
|
+
export {
|
|
16
|
+
authenticateInteractively,
|
|
17
|
+
authenticateSilently,
|
|
18
|
+
authenticationClientExists,
|
|
19
|
+
getAccount,
|
|
20
|
+
initiateAuthenticationClient,
|
|
21
|
+
reset,
|
|
22
|
+
signOut
|
|
23
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { getAccountWeb, MSALAccount, MSALResult } from "./web";
|
|
2
|
+
export { getAccount } from "./auth";
|
|
3
|
+
import { AuthRequestConfig, DiscoveryDocument } from "expo-auth-session";
|
|
4
|
+
export declare const signOut: () => boolean | Promise<boolean>;
|
|
5
|
+
export declare const authenticateSilently: (scopes?: string[]) => Promise<import("../..").MadAuthenticationResult | null>;
|
|
6
|
+
export declare const authenticateInteractively: (scopes?: string[]) => Promise<import("../..").MadAuthenticationResult | null>;
|
|
7
|
+
export declare const initiateAuthenticationClient: (config: AuthRequestConfig, discovery: DiscoveryDocument) => void;
|
|
8
|
+
export declare const authenticationClientExists: () => boolean;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
authenticateInteractively,
|
|
3
|
+
authenticateSilently,
|
|
4
|
+
authenticationClientExists,
|
|
5
|
+
initiateAuthenticationClient,
|
|
6
|
+
signOut
|
|
7
|
+
} from "../../chunk-FF7UDUOZ.js";
|
|
8
|
+
import "../../chunk-GCVP36UH.js";
|
|
9
|
+
import {
|
|
10
|
+
getAccountWeb
|
|
11
|
+
} from "../../chunk-6UTWP7VI.js";
|
|
12
|
+
import "../../chunk-WQQ3TZZU.js";
|
|
13
|
+
import "../../chunk-MWXZHQN3.js";
|
|
14
|
+
import {
|
|
15
|
+
getAccount
|
|
16
|
+
} from "../../chunk-OFQ6U2BU.js";
|
|
17
|
+
import "../../chunk-D7L44FRV.js";
|
|
18
|
+
import "../../chunk-6Q5OCWP7.js";
|
|
19
|
+
import "../../chunk-DXZ4T5LX.js";
|
|
20
|
+
import "../../chunk-5WASXW2G.js";
|
|
21
|
+
import "../../chunk-7SOSXNKP.js";
|
|
22
|
+
import "../../chunk-WEAGW6MQ.js";
|
|
23
|
+
export {
|
|
24
|
+
authenticateInteractively,
|
|
25
|
+
authenticateSilently,
|
|
26
|
+
authenticationClientExists,
|
|
27
|
+
getAccount,
|
|
28
|
+
getAccountWeb,
|
|
29
|
+
initiateAuthenticationClient,
|
|
30
|
+
signOut
|
|
31
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { MadAccount, MadAuthenticationResult } from "../../../types";
|
|
2
|
+
export type InitiateAuthenticationClientConfig = {
|
|
3
|
+
clientId: string;
|
|
4
|
+
redirectUri: string;
|
|
5
|
+
authority?: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Initiate the authentication client
|
|
9
|
+
* @param {InitiateAuthenticationClientConfig} config
|
|
10
|
+
*/
|
|
11
|
+
export declare function initiateAuthenticationClientWeb({ clientId, redirectUri, authority, }: InitiateAuthenticationClientConfig): void;
|
|
12
|
+
/**
|
|
13
|
+
* Check if the authentication client exists
|
|
14
|
+
* @returns {boolean} whether the authentication client exists
|
|
15
|
+
*/
|
|
16
|
+
export declare function authenticationClientExistsWeb(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Authenticate interactively. This will open an in-app browser, or the Microsoft Authenticator app if the
|
|
19
|
+
* user has it installed
|
|
20
|
+
* @param scopes an array of scopes
|
|
21
|
+
* @returns {MadAuthenticationResult | null} an object containing the access token and the account, or null
|
|
22
|
+
*/
|
|
23
|
+
export declare function authenticateInteractivelyWeb(scopes?: string[]): Promise<MadAuthenticationResult | null>;
|
|
24
|
+
export declare function getAccountWeb(): Promise<MadAccount | null>;
|
|
25
|
+
/**
|
|
26
|
+
* Authenticate silently.
|
|
27
|
+
* @param scopes an array of scopes
|
|
28
|
+
* @returns {MadAuthenticationResult | null} an object containing the access token and the account, or null
|
|
29
|
+
*/
|
|
30
|
+
export declare function authenticateSilentlyWeb(scopes?: string[]): Promise<MadAuthenticationResult | null>;
|
|
31
|
+
/**
|
|
32
|
+
* Sign out the account.
|
|
33
|
+
* @returns {boolean} whether we successfully signed out.
|
|
34
|
+
*/
|
|
35
|
+
export declare function signOutWeb(): Promise<boolean>;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
export declare function _resetWeb(): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
_resetWeb,
|
|
3
|
+
authenticateInteractivelyWeb,
|
|
4
|
+
authenticateSilentlyWeb,
|
|
5
|
+
authenticationClientExistsWeb,
|
|
6
|
+
getAccountWeb,
|
|
7
|
+
initiateAuthenticationClientWeb,
|
|
8
|
+
signOutWeb
|
|
9
|
+
} from "../../../chunk-6UTWP7VI.js";
|
|
10
|
+
import "../../../chunk-WQQ3TZZU.js";
|
|
11
|
+
import "../../../chunk-MWXZHQN3.js";
|
|
12
|
+
import "../../../chunk-7SOSXNKP.js";
|
|
13
|
+
import "../../../chunk-WEAGW6MQ.js";
|
|
14
|
+
export {
|
|
15
|
+
_resetWeb,
|
|
16
|
+
authenticateInteractivelyWeb,
|
|
17
|
+
authenticateSilentlyWeb,
|
|
18
|
+
authenticationClientExistsWeb,
|
|
19
|
+
getAccountWeb,
|
|
20
|
+
initiateAuthenticationClientWeb,
|
|
21
|
+
signOutWeb
|
|
22
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
web_default
|
|
3
|
+
} from "../../../chunk-GCVP36UH.js";
|
|
4
|
+
import {
|
|
5
|
+
_resetWeb,
|
|
6
|
+
authenticateInteractivelyWeb,
|
|
7
|
+
authenticateSilentlyWeb,
|
|
8
|
+
authenticationClientExistsWeb,
|
|
9
|
+
getAccountWeb,
|
|
10
|
+
initiateAuthenticationClientWeb,
|
|
11
|
+
signOutWeb
|
|
12
|
+
} from "../../../chunk-6UTWP7VI.js";
|
|
13
|
+
import "../../../chunk-WQQ3TZZU.js";
|
|
14
|
+
import {
|
|
15
|
+
Ios_MSALWebviewType,
|
|
16
|
+
Ios_ModalPresentationStyle,
|
|
17
|
+
MSALPromptType
|
|
18
|
+
} from "../../../chunk-MWXZHQN3.js";
|
|
19
|
+
import "../../../chunk-7SOSXNKP.js";
|
|
20
|
+
import "../../../chunk-WEAGW6MQ.js";
|
|
21
|
+
export {
|
|
22
|
+
Ios_MSALWebviewType,
|
|
23
|
+
Ios_ModalPresentationStyle,
|
|
24
|
+
MSALPromptType,
|
|
25
|
+
_resetWeb,
|
|
26
|
+
authenticateInteractivelyWeb,
|
|
27
|
+
authenticateSilentlyWeb,
|
|
28
|
+
authenticationClientExistsWeb,
|
|
29
|
+
web_default as default,
|
|
30
|
+
getAccountWeb,
|
|
31
|
+
initiateAuthenticationClientWeb,
|
|
32
|
+
signOutWeb
|
|
33
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IPublicClientApplication, MSALAccount, MSALConfiguration, MSALInteractiveParams, MSALResult, MSALSignoutParams, MSALSilentParams } from "./types";
|
|
2
|
+
export declare class PublicClientApplication implements IPublicClientApplication {
|
|
3
|
+
private readonly config;
|
|
4
|
+
private _pca;
|
|
5
|
+
constructor(config: MSALConfiguration);
|
|
6
|
+
init(): this;
|
|
7
|
+
acquireToken(params: MSALInteractiveParams): Promise<MSALResult | undefined>;
|
|
8
|
+
acquireTokenSilent(params: MSALSilentParams): Promise<MSALResult | undefined>;
|
|
9
|
+
getAccounts(): Promise<MSALAccount[]>;
|
|
10
|
+
getAccount(accountIdentifier: string): Promise<MSALAccount | undefined>;
|
|
11
|
+
removeAccount(account: MSALAccount): Promise<boolean>;
|
|
12
|
+
signOut(params: MSALSignoutParams): Promise<boolean>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import type { Configuration } from "@azure/msal-browser";
|
|
2
|
+
export type IPublicClientApplication = {
|
|
3
|
+
/**
|
|
4
|
+
* Acquire a token interactively
|
|
5
|
+
* @param {MSALInteractiveParams} params
|
|
6
|
+
* @return Result containing an access token and account identifier
|
|
7
|
+
* used for acquiring subsequent tokens silently
|
|
8
|
+
*/
|
|
9
|
+
acquireToken(params: MSALInteractiveParams): Promise<MSALResult | undefined>;
|
|
10
|
+
/**
|
|
11
|
+
* Acquire a token silently
|
|
12
|
+
* @param {MSALSilentParams} params - Includes the account identifer retrieved from a
|
|
13
|
+
* previous interactive login
|
|
14
|
+
* @return Result containing an access token and account identifier
|
|
15
|
+
* used for acquiring subsequent tokens silently
|
|
16
|
+
*/
|
|
17
|
+
acquireTokenSilent(params: MSALSilentParams): Promise<MSALResult | undefined>;
|
|
18
|
+
/**
|
|
19
|
+
* Get all accounts for which this application has refresh tokens
|
|
20
|
+
* @return Promise containing array of MSALAccount objects for which this application
|
|
21
|
+
* has refresh tokens.
|
|
22
|
+
*/
|
|
23
|
+
getAccounts(): Promise<MSALAccount[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Retrieve the account matching the identifier
|
|
26
|
+
* @return Promise containing MSALAccount object
|
|
27
|
+
*/
|
|
28
|
+
getAccount(accountIdentifier: string): Promise<MSALAccount | undefined>;
|
|
29
|
+
/**
|
|
30
|
+
* Removes all tokens from the cache for this application for the provided
|
|
31
|
+
* account.
|
|
32
|
+
* @param {MSALAccount} account
|
|
33
|
+
* @return A promise containing a boolean = true if account removal was successful
|
|
34
|
+
* otherwise rejects
|
|
35
|
+
*/
|
|
36
|
+
removeAccount(account: MSALAccount): Promise<boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* Removes all tokens from the cache for this application for the provided
|
|
39
|
+
* account. Additionally, this will remove the account from the system browser.
|
|
40
|
+
* NOTE: iOS only. On Android and web this is the same as `removeAccount`.
|
|
41
|
+
* @param {MSALSignoutParams} params
|
|
42
|
+
* @return A promise which resolves if sign out is successful,
|
|
43
|
+
* otherwise rejects
|
|
44
|
+
* @platform ios
|
|
45
|
+
*/
|
|
46
|
+
signOut(params: MSALSignoutParams): Promise<boolean>;
|
|
47
|
+
};
|
|
48
|
+
export type MSALConfiguration = {
|
|
49
|
+
auth: {
|
|
50
|
+
/**
|
|
51
|
+
* The client ID of the application, this should come from the app developer portal.
|
|
52
|
+
*/
|
|
53
|
+
clientId: string;
|
|
54
|
+
/**
|
|
55
|
+
* The authority the application will use to obtain tokens.
|
|
56
|
+
*/
|
|
57
|
+
authority?: string;
|
|
58
|
+
/**
|
|
59
|
+
* List of known authorities that the application should trust.
|
|
60
|
+
*/
|
|
61
|
+
knownAuthorities?: string[];
|
|
62
|
+
/**
|
|
63
|
+
* The redirect URI of the application.
|
|
64
|
+
*
|
|
65
|
+
* If you are providing this property, you should probably use `Platform.select`,
|
|
66
|
+
* because the redirect uris will be different for each platform.
|
|
67
|
+
*/
|
|
68
|
+
redirectUri?: string;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* @platform web
|
|
72
|
+
*/
|
|
73
|
+
cache?: Configuration["cache"] & {
|
|
74
|
+
cacheLocation?: "localStorage" | "sessionStorage";
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Options as described here: {@link https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-configuration}
|
|
78
|
+
* @platform android
|
|
79
|
+
*/
|
|
80
|
+
androidConfigOptions?: MSALAndroidConfigOptions;
|
|
81
|
+
};
|
|
82
|
+
export type MSALAndroidConfigOptions = {
|
|
83
|
+
authorization_user_agent?: "DEFAULT" | "BROWSER" | "WEBVIEW";
|
|
84
|
+
broker_redirect_uri_registered?: boolean;
|
|
85
|
+
browser_safelist?: {
|
|
86
|
+
browser_package_name: string;
|
|
87
|
+
browser_signature_hashes: string[];
|
|
88
|
+
browser_use_customTab: boolean;
|
|
89
|
+
}[];
|
|
90
|
+
http?: {
|
|
91
|
+
connect_timeout?: number;
|
|
92
|
+
read_timeout?: number;
|
|
93
|
+
};
|
|
94
|
+
logging?: {
|
|
95
|
+
pii_enabled?: boolean;
|
|
96
|
+
log_level?: "ERROR" | "WARNING" | "INFO" | "VERBOSE";
|
|
97
|
+
logcat_enabled?: boolean;
|
|
98
|
+
};
|
|
99
|
+
multiple_clouds_supported?: boolean;
|
|
100
|
+
};
|
|
101
|
+
export type MSALInteractiveParams = {
|
|
102
|
+
/**
|
|
103
|
+
* Permissions you want included in the access token received in the result.
|
|
104
|
+
* Not all scopes are guaranteed to be included in the access token returned.
|
|
105
|
+
*/
|
|
106
|
+
scopes: string[];
|
|
107
|
+
/**
|
|
108
|
+
* The authority that MSAL will use to obtain tokens. If not included, authority from
|
|
109
|
+
* MSALConfiguration will be used.
|
|
110
|
+
*/
|
|
111
|
+
authority?: string;
|
|
112
|
+
/**
|
|
113
|
+
* A specific prompt type for the interactive authentication flow.
|
|
114
|
+
*/
|
|
115
|
+
promptType?: MSALPromptType;
|
|
116
|
+
/**
|
|
117
|
+
* A loginHint (usually an email) to pass to the service at the beginning of the
|
|
118
|
+
* interactive authentication flow. The account returned is not guaranteed to match
|
|
119
|
+
* the loginHint.
|
|
120
|
+
*/
|
|
121
|
+
loginHint?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Key-value pairs to pass to the /authorize and /token endpoints.
|
|
124
|
+
*/
|
|
125
|
+
extraQueryParameters?: Record<string, string>;
|
|
126
|
+
/**
|
|
127
|
+
* Permissions you want the account to consent to in the same authentication flow,
|
|
128
|
+
* but won’t be included in the returned access token.
|
|
129
|
+
*/
|
|
130
|
+
extraScopesToConsent?: string[];
|
|
131
|
+
/**
|
|
132
|
+
* User Interface configuration that MSAL uses when getting a token interactively or
|
|
133
|
+
* authorizing an end user.
|
|
134
|
+
*/
|
|
135
|
+
webviewParameters?: MSALWebviewParams;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* OIDC prompt parameter that specifies whether the Authorization Server prompts the
|
|
139
|
+
* End-User for reauthentication and consent.
|
|
140
|
+
*/
|
|
141
|
+
export declare enum MSALPromptType {
|
|
142
|
+
/**
|
|
143
|
+
* If no user is specified the authentication webview will present a list of users
|
|
144
|
+
* currently signed in for the user to select among.
|
|
145
|
+
*/
|
|
146
|
+
SELECT_ACCOUNT = 0,
|
|
147
|
+
/**
|
|
148
|
+
* Require the user to authenticate in the webview.
|
|
149
|
+
*/
|
|
150
|
+
LOGIN = 1,
|
|
151
|
+
/**
|
|
152
|
+
* Require the user to consent to the current set of scopes for the request.
|
|
153
|
+
*/
|
|
154
|
+
CONSENT = 2,
|
|
155
|
+
/**
|
|
156
|
+
* The SSO experience will be determined by the presence of cookies in the webview and
|
|
157
|
+
* account type. User won’t be prompted unless necessary. If multiple users are signed in,
|
|
158
|
+
* select account experience will be presented.
|
|
159
|
+
*/
|
|
160
|
+
WHEN_REQUIRED = 3,
|
|
161
|
+
/**
|
|
162
|
+
* Default is MSALPromptType.WHEN_REQUIRED.
|
|
163
|
+
*/
|
|
164
|
+
DEFAULT = 3
|
|
165
|
+
}
|
|
166
|
+
export type MSALSilentParams = {
|
|
167
|
+
/**
|
|
168
|
+
* Permissions you want included in the access token received in the result.
|
|
169
|
+
* Not all scopes are guaranteed to be included in the access token returned.
|
|
170
|
+
*/
|
|
171
|
+
scopes: string[];
|
|
172
|
+
/**
|
|
173
|
+
* An account object for which tokens should be returned.
|
|
174
|
+
*/
|
|
175
|
+
account: MSALAccount;
|
|
176
|
+
/**
|
|
177
|
+
* The authority that MSAL will use to obtain tokens. If not included, authority from
|
|
178
|
+
* MSALConfiguration will be used.
|
|
179
|
+
*/
|
|
180
|
+
authority?: string;
|
|
181
|
+
/**
|
|
182
|
+
* Ignore any existing access token in the cache and force MSAL to get a new access token
|
|
183
|
+
* from the service.
|
|
184
|
+
*/
|
|
185
|
+
forceRefresh?: boolean;
|
|
186
|
+
};
|
|
187
|
+
export type MSALSignoutParams = {
|
|
188
|
+
/**
|
|
189
|
+
* The account object for which to sign out of.
|
|
190
|
+
*/
|
|
191
|
+
account: MSALAccount;
|
|
192
|
+
/**
|
|
193
|
+
* Specifies whether signout should also open the browser and send a network request to the end_session_endpoint.
|
|
194
|
+
* false by default.
|
|
195
|
+
*/
|
|
196
|
+
signoutFromBrowser?: boolean;
|
|
197
|
+
/**
|
|
198
|
+
* User Interface configuration that MSAL uses when getting a token interactively or
|
|
199
|
+
* authorizing an end user.
|
|
200
|
+
*/
|
|
201
|
+
webviewParameters?: MSALWebviewParams;
|
|
202
|
+
};
|
|
203
|
+
export type MSALResult = {
|
|
204
|
+
/**
|
|
205
|
+
* The Access Token requested, or empty string if no access token is returned in response
|
|
206
|
+
*/
|
|
207
|
+
accessToken: string;
|
|
208
|
+
/**
|
|
209
|
+
* The account object that holds account information.
|
|
210
|
+
*/
|
|
211
|
+
account: MSALAccount;
|
|
212
|
+
/**
|
|
213
|
+
* The time that the access token returned in the accessToken property ceases to be valid.
|
|
214
|
+
* This value is calculated based on current UTC time measured locally and the value expiresIn returned from the service
|
|
215
|
+
*/
|
|
216
|
+
expiresOn: number;
|
|
217
|
+
/**
|
|
218
|
+
* The raw id token if it’s returned by the service or undefined if no id token is returned.
|
|
219
|
+
*/
|
|
220
|
+
idToken?: string;
|
|
221
|
+
/**
|
|
222
|
+
* The scope values returned from the service.
|
|
223
|
+
*/
|
|
224
|
+
scopes: string[];
|
|
225
|
+
/**
|
|
226
|
+
* Identifier for the directory where account is locally represented
|
|
227
|
+
*/
|
|
228
|
+
tenantId?: string;
|
|
229
|
+
};
|
|
230
|
+
export type MSALAccount = {
|
|
231
|
+
/**
|
|
232
|
+
* Unique identifier for the account.
|
|
233
|
+
*/
|
|
234
|
+
identifier: string;
|
|
235
|
+
/**
|
|
236
|
+
* Host part of the authority string used for authentication based on the issuer identifier.
|
|
237
|
+
*/
|
|
238
|
+
environment?: string;
|
|
239
|
+
/**
|
|
240
|
+
* An identifier for the AAD tenant that the account was acquired from.
|
|
241
|
+
*/
|
|
242
|
+
tenantId: string;
|
|
243
|
+
/**
|
|
244
|
+
* Shorthand name by which the End-User wishes to be referred to at the RP, such as janedoe or j.doe.
|
|
245
|
+
*/
|
|
246
|
+
username: string;
|
|
247
|
+
/**
|
|
248
|
+
* ID token claims for the account. Can be used to read additional information about the account, e.g. name.
|
|
249
|
+
*/
|
|
250
|
+
claims?: object;
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* Mostly, if not all, iOS webview parameters
|
|
254
|
+
* See https://azuread.github.io/microsoft-authentication-library-for-objc/Classes/MSALWebviewParameters.html
|
|
255
|
+
*/
|
|
256
|
+
export type MSALWebviewParams = {
|
|
257
|
+
/**
|
|
258
|
+
* A Boolean value that indicates whether the ASWebAuthenticationSession should ask the
|
|
259
|
+
* browser for a private authentication session.
|
|
260
|
+
* For more info see here: https://developer.apple.com/documentation/authenticationservices/aswebauthenticationsession/3237231-prefersephemeralwebbrowsersessio?language=objc
|
|
261
|
+
* @platform iOS 13+
|
|
262
|
+
*/
|
|
263
|
+
ios_prefersEphemeralWebBrowserSession?: boolean;
|
|
264
|
+
/**
|
|
265
|
+
* MSAL requires a web browser for interactive authentication.
|
|
266
|
+
* There are multiple web browsers available to complete authentication.
|
|
267
|
+
* MSAL will default to the web browser that provides best security and user experience for a given platform.
|
|
268
|
+
* Ios_MSALWebviewType allows changing the experience by customizing the configuration to other options for
|
|
269
|
+
* displaying web content
|
|
270
|
+
* @platform iOS
|
|
271
|
+
*/
|
|
272
|
+
ios_webviewType?: Ios_MSALWebviewType;
|
|
273
|
+
/**
|
|
274
|
+
* Note: Has no effect when ios_webviewType === `Ios_MSALWebviewType.DEFAULT` or
|
|
275
|
+
* ios_webviewType === `Ios_MSALWebviewType.AUTHENTICATION_SESSION`
|
|
276
|
+
* @platform iOS
|
|
277
|
+
*/
|
|
278
|
+
ios_presentationStyle?: Ios_ModalPresentationStyle;
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
* See https://developer.apple.com/documentation/uikit/uimodalpresentationstyle
|
|
282
|
+
*/
|
|
283
|
+
export declare enum Ios_ModalPresentationStyle {
|
|
284
|
+
fullScreen = 0,
|
|
285
|
+
pageSheet = 1,
|
|
286
|
+
formSheet = 2,
|
|
287
|
+
currentContext = 3,
|
|
288
|
+
custom = 4,
|
|
289
|
+
overFullScreen = 5,
|
|
290
|
+
overCurrentContext = 6,
|
|
291
|
+
popover = 7,
|
|
292
|
+
blurOverFullScreen = 8,
|
|
293
|
+
none = -1,
|
|
294
|
+
automatic = -2
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* See https://azuread.github.io/microsoft-authentication-library-for-objc/Enums/MSALWebviewType.html
|
|
298
|
+
*/
|
|
299
|
+
export declare enum Ios_MSALWebviewType {
|
|
300
|
+
DEFAULT = 0,
|
|
301
|
+
AUTHENTICATION_SESSION = 1,
|
|
302
|
+
SAFARI_VIEW_CONTROLLER = 2,
|
|
303
|
+
WK_WEB_VIEW = 3
|
|
304
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { LoginButtonProps } from "../../components";
|
|
3
|
+
import "core-js/stable/atob";
|
|
4
|
+
export declare const LoginButton: ({ clientId, redirectUri, onAuthenticationSuccessful, onAuthenticationFailed, enableAutomaticAuthentication, scopes, title, ...rest }: LoginButtonProps) => React.JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LoginButton
|
|
3
|
+
} from "../../chunk-XHVESUQ2.js";
|
|
4
|
+
import "../../chunk-2APLN7PB.js";
|
|
5
|
+
import "../../chunk-FF7UDUOZ.js";
|
|
6
|
+
import "../../chunk-GCVP36UH.js";
|
|
7
|
+
import "../../chunk-6UTWP7VI.js";
|
|
8
|
+
import "../../chunk-WQQ3TZZU.js";
|
|
9
|
+
import "../../chunk-MWXZHQN3.js";
|
|
10
|
+
import "../../chunk-OFQ6U2BU.js";
|
|
11
|
+
import "../../chunk-D7L44FRV.js";
|
|
12
|
+
import "../../chunk-6Q5OCWP7.js";
|
|
13
|
+
import "../../chunk-DXZ4T5LX.js";
|
|
14
|
+
import "../../chunk-5WASXW2G.js";
|
|
15
|
+
import "../../chunk-7SOSXNKP.js";
|
|
16
|
+
import "../../chunk-WEAGW6MQ.js";
|
|
17
|
+
export {
|
|
18
|
+
LoginButton
|
|
19
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useAccount,
|
|
3
|
+
useAccountNative,
|
|
4
|
+
useAccountWeb
|
|
5
|
+
} from "../../chunk-CFM3MLGB.js";
|
|
6
|
+
import "../../chunk-FF7UDUOZ.js";
|
|
7
|
+
import "../../chunk-GCVP36UH.js";
|
|
8
|
+
import "../../chunk-6UTWP7VI.js";
|
|
9
|
+
import "../../chunk-WQQ3TZZU.js";
|
|
10
|
+
import "../../chunk-MWXZHQN3.js";
|
|
11
|
+
import "../../chunk-OFQ6U2BU.js";
|
|
12
|
+
import "../../chunk-D7L44FRV.js";
|
|
13
|
+
import "../../chunk-6Q5OCWP7.js";
|
|
14
|
+
import "../../chunk-DXZ4T5LX.js";
|
|
15
|
+
import "../../chunk-5WASXW2G.js";
|
|
16
|
+
import "../../chunk-7SOSXNKP.js";
|
|
17
|
+
import "../../chunk-WEAGW6MQ.js";
|
|
18
|
+
export {
|
|
19
|
+
useAccount,
|
|
20
|
+
useAccountNative,
|
|
21
|
+
useAccountWeb
|
|
22
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AuthRequestConfig } from "expo-auth-session";
|
|
2
|
+
import { MadAuthenticationResult } from "../../types";
|
|
3
|
+
import { AuthenticationType } from "../../hooks";
|
|
4
|
+
type useExpoAuthenticateProps = {
|
|
5
|
+
config: AuthRequestConfig;
|
|
6
|
+
onAuthenticationSuccessful: (res: MadAuthenticationResult, type: AuthenticationType) => void;
|
|
7
|
+
onAuthenticationFailed: (error: unknown) => void;
|
|
8
|
+
enableAutomaticAuthentication?: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* initialize the authentication client, and authenticate the user
|
|
12
|
+
* @param {UseExpoAuthenticateProps} params params for client initialization and authentication flow
|
|
13
|
+
* @returns authenticate function, and some helper variables
|
|
14
|
+
*/
|
|
15
|
+
export declare const useAuthenticate: ({ config, onAuthenticationSuccessful, onAuthenticationFailed, enableAutomaticAuthentication, }: useExpoAuthenticateProps) => {
|
|
16
|
+
authenticationInProgress: boolean;
|
|
17
|
+
authenticate: () => undefined;
|
|
18
|
+
authenticationClientInitialized: boolean;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useAuthenticate
|
|
3
|
+
} from "../../chunk-2APLN7PB.js";
|
|
4
|
+
import "../../chunk-FF7UDUOZ.js";
|
|
5
|
+
import "../../chunk-GCVP36UH.js";
|
|
6
|
+
import "../../chunk-6UTWP7VI.js";
|
|
7
|
+
import "../../chunk-WQQ3TZZU.js";
|
|
8
|
+
import "../../chunk-MWXZHQN3.js";
|
|
9
|
+
import "../../chunk-OFQ6U2BU.js";
|
|
10
|
+
import "../../chunk-D7L44FRV.js";
|
|
11
|
+
import "../../chunk-6Q5OCWP7.js";
|
|
12
|
+
import "../../chunk-DXZ4T5LX.js";
|
|
13
|
+
import "../../chunk-5WASXW2G.js";
|
|
14
|
+
import "../../chunk-7SOSXNKP.js";
|
|
15
|
+
import "../../chunk-WEAGW6MQ.js";
|
|
16
|
+
export {
|
|
17
|
+
useAuthenticate
|
|
18
|
+
};
|