@azure/msal-react package
Interfacce
| IMsalContext |
Alias tipo
| AccountIdentifiers | |
| AuthenticatedTemplateProps | |
| MsalAuthenticationProps | |
| MsalAuthenticationResult | |
| MsalProviderProps | |
| SetComplement | |
| SetDifference | |
| Subtract | |
| UnauthenticatedTemplateProps | |
| WithMsalProps |
Funzioni
| Authenticated |
Esegue il rendering dei componenti figlio se l'utente è autenticato |
| Msal |
Tenta di autenticare l'utente se non è già stato autenticato, quindi esegue il rendering dei componenti figlio |
| Msal |
Componente del provider di contesto MSAL. Il rendering deve essere eseguito sopra tutti gli altri componenti che usano MSAL. |
| Unauthenticated |
Esegue il rendering dei componenti figlio se l'utente non è autenticato |
| use |
Dato 1 o più accountIdentifiers, restituisce l'oggetto Account se l'utente ha eseguito l'accesso |
| use |
Restituisce un valore che indica se un utente è attualmente connesso. Facoltativamente, fornire 1 o più accountIdentifiers per determinare se un utente specifico è connesso |
| use |
Restituisce valori di contesto Msal |
| use |
Se un utente non ha eseguito l'accesso a questo hook richiama un account di accesso. È possibile ritentare gli account di accesso non riusciti usando il callback di accesso restituito. Se un utente ha eseguito l'accesso a questo hook tenta di acquisire un token. Le richieste di token successive possono usare il callback acquireToken restituito. Specificare facoltativamente un oggetto richiesta da usare nella chiamata login/acquireToken. Specificare facoltativamente un utente specifico che deve essere connesso. |
| with |
Il componente di ordine superiore esegue il wrapping del componente fornito con msal inserendo i valori di contesto msal nelle proprietà del componente |
Variabili
| Msal |
|
| Msal |
|
| version |
Dettagli funzione
AuthenticatedTemplate(PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>>)
Esegue il rendering dei componenti figlio se l'utente è autenticato
function AuthenticatedTemplate(props: PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>>): React.ReactElement | null
Parametri
- props
-
PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>>
Valori restituiti
React.ReactElement | null
MsalAuthenticationTemplate(PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">> & { authenticationRequest?: PopupRequest | RedirectRequest | Partial<Omit<CommonAuthorizationUrlRequest, "responseMode" | "earJwk" | "codeChallenge" | "codeChallengeMethod" | "requestedClaimsHash" | "platformBroker">>, errorComponent?: any, interactionType: InteractionType, loadingComponent?: any }>)
Tenta di autenticare l'utente se non è già stato autenticato, quindi esegue il rendering dei componenti figlio
function MsalAuthenticationTemplate(props: PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">> & { authenticationRequest?: PopupRequest | RedirectRequest | Partial<Omit<CommonAuthorizationUrlRequest, "responseMode" | "earJwk" | "codeChallenge" | "codeChallengeMethod" | "requestedClaimsHash" | "platformBroker">>, errorComponent?: any, interactionType: InteractionType, loadingComponent?: any }>): React.ReactElement | null
Parametri
- props
-
PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">> & { authenticationRequest?: PopupRequest | RedirectRequest | Partial<Omit<CommonAuthorizationUrlRequest, "responseMode" | "earJwk" | "codeChallenge" | "codeChallengeMethod" | "requestedClaimsHash" | "platformBroker">>, errorComponent?: any, interactionType: InteractionType, loadingComponent?: any }>
Valori restituiti
React.ReactElement | null
MsalProvider(PropsWithChildren<{ instance: IPublicClientApplication }>)
Componente del provider di contesto MSAL. Il rendering deve essere eseguito sopra tutti gli altri componenti che usano MSAL.
function MsalProvider(__namedParameters: PropsWithChildren<{ instance: IPublicClientApplication }>): React.ReactElement
Parametri
- __namedParameters
-
PropsWithChildren<{ instance: IPublicClientApplication }>
Valori restituiti
UnauthenticatedTemplate(PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>>)
Esegue il rendering dei componenti figlio se l'utente non è autenticato
function UnauthenticatedTemplate(props: PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>>): React.ReactElement | null
Parametri
- props
-
PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>>
Valori restituiti
React.ReactElement | null
useAccount(Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>)
Dato 1 o più accountIdentifiers, restituisce l'oggetto Account se l'utente ha eseguito l'accesso
function useAccount(accountIdentifiers?: Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>): AccountInfo | null
Parametri
- accountIdentifiers
-
Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>
Valori restituiti
AccountInfo | null
useIsAuthenticated(Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>)
Restituisce un valore che indica se un utente è attualmente connesso. Facoltativamente, fornire 1 o più accountIdentifiers per determinare se un utente specifico è connesso
function useIsAuthenticated(matchAccount?: Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>): boolean
Parametri
- matchAccount
-
Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>
Valori restituiti
boolean
useMsal()
useMsalAuthentication(InteractionType, PopupRequest | RedirectRequest | Partial<Omit<CommonAuthorizationUrlRequest, "responseMode" | "earJwk" | "codeChallenge" | "codeChallengeMethod" | "requestedClaimsHash" | "platformBroker">>, Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>)
Se un utente non ha eseguito l'accesso a questo hook richiama un account di accesso. È possibile ritentare gli account di accesso non riusciti usando il callback di accesso restituito. Se un utente ha eseguito l'accesso a questo hook tenta di acquisire un token. Le richieste di token successive possono usare il callback acquireToken restituito. Specificare facoltativamente un oggetto richiesta da usare nella chiamata login/acquireToken. Specificare facoltativamente un utente specifico che deve essere connesso.
function useMsalAuthentication(interactionType: InteractionType, authenticationRequest?: PopupRequest | RedirectRequest | Partial<Omit<CommonAuthorizationUrlRequest, "responseMode" | "earJwk" | "codeChallenge" | "codeChallengeMethod" | "requestedClaimsHash" | "platformBroker">>, accountIdentifiers?: Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>): MsalAuthenticationResult
Parametri
- interactionType
- InteractionType
- authenticationRequest
-
PopupRequest | RedirectRequest | Partial<Omit<CommonAuthorizationUrlRequest, "responseMode" | "earJwk" | "codeChallenge" | "codeChallengeMethod" | "requestedClaimsHash" | "platformBroker">>
- accountIdentifiers
-
Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>
Valori restituiti
withMsal<P>(ComponentType<P>)
Il componente di ordine superiore esegue il wrapping del componente fornito con msal inserendo i valori di contesto msal nelle proprietà del componente
function withMsal<P>(Component: ComponentType<P>): FunctionComponent<Subtract<P, WithMsalProps>>
Parametri
- Component
-
ComponentType<P>
Valori restituiti
FunctionComponent<Subtract<P, WithMsalProps>>
Dettagli delle variabili
MsalConsumer
MsalContext
version
version: "3.0.29"
Tipo
"3.0.29"