@azure/msal-react 1.5.6 → 2.0.0-alpha.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/LICENSE +21 -21
- package/README.md +144 -144
- package/dist/MsalContext.js +24 -0
- package/dist/MsalContext.js.map +1 -0
- package/dist/MsalProvider.d.ts +2 -2
- package/dist/MsalProvider.js +142 -0
- package/dist/MsalProvider.js.map +1 -0
- package/dist/components/AuthenticatedTemplate.d.ts +2 -2
- package/dist/components/AuthenticatedTemplate.js +34 -0
- package/dist/components/AuthenticatedTemplate.js.map +1 -0
- package/dist/components/MsalAuthenticationTemplate.d.ts +2 -2
- package/dist/components/MsalAuthenticationTemplate.js +45 -0
- package/dist/components/MsalAuthenticationTemplate.js.map +1 -0
- package/dist/components/UnauthenticatedTemplate.d.ts +2 -2
- package/dist/components/UnauthenticatedTemplate.js +36 -0
- package/dist/components/UnauthenticatedTemplate.js.map +1 -0
- package/dist/components/withMsal.d.ts +2 -2
- package/dist/components/withMsal.js +25 -0
- package/dist/components/withMsal.js.map +1 -0
- package/dist/error/ReactAuthError.js +34 -0
- package/dist/error/ReactAuthError.js.map +1 -0
- package/dist/hooks/useAccount.js +43 -0
- package/dist/hooks/useAccount.js.map +1 -0
- package/dist/hooks/useIsAuthenticated.js +40 -0
- package/dist/hooks/useIsAuthenticated.js.map +1 -0
- package/dist/hooks/useMsal.js +16 -0
- package/dist/hooks/useMsal.js.map +1 -0
- package/dist/hooks/useMsalAuthentication.d.ts +1 -1
- package/dist/hooks/useMsalAuthentication.js +196 -0
- package/dist/hooks/useMsalAuthentication.js.map +1 -0
- package/dist/index.js +14 -8
- package/dist/index.js.map +1 -0
- package/dist/msal-react.cjs.development.js +1 -1
- package/dist/msal-react.cjs.development.js.map +1 -1
- package/dist/msal-react.cjs.production.min.js +1 -1
- package/dist/msal-react.cjs.production.min.js.map +1 -1
- package/dist/msal-react.esm.js +1 -1
- package/dist/msal-react.esm.js.map +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.js +8 -0
- package/dist/packageMetadata.js.map +1 -0
- package/dist/types/AccountIdentifiers.d.ts +1 -1
- package/dist/utils/utilities.d.ts +4 -4
- package/dist/utils/utilities.js +65 -0
- package/dist/utils/utilities.js.map +1 -0
- package/package.json +65 -64
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*! @azure/msal-react v2.0.0-alpha.0 2023-05-03 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import React__default, { useMemo } from 'react';
|
|
4
|
+
import { getChildrenOrFunction } from '../utils/utilities.js';
|
|
5
|
+
import { useMsal } from '../hooks/useMsal.js';
|
|
6
|
+
import { useMsalAuthentication } from '../hooks/useMsalAuthentication.js';
|
|
7
|
+
import { useIsAuthenticated } from '../hooks/useIsAuthenticated.js';
|
|
8
|
+
import { InteractionStatus } from '@azure/msal-browser';
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
|
+
* Licensed under the MIT License.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Attempts to authenticate user if not already authenticated, then renders child components
|
|
16
|
+
* @param props
|
|
17
|
+
*/
|
|
18
|
+
function MsalAuthenticationTemplate({ interactionType, username, homeAccountId, localAccountId, authenticationRequest, loadingComponent: LoadingComponent, errorComponent: ErrorComponent, children, }) {
|
|
19
|
+
const accountIdentifier = useMemo(() => {
|
|
20
|
+
return {
|
|
21
|
+
username,
|
|
22
|
+
homeAccountId,
|
|
23
|
+
localAccountId,
|
|
24
|
+
};
|
|
25
|
+
}, [username, homeAccountId, localAccountId]);
|
|
26
|
+
const context = useMsal();
|
|
27
|
+
const msalAuthResult = useMsalAuthentication(interactionType, authenticationRequest, accountIdentifier);
|
|
28
|
+
const isAuthenticated = useIsAuthenticated(accountIdentifier);
|
|
29
|
+
if (msalAuthResult.error && context.inProgress === InteractionStatus.None) {
|
|
30
|
+
if (!!ErrorComponent) {
|
|
31
|
+
return React__default.createElement(ErrorComponent, { ...msalAuthResult });
|
|
32
|
+
}
|
|
33
|
+
throw msalAuthResult.error;
|
|
34
|
+
}
|
|
35
|
+
if (isAuthenticated) {
|
|
36
|
+
return (React__default.createElement(React__default.Fragment, null, getChildrenOrFunction(children, msalAuthResult)));
|
|
37
|
+
}
|
|
38
|
+
if (!!LoadingComponent && context.inProgress !== InteractionStatus.None) {
|
|
39
|
+
return React__default.createElement(LoadingComponent, { ...context });
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { MsalAuthenticationTemplate };
|
|
45
|
+
//# sourceMappingURL=MsalAuthenticationTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MsalAuthenticationTemplate.js","sources":["../../src/components/MsalAuthenticationTemplate.tsx"],"sourcesContent":[null],"names":["React"],"mappings":";;;;;;;;;AAAA;;;AAGG;AAgCH;;;AAGG;AACG,SAAU,0BAA0B,CAAC,EACvC,eAAe,EACf,QAAQ,EACR,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,cAAc,EAC9B,QAAQ,GACc,EAAA;AACtB,IAAA,MAAM,iBAAiB,GAAuB,OAAO,CAAC,MAAK;QACvD,OAAO;YACH,QAAQ;YACR,aAAa;YACb,cAAc;SACjB,CAAC;KACL,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC;AAC9C,IAAA,MAAM,OAAO,GAAG,OAAO,EAAE,CAAC;IAC1B,MAAM,cAAc,GAAG,qBAAqB,CACxC,eAAe,EACf,qBAAqB,EACrB,iBAAiB,CACpB,CAAC;AACF,IAAA,MAAM,eAAe,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;IAE9D,IAAI,cAAc,CAAC,KAAK,IAAI,OAAO,CAAC,UAAU,KAAK,iBAAiB,CAAC,IAAI,EAAE;QACvE,IAAI,CAAC,CAAC,cAAc,EAAE;AAClB,YAAA,OAAOA,cAAC,CAAA,aAAA,CAAA,cAAc,EAAK,EAAA,GAAA,cAAc,GAAI,CAAC;AACjD,SAAA;QAED,MAAM,cAAc,CAAC,KAAK,CAAC;AAC9B,KAAA;AAED,IAAA,IAAI,eAAe,EAAE;AACjB,QAAA,QACIA,cAAA,CAAA,aAAA,CAACA,cAAK,CAAC,QAAQ,EACV,IAAA,EAAA,qBAAqB,CAAC,QAAQ,EAAE,cAAc,CAAC,CACnC,EACnB;AACL,KAAA;IAED,IAAI,CAAC,CAAC,gBAAgB,IAAI,OAAO,CAAC,UAAU,KAAK,iBAAiB,CAAC,IAAI,EAAE;AACrE,QAAA,OAAOA,cAAC,CAAA,aAAA,CAAA,gBAAgB,EAAK,EAAA,GAAA,OAAO,GAAI,CAAC;AAC5C,KAAA;AAED,IAAA,OAAO,IAAI,CAAC;AAChB;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from "react";
|
|
2
2
|
import { AccountIdentifiers } from "../types/AccountIdentifiers";
|
|
3
|
-
export
|
|
3
|
+
export type UnauthenticatedTemplateProps = PropsWithChildren<AccountIdentifiers>;
|
|
4
4
|
/**
|
|
5
5
|
* Renders child components if user is unauthenticated
|
|
6
6
|
* @param props
|
|
7
7
|
*/
|
|
8
|
-
export declare function UnauthenticatedTemplate({ username, homeAccountId, localAccountId, children }: UnauthenticatedTemplateProps): React.ReactElement | null;
|
|
8
|
+
export declare function UnauthenticatedTemplate({ username, homeAccountId, localAccountId, children, }: UnauthenticatedTemplateProps): React.ReactElement | null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*! @azure/msal-react v2.0.0-alpha.0 2023-05-03 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import React__default, { useMemo } from 'react';
|
|
4
|
+
import { useMsal } from '../hooks/useMsal.js';
|
|
5
|
+
import { useIsAuthenticated } from '../hooks/useIsAuthenticated.js';
|
|
6
|
+
import { getChildrenOrFunction } from '../utils/utilities.js';
|
|
7
|
+
import { InteractionStatus } from '@azure/msal-browser';
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
11
|
+
* Licensed under the MIT License.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Renders child components if user is unauthenticated
|
|
15
|
+
* @param props
|
|
16
|
+
*/
|
|
17
|
+
function UnauthenticatedTemplate({ username, homeAccountId, localAccountId, children, }) {
|
|
18
|
+
const context = useMsal();
|
|
19
|
+
const accountIdentifier = useMemo(() => {
|
|
20
|
+
return {
|
|
21
|
+
username,
|
|
22
|
+
homeAccountId,
|
|
23
|
+
localAccountId,
|
|
24
|
+
};
|
|
25
|
+
}, [username, homeAccountId, localAccountId]);
|
|
26
|
+
const isAuthenticated = useIsAuthenticated(accountIdentifier);
|
|
27
|
+
if (!isAuthenticated &&
|
|
28
|
+
context.inProgress !== InteractionStatus.Startup &&
|
|
29
|
+
context.inProgress !== InteractionStatus.HandleRedirect) {
|
|
30
|
+
return (React__default.createElement(React__default.Fragment, null, getChildrenOrFunction(children, context)));
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { UnauthenticatedTemplate };
|
|
36
|
+
//# sourceMappingURL=UnauthenticatedTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnauthenticatedTemplate.js","sources":["../../src/components/UnauthenticatedTemplate.tsx"],"sourcesContent":[null],"names":["React"],"mappings":";;;;;;;;AAAA;;;AAGG;AAYH;;;AAGG;AACG,SAAU,uBAAuB,CAAC,EACpC,QAAQ,EACR,aAAa,EACb,cAAc,EACd,QAAQ,GACmB,EAAA;AAC3B,IAAA,MAAM,OAAO,GAAG,OAAO,EAAE,CAAC;AAC1B,IAAA,MAAM,iBAAiB,GAAuB,OAAO,CAAC,MAAK;QACvD,OAAO;YACH,QAAQ;YACR,aAAa;YACb,cAAc;SACjB,CAAC;KACL,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC;AAC9C,IAAA,MAAM,eAAe,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;AAE9D,IAAA,IACI,CAAC,eAAe;AAChB,QAAA,OAAO,CAAC,UAAU,KAAK,iBAAiB,CAAC,OAAO;AAChD,QAAA,OAAO,CAAC,UAAU,KAAK,iBAAiB,CAAC,cAAc,EACzD;AACE,QAAA,QACIA,cAAA,CAAA,aAAA,CAACA,cAAK,CAAC,QAAQ,EACV,IAAA,EAAA,qBAAqB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAC5B,EACnB;AACL,KAAA;AACD,IAAA,OAAO,IAAI,CAAC;AAChB;;;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { IMsalContext } from "../MsalContext";
|
|
3
3
|
import { Subtract } from "../utils/utilities";
|
|
4
|
-
export
|
|
4
|
+
export type WithMsalProps = {
|
|
5
5
|
msalContext: IMsalContext;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
8
|
* Higher order component wraps provided component with msal by injecting msal context values into the component's props
|
|
9
9
|
* @param Component
|
|
10
10
|
*/
|
|
11
|
-
export declare const withMsal: <P extends WithMsalProps>(Component: React.ComponentType<P>) => React.FunctionComponent<
|
|
11
|
+
export declare const withMsal: <P extends WithMsalProps>(Component: React.ComponentType<P>) => React.FunctionComponent<Subtract<P, WithMsalProps>>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*! @azure/msal-react v2.0.0-alpha.0 2023-05-03 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import { useMsal } from '../hooks/useMsal.js';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
|
+
* Licensed under the MIT License.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Higher order component wraps provided component with msal by injecting msal context values into the component's props
|
|
12
|
+
* @param Component
|
|
13
|
+
*/
|
|
14
|
+
const withMsal = (Component) => {
|
|
15
|
+
const ComponentWithMsal = (props) => {
|
|
16
|
+
const msal = useMsal();
|
|
17
|
+
return React__default.createElement(Component, { ...props, msalContext: msal });
|
|
18
|
+
};
|
|
19
|
+
const componentName = Component.displayName || Component.name || "Component";
|
|
20
|
+
ComponentWithMsal.displayName = `withMsal(${componentName})`;
|
|
21
|
+
return ComponentWithMsal;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { withMsal };
|
|
25
|
+
//# sourceMappingURL=withMsal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withMsal.js","sources":["../../src/components/withMsal.tsx"],"sourcesContent":[null],"names":["React"],"mappings":";;;;;AAAA;;;AAGG;AAWH;;;AAGG;AACU,MAAA,QAAQ,GAAG,CACpB,SAAiC,KACoB;AACrD,IAAA,MAAM,iBAAiB,GAEnB,CAAC,KAAK,KAAI;AACV,QAAA,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;QACvB,OAAOA,cAAA,CAAA,aAAA,CAAC,SAAS,EAAM,EAAA,GAAA,KAAW,EAAE,WAAW,EAAE,IAAI,EAAA,CAAI,CAAC;AAC9D,KAAC,CAAC;IAEF,MAAM,aAAa,GACf,SAAS,CAAC,WAAW,IAAI,SAAS,CAAC,IAAI,IAAI,WAAW,CAAC;AAC3D,IAAA,iBAAiB,CAAC,WAAW,GAAG,CAAY,SAAA,EAAA,aAAa,GAAG,CAAC;AAE7D,IAAA,OAAO,iBAAiB,CAAC;AAC7B;;;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*! @azure/msal-react v2.0.0-alpha.0 2023-05-03 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import { AuthError } from '@azure/msal-browser';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
+
* Licensed under the MIT License.
|
|
8
|
+
*/
|
|
9
|
+
const ReactAuthErrorMessage = {
|
|
10
|
+
invalidInteractionType: {
|
|
11
|
+
code: "invalid_interaction_type",
|
|
12
|
+
desc: "The provided interaction type is invalid.",
|
|
13
|
+
},
|
|
14
|
+
unableToFallbackToInteraction: {
|
|
15
|
+
code: "unable_to_fallback_to_interaction",
|
|
16
|
+
desc: "Interaction is required but another interaction is already in progress. Please try again when the current interaction is complete.",
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
class ReactAuthError extends AuthError {
|
|
20
|
+
constructor(errorCode, errorMessage) {
|
|
21
|
+
super(errorCode, errorMessage);
|
|
22
|
+
Object.setPrototypeOf(this, ReactAuthError.prototype);
|
|
23
|
+
this.name = "ReactAuthError";
|
|
24
|
+
}
|
|
25
|
+
static createInvalidInteractionTypeError() {
|
|
26
|
+
return new ReactAuthError(ReactAuthErrorMessage.invalidInteractionType.code, ReactAuthErrorMessage.invalidInteractionType.desc);
|
|
27
|
+
}
|
|
28
|
+
static createUnableToFallbackToInteractionError() {
|
|
29
|
+
return new ReactAuthError(ReactAuthErrorMessage.unableToFallbackToInteraction.code, ReactAuthErrorMessage.unableToFallbackToInteraction.desc);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { ReactAuthError, ReactAuthErrorMessage };
|
|
34
|
+
//# sourceMappingURL=ReactAuthError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReactAuthError.js","sources":["../../src/error/ReactAuthError.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAA;;;AAGG;AAIU,MAAA,qBAAqB,GAAG;AACjC,IAAA,sBAAsB,EAAE;AACpB,QAAA,IAAI,EAAE,0BAA0B;AAChC,QAAA,IAAI,EAAE,2CAA2C;AACpD,KAAA;AACD,IAAA,6BAA6B,EAAE;AAC3B,QAAA,IAAI,EAAE,mCAAmC;AACzC,QAAA,IAAI,EAAE,oIAAoI;AAC7I,KAAA;EACH;AAEI,MAAO,cAAe,SAAQ,SAAS,CAAA;IACzC,WAAY,CAAA,SAAiB,EAAE,YAAqB,EAAA;AAChD,QAAA,KAAK,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;QAE/B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;AACtD,QAAA,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;KAChC;AAED,IAAA,OAAO,iCAAiC,GAAA;AACpC,QAAA,OAAO,IAAI,cAAc,CACrB,qBAAqB,CAAC,sBAAsB,CAAC,IAAI,EACjD,qBAAqB,CAAC,sBAAsB,CAAC,IAAI,CACpD,CAAC;KACL;AAED,IAAA,OAAO,wCAAwC,GAAA;AAC3C,QAAA,OAAO,IAAI,cAAc,CACrB,qBAAqB,CAAC,6BAA6B,CAAC,IAAI,EACxD,qBAAqB,CAAC,6BAA6B,CAAC,IAAI,CAC3D,CAAC;KACL;AACJ;;;;"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*! @azure/msal-react v2.0.0-alpha.0 2023-05-03 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
4
|
+
import { AccountEntity } from '@azure/msal-browser';
|
|
5
|
+
import { useMsal } from './useMsal.js';
|
|
6
|
+
import { getAccountByIdentifiers } from '../utils/utilities.js';
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10
|
+
* Licensed under the MIT License.
|
|
11
|
+
*/
|
|
12
|
+
function getAccount(instance, accountIdentifiers) {
|
|
13
|
+
if (!accountIdentifiers ||
|
|
14
|
+
(!accountIdentifiers.homeAccountId &&
|
|
15
|
+
!accountIdentifiers.localAccountId &&
|
|
16
|
+
!accountIdentifiers.username)) {
|
|
17
|
+
// If no account identifiers are provided, return active account
|
|
18
|
+
return instance.getActiveAccount();
|
|
19
|
+
}
|
|
20
|
+
return getAccountByIdentifiers(instance.getAllAccounts(), accountIdentifiers);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Given 1 or more accountIdentifiers, returns the Account object if the user is signed-in
|
|
24
|
+
* @param accountIdentifiers
|
|
25
|
+
*/
|
|
26
|
+
function useAccount(accountIdentifiers) {
|
|
27
|
+
const { instance, inProgress, logger } = useMsal();
|
|
28
|
+
const [account, setAccount] = useState(() => getAccount(instance, accountIdentifiers));
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
setAccount((currentAccount) => {
|
|
31
|
+
const nextAccount = getAccount(instance, accountIdentifiers);
|
|
32
|
+
if (!AccountEntity.accountInfoIsEqual(currentAccount, nextAccount, true)) {
|
|
33
|
+
logger.info("useAccount - Updating account");
|
|
34
|
+
return nextAccount;
|
|
35
|
+
}
|
|
36
|
+
return currentAccount;
|
|
37
|
+
});
|
|
38
|
+
}, [inProgress, accountIdentifiers, instance, logger]);
|
|
39
|
+
return account;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { useAccount };
|
|
43
|
+
//# sourceMappingURL=useAccount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAccount.js","sources":["../../src/hooks/useAccount.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAAA;;;AAGG;AAYH,SAAS,UAAU,CACf,QAAkC,EAClC,kBAAuC,EAAA;AAEvC,IAAA,IACI,CAAC,kBAAkB;SAClB,CAAC,kBAAkB,CAAC,aAAa;YAC9B,CAAC,kBAAkB,CAAC,cAAc;AAClC,YAAA,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EACnC;;AAEE,QAAA,OAAO,QAAQ,CAAC,gBAAgB,EAAE,CAAC;AACtC,KAAA;IAED,OAAO,uBAAuB,CAC1B,QAAQ,CAAC,cAAc,EAAE,EACzB,kBAAkB,CACrB,CAAC;AACN,CAAC;AAED;;;AAGG;AACG,SAAU,UAAU,CACtB,kBAAuC,EAAA;IAEvC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CAAC;AAEnD,IAAA,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAqB,MACvD,UAAU,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAC3C,CAAC;IAEF,SAAS,CAAC,MAAK;AACX,QAAA,UAAU,CAAC,CAAC,cAAkC,KAAI;YAC9C,MAAM,WAAW,GAAG,UAAU,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;YAC7D,IACI,CAAC,aAAa,CAAC,kBAAkB,CAC7B,cAAc,EACd,WAAW,EACX,IAAI,CACP,EACH;AACE,gBAAA,MAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;AAC7C,gBAAA,OAAO,WAAW,CAAC;AACtB,aAAA;AAED,YAAA,OAAO,cAAc,CAAC;AAC1B,SAAC,CAAC,CAAC;KACN,EAAE,CAAC,UAAU,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AAEvD,IAAA,OAAO,OAAO,CAAC;AACnB;;;;"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*! @azure/msal-react v2.0.0-alpha.0 2023-05-03 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
4
|
+
import { useMsal } from './useMsal.js';
|
|
5
|
+
import { InteractionStatus } from '@azure/msal-browser';
|
|
6
|
+
import { getAccountByIdentifiers } from '../utils/utilities.js';
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10
|
+
* Licensed under the MIT License.
|
|
11
|
+
*/
|
|
12
|
+
function isAuthenticated(allAccounts, matchAccount) {
|
|
13
|
+
if (matchAccount &&
|
|
14
|
+
(matchAccount.username ||
|
|
15
|
+
matchAccount.homeAccountId ||
|
|
16
|
+
matchAccount.localAccountId)) {
|
|
17
|
+
return !!getAccountByIdentifiers(allAccounts, matchAccount);
|
|
18
|
+
}
|
|
19
|
+
return allAccounts.length > 0;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Returns whether or not a user is currently signed-in. Optionally provide 1 or more accountIdentifiers to determine if a specific user is signed-in
|
|
23
|
+
* @param matchAccount
|
|
24
|
+
*/
|
|
25
|
+
function useIsAuthenticated(matchAccount) {
|
|
26
|
+
const { accounts: allAccounts, inProgress } = useMsal();
|
|
27
|
+
const [hasAuthenticated, setHasAuthenticated] = useState(() => {
|
|
28
|
+
if (inProgress === InteractionStatus.Startup) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
return isAuthenticated(allAccounts, matchAccount);
|
|
32
|
+
});
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
setHasAuthenticated(isAuthenticated(allAccounts, matchAccount));
|
|
35
|
+
}, [allAccounts, matchAccount]);
|
|
36
|
+
return hasAuthenticated;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { useIsAuthenticated };
|
|
40
|
+
//# sourceMappingURL=useIsAuthenticated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIsAuthenticated.js","sources":["../../src/hooks/useIsAuthenticated.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAAA;;;AAGG;AAQH,SAAS,eAAe,CACpB,WAA0B,EAC1B,YAAiC,EAAA;AAEjC,IAAA,IACI,YAAY;SACX,YAAY,CAAC,QAAQ;AAClB,YAAA,YAAY,CAAC,aAAa;YAC1B,YAAY,CAAC,cAAc,CAAC,EAClC;QACE,OAAO,CAAC,CAAC,uBAAuB,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;AAC/D,KAAA;AAED,IAAA,OAAO,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC;AAClC,CAAC;AAED;;;AAGG;AACG,SAAU,kBAAkB,CAAC,YAAiC,EAAA;IAChE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,OAAO,EAAE,CAAC;IAExD,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAU,MAAK;AACnE,QAAA,IAAI,UAAU,KAAK,iBAAiB,CAAC,OAAO,EAAE;AAC1C,YAAA,OAAO,KAAK,CAAC;AAChB,SAAA;AACD,QAAA,OAAO,eAAe,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;AACtD,KAAC,CAAC,CAAC;IAEH,SAAS,CAAC,MAAK;QACX,mBAAmB,CAAC,eAAe,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;AACpE,KAAC,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;AAEhC,IAAA,OAAO,gBAAgB,CAAC;AAC5B;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*! @azure/msal-react v2.0.0-alpha.0 2023-05-03 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import { useContext } from 'react';
|
|
4
|
+
import { MsalContext } from '../MsalContext.js';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
|
+
* Licensed under the MIT License.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Returns Msal Context values
|
|
12
|
+
*/
|
|
13
|
+
const useMsal = () => useContext(MsalContext);
|
|
14
|
+
|
|
15
|
+
export { useMsal };
|
|
16
|
+
//# sourceMappingURL=useMsal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMsal.js","sources":["../../src/hooks/useMsal.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAAA;;;AAGG;AAKH;;AAEG;AACU,MAAA,OAAO,GAAG,MAAoB,UAAU,CAAC,WAAW;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PopupRequest, RedirectRequest, SsoSilentRequest, InteractionType, AuthenticationResult, AuthError, SilentRequest } from "@azure/msal-browser";
|
|
2
2
|
import { AccountIdentifiers } from "../types/AccountIdentifiers";
|
|
3
|
-
export
|
|
3
|
+
export type MsalAuthenticationResult = {
|
|
4
4
|
login: (callbackInteractionType?: InteractionType | undefined, callbackRequest?: PopupRequest | RedirectRequest | SilentRequest) => Promise<AuthenticationResult | null>;
|
|
5
5
|
acquireToken: (callbackInteractionType?: InteractionType | undefined, callbackRequest?: SilentRequest | undefined) => Promise<AuthenticationResult | null>;
|
|
6
6
|
result: AuthenticationResult | null;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/*! @azure/msal-react v2.0.0-alpha.0 2023-05-03 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import { useState, useRef, useEffect, useCallback } from 'react';
|
|
4
|
+
import { InteractionStatus, InteractionType, EventType, OIDC_DEFAULT_SCOPES, InteractionRequiredAuthError } from '@azure/msal-browser';
|
|
5
|
+
import { useIsAuthenticated } from './useIsAuthenticated.js';
|
|
6
|
+
import { useMsal } from './useMsal.js';
|
|
7
|
+
import { useAccount } from './useAccount.js';
|
|
8
|
+
import { ReactAuthError } from '../error/ReactAuthError.js';
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
|
+
* Licensed under the MIT License.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* If a user is not currently signed in this hook invokes a login. Failed logins can be retried using the login callback returned.
|
|
16
|
+
* If a user is currently signed in this hook attempts to acquire a token. Subsequent token requests can use the acquireToken callback returned.
|
|
17
|
+
* Optionally provide a request object to be used in the login/acquireToken call.
|
|
18
|
+
* Optionally provide a specific user that should be logged in.
|
|
19
|
+
* @param interactionType
|
|
20
|
+
* @param authenticationRequest
|
|
21
|
+
* @param accountIdentifiers
|
|
22
|
+
*/
|
|
23
|
+
function useMsalAuthentication(interactionType, authenticationRequest, accountIdentifiers) {
|
|
24
|
+
const { instance, inProgress, logger } = useMsal();
|
|
25
|
+
const isAuthenticated = useIsAuthenticated(accountIdentifiers);
|
|
26
|
+
const account = useAccount(accountIdentifiers);
|
|
27
|
+
const [[result, error], setResponse] = useState([null, null]);
|
|
28
|
+
// Used to prevent state updates after unmount
|
|
29
|
+
const mounted = useRef(true);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
return () => {
|
|
32
|
+
mounted.current = false;
|
|
33
|
+
};
|
|
34
|
+
}, []);
|
|
35
|
+
// Boolean used to check if interaction is in progress in acquireTokenSilent fallback. Use Ref instead of state to prevent acquireToken function from being regenerated on each change to interactionInProgress value
|
|
36
|
+
const interactionInProgress = useRef(inProgress !== InteractionStatus.None);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
interactionInProgress.current = inProgress !== InteractionStatus.None;
|
|
39
|
+
}, [inProgress]);
|
|
40
|
+
// Flag used to control when the hook calls login/acquireToken
|
|
41
|
+
const shouldAcquireToken = useRef(true);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (!!error) {
|
|
44
|
+
// Errors should be handled by consuming component
|
|
45
|
+
shouldAcquireToken.current = false;
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (!!result) {
|
|
49
|
+
// Token has already been acquired, consuming component/application is responsible for renewing
|
|
50
|
+
shouldAcquireToken.current = false;
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
}, [error, result]);
|
|
54
|
+
const login = useCallback(async (callbackInteractionType, callbackRequest) => {
|
|
55
|
+
const loginType = callbackInteractionType || interactionType;
|
|
56
|
+
const loginRequest = callbackRequest || authenticationRequest;
|
|
57
|
+
switch (loginType) {
|
|
58
|
+
case InteractionType.Popup:
|
|
59
|
+
logger.verbose("useMsalAuthentication - Calling loginPopup");
|
|
60
|
+
return instance.loginPopup(loginRequest);
|
|
61
|
+
case InteractionType.Redirect:
|
|
62
|
+
// This promise is not expected to resolve due to full frame redirect
|
|
63
|
+
logger.verbose("useMsalAuthentication - Calling loginRedirect");
|
|
64
|
+
return instance
|
|
65
|
+
.loginRedirect(loginRequest)
|
|
66
|
+
.then(null);
|
|
67
|
+
case InteractionType.Silent:
|
|
68
|
+
logger.verbose("useMsalAuthentication - Calling ssoSilent");
|
|
69
|
+
return instance.ssoSilent(loginRequest);
|
|
70
|
+
default:
|
|
71
|
+
throw ReactAuthError.createInvalidInteractionTypeError();
|
|
72
|
+
}
|
|
73
|
+
}, [instance, interactionType, authenticationRequest, logger]);
|
|
74
|
+
const acquireToken = useCallback(async (callbackInteractionType, callbackRequest) => {
|
|
75
|
+
const fallbackInteractionType = callbackInteractionType || interactionType;
|
|
76
|
+
let tokenRequest;
|
|
77
|
+
if (callbackRequest) {
|
|
78
|
+
logger.trace("useMsalAuthentication - acquireToken - Using request provided in the callback");
|
|
79
|
+
tokenRequest = {
|
|
80
|
+
...callbackRequest,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
else if (authenticationRequest) {
|
|
84
|
+
logger.trace("useMsalAuthentication - acquireToken - Using request provided in the hook");
|
|
85
|
+
tokenRequest = {
|
|
86
|
+
...authenticationRequest,
|
|
87
|
+
scopes: authenticationRequest.scopes || OIDC_DEFAULT_SCOPES,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
logger.trace("useMsalAuthentication - acquireToken - No request object provided, using default request.");
|
|
92
|
+
tokenRequest = {
|
|
93
|
+
scopes: OIDC_DEFAULT_SCOPES,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
if (!tokenRequest.account && account) {
|
|
97
|
+
logger.trace("useMsalAuthentication - acquireToken - Attaching account to request");
|
|
98
|
+
tokenRequest.account = account;
|
|
99
|
+
}
|
|
100
|
+
const getToken = async () => {
|
|
101
|
+
logger.verbose("useMsalAuthentication - Calling acquireTokenSilent");
|
|
102
|
+
return instance
|
|
103
|
+
.acquireTokenSilent(tokenRequest)
|
|
104
|
+
.catch(async (e) => {
|
|
105
|
+
if (e instanceof InteractionRequiredAuthError) {
|
|
106
|
+
if (!interactionInProgress.current) {
|
|
107
|
+
logger.error("useMsalAuthentication - Interaction required, falling back to interaction");
|
|
108
|
+
return login(fallbackInteractionType, tokenRequest);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
logger.error("useMsalAuthentication - Interaction required but is already in progress. Please try again, if needed, after interaction completes.");
|
|
112
|
+
throw ReactAuthError.createUnableToFallbackToInteractionError();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
throw e;
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
return getToken()
|
|
119
|
+
.then((response) => {
|
|
120
|
+
if (mounted.current) {
|
|
121
|
+
setResponse([response, null]);
|
|
122
|
+
}
|
|
123
|
+
return response;
|
|
124
|
+
})
|
|
125
|
+
.catch((e) => {
|
|
126
|
+
if (mounted.current) {
|
|
127
|
+
setResponse([null, e]);
|
|
128
|
+
}
|
|
129
|
+
throw e;
|
|
130
|
+
});
|
|
131
|
+
}, [
|
|
132
|
+
instance,
|
|
133
|
+
interactionType,
|
|
134
|
+
authenticationRequest,
|
|
135
|
+
logger,
|
|
136
|
+
account,
|
|
137
|
+
login,
|
|
138
|
+
]);
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
const callbackId = instance.addEventCallback((message) => {
|
|
141
|
+
switch (message.eventType) {
|
|
142
|
+
case EventType.LOGIN_SUCCESS:
|
|
143
|
+
case EventType.SSO_SILENT_SUCCESS:
|
|
144
|
+
if (message.payload) {
|
|
145
|
+
setResponse([
|
|
146
|
+
message.payload,
|
|
147
|
+
null,
|
|
148
|
+
]);
|
|
149
|
+
}
|
|
150
|
+
break;
|
|
151
|
+
case EventType.LOGIN_FAILURE:
|
|
152
|
+
case EventType.SSO_SILENT_FAILURE:
|
|
153
|
+
if (message.error) {
|
|
154
|
+
setResponse([null, message.error]);
|
|
155
|
+
}
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
logger.verbose(`useMsalAuthentication - Registered event callback with id: ${callbackId}`);
|
|
160
|
+
return () => {
|
|
161
|
+
if (callbackId) {
|
|
162
|
+
logger.verbose(`useMsalAuthentication - Removing event callback ${callbackId}`);
|
|
163
|
+
instance.removeEventCallback(callbackId);
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
}, [instance, logger]);
|
|
167
|
+
useEffect(() => {
|
|
168
|
+
if (shouldAcquireToken.current &&
|
|
169
|
+
inProgress === InteractionStatus.None) {
|
|
170
|
+
shouldAcquireToken.current = false;
|
|
171
|
+
if (!isAuthenticated) {
|
|
172
|
+
logger.info("useMsalAuthentication - No user is authenticated, attempting to login");
|
|
173
|
+
login().catch(() => {
|
|
174
|
+
// Errors are saved in state above
|
|
175
|
+
return;
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
else if (account) {
|
|
179
|
+
logger.info("useMsalAuthentication - User is authenticated, attempting to acquire token");
|
|
180
|
+
acquireToken().catch(() => {
|
|
181
|
+
// Errors are saved in state above
|
|
182
|
+
return;
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}, [isAuthenticated, account, inProgress, login, acquireToken, logger]);
|
|
187
|
+
return {
|
|
188
|
+
login,
|
|
189
|
+
acquireToken,
|
|
190
|
+
result,
|
|
191
|
+
error,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export { useMsalAuthentication };
|
|
196
|
+
//# sourceMappingURL=useMsalAuthentication.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMsalAuthentication.js","sources":["../../src/hooks/useMsalAuthentication.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;AAAA;;;AAGG;AAoCH;;;;;;;;AAQG;SACa,qBAAqB,CACjC,eAAgC,EAChC,qBAAyE,EACzE,kBAAuC,EAAA;IAEvC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CAAC;AACnD,IAAA,MAAM,eAAe,GAA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BAAkB,CAAC,OAAO;AAC1B,YAAA,UAAU,KAAK,iBAAiB,CAAC,IAAI,EACvC;AACE,YAAA,kBAAkB,CAAC,OAAO,GAAG,KAAK,CAAC;YACnC,IAAI,CAAC,eAAe,EAAE;AAClB,gBAAA,MAAM,CAAC,IAAI,CACP,uEAAuE,CAC1E,CAAC;AACF,gBAAA,KAAK,EAAE,CAAC,KAAK,CAAC,MAAK;;oBAEf,OAAO;AACX,iBAAC,CAAC,CAAC;AACN,aAAA;AAAM,iBAAA,IAAI,OAAO,EAAE;AAChB,gBAAA,MAAM,CAAC,IAAI,CACP,4EAA4E,CAC/E,CAAC;AACF,gBAAA,YAAY,EAAE,CAAC,KAAK,CAAC,MAAK;;oBAEtB,OAAO;AACX,iBAAC,CAAC,CAAC;AACN,aAAA;AACJ,SAAA;AACL,KAAC,EAAE,CAAC,eAAe,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;IAExE,OAAO;QACH,KAAK;QACL,YAAY;QACZ,MAAM;QACN,KAAK;KACR,CAAC;AACN;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
'use strict'
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
}
|
|
1
|
+
/*! @azure/msal-react v2.0.0-alpha.0 2023-05-03 */
|
|
2
|
+
'use strict';
|
|
3
|
+
export { MsalConsumer, MsalContext } from './MsalContext.js';
|
|
4
|
+
export { MsalProvider } from './MsalProvider.js';
|
|
5
|
+
export { AuthenticatedTemplate } from './components/AuthenticatedTemplate.js';
|
|
6
|
+
export { UnauthenticatedTemplate } from './components/UnauthenticatedTemplate.js';
|
|
7
|
+
export { MsalAuthenticationTemplate } from './components/MsalAuthenticationTemplate.js';
|
|
8
|
+
export { withMsal } from './components/withMsal.js';
|
|
9
|
+
export { useMsal } from './hooks/useMsal.js';
|
|
10
|
+
export { useAccount } from './hooks/useAccount.js';
|
|
11
|
+
export { useIsAuthenticated } from './hooks/useIsAuthenticated.js';
|
|
12
|
+
export { useMsalAuthentication } from './hooks/useMsalAuthentication.js';
|
|
13
|
+
export { version } from './packageMetadata.js';
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -85,7 +85,7 @@ function getAccountByIdentifiers(allAccounts, accountIdentifiers) {
|
|
|
85
85
|
|
|
86
86
|
/* eslint-disable header/header */
|
|
87
87
|
const name = "@azure/msal-react";
|
|
88
|
-
const version = "1.5.
|
|
88
|
+
const version = "1.5.7";
|
|
89
89
|
|
|
90
90
|
/*
|
|
91
91
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|