@azure/msal-react package

Interfacce

IMsalContext

Funzioni

AuthenticatedTemplate(PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>>)

Esegue il rendering dei componenti figlio se l'utente è autenticato

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

MsalProvider(PropsWithChildren<{ instance: IPublicClientApplication }>)

Componente del provider di contesto MSAL. Il rendering deve essere eseguito sopra tutti gli altri componenti che usano MSAL.

UnauthenticatedTemplate(PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>>)

Esegue il rendering dei componenti figlio se l'utente non è autenticato

useAccount(Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>)

Dato 1 o più accountIdentifiers, restituisce l'oggetto Account se l'utente ha eseguito l'accesso

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

useMsal()

Restituisce valori di contesto Msal

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.

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

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

React.ReactElement

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()

Restituisce valori di contesto Msal

function useMsal(): IMsalContext

Valori restituiti

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

MsalConsumer: React.Consumer<IMsalContext>

Tipo

React.Consumer<IMsalContext>

MsalContext

MsalContext: React.Context<IMsalContext>

Tipo

React.Context<IMsalContext>

version

version: "3.0.29"

Tipo

"3.0.29"