@azure/msal-react package

Interfejsy

IMsalContext

Funkcje

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

Renderuje składniki podrzędne, jeśli użytkownik jest uwierzytelniony

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

Próbuje uwierzytelnić użytkownika, jeśli nie został jeszcze uwierzytelniony, renderuje składniki podrzędne

MsalProvider(PropsWithChildren<{ instance: IPublicClientApplication }>)

Składnik dostawcy kontekstu BIBLIOTEKI MSAL. Należy to renderować powyżej innych składników korzystających z biblioteki MSAL.

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

Renderuje składniki podrzędne, jeśli użytkownik jest nieuwierzytelniony

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

Biorąc pod uwagę co najmniej 1 element accountIdentifiers, zwraca obiekt Account, jeśli użytkownik jest zalogowany

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

Zwraca, czy użytkownik jest obecnie zalogowany. Opcjonalnie podaj co najmniej 1 element accountIdentifiers, aby określić, czy określony użytkownik jest zalogowany

useMsal()

Zwraca wartości kontekstu msal

useMsalAuthentication(InteractionType, PopupRequest | RedirectRequest | Partial<Omit<CommonAuthorizationUrlRequest, "responseMode" | "earJwk" | "codeChallenge" | "codeChallengeMethod" | "requestedClaimsHash" | "platformBroker">>, Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>)

Jeśli użytkownik nie jest obecnie zalogowany, ten punkt zaczepienia wywołuje identyfikator logowania. Nieudane logowania można ponowić przy użyciu zwróconego wywołania zwrotnego logowania. Jeśli użytkownik jest obecnie zalogowany w tym haczyku próbuje uzyskać token. Kolejne żądania tokenu mogą używać zwróconego wywołania zwrotnego acquireToken. Opcjonalnie podaj obiekt żądania, który ma być używany w wywołaniu login/acquireToken. Opcjonalnie podaj określonego użytkownika, który powinien być zalogowany.

withMsal<P>(ComponentType<P>)

Wyższa kolejność składników zawija składniki z msal przez wstrzyknięcie wartości kontekstu msal do rekwizytów składnika

Szczegóły funkcji

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

Renderuje składniki podrzędne, jeśli użytkownik jest uwierzytelniony

function AuthenticatedTemplate(props: PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>>): React.ReactElement | null

Parametry

props

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

Zwraca

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

Próbuje uwierzytelnić użytkownika, jeśli nie został jeszcze uwierzytelniony, renderuje składniki podrzędne

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

Parametry

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 }>

Zwraca

React.ReactElement | null

MsalProvider(PropsWithChildren<{ instance: IPublicClientApplication }>)

Składnik dostawcy kontekstu BIBLIOTEKI MSAL. Należy to renderować powyżej innych składników korzystających z biblioteki MSAL.

function MsalProvider(__namedParameters: PropsWithChildren<{ instance: IPublicClientApplication }>): React.ReactElement

Parametry

__namedParameters

PropsWithChildren<{ instance: IPublicClientApplication }>

Zwraca

React.ReactElement

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

Renderuje składniki podrzędne, jeśli użytkownik jest nieuwierzytelniony

function UnauthenticatedTemplate(props: PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>>): React.ReactElement | null

Parametry

props

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

Zwraca

React.ReactElement | null

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

Biorąc pod uwagę co najmniej 1 element accountIdentifiers, zwraca obiekt Account, jeśli użytkownik jest zalogowany

function useAccount(accountIdentifiers?: Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>): AccountInfo | null

Parametry

accountIdentifiers

Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>

Zwraca

AccountInfo | null

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

Zwraca, czy użytkownik jest obecnie zalogowany. Opcjonalnie podaj co najmniej 1 element accountIdentifiers, aby określić, czy określony użytkownik jest zalogowany

function useIsAuthenticated(matchAccount?: Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>): boolean

Parametry

matchAccount

Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>

Zwraca

boolean

useMsal()

Zwraca wartości kontekstu msal

function useMsal(): IMsalContext

Zwraca

useMsalAuthentication(InteractionType, PopupRequest | RedirectRequest | Partial<Omit<CommonAuthorizationUrlRequest, "responseMode" | "earJwk" | "codeChallenge" | "codeChallengeMethod" | "requestedClaimsHash" | "platformBroker">>, Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>)

Jeśli użytkownik nie jest obecnie zalogowany, ten punkt zaczepienia wywołuje identyfikator logowania. Nieudane logowania można ponowić przy użyciu zwróconego wywołania zwrotnego logowania. Jeśli użytkownik jest obecnie zalogowany w tym haczyku próbuje uzyskać token. Kolejne żądania tokenu mogą używać zwróconego wywołania zwrotnego acquireToken. Opcjonalnie podaj obiekt żądania, który ma być używany w wywołaniu login/acquireToken. Opcjonalnie podaj określonego użytkownika, który powinien być zalogowany.

function useMsalAuthentication(interactionType: InteractionType, authenticationRequest?: PopupRequest | RedirectRequest | Partial<Omit<CommonAuthorizationUrlRequest, "responseMode" | "earJwk" | "codeChallenge" | "codeChallengeMethod" | "requestedClaimsHash" | "platformBroker">>, accountIdentifiers?: Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>): MsalAuthenticationResult

Parametry

interactionType
InteractionType
authenticationRequest

PopupRequest | RedirectRequest | Partial<Omit<CommonAuthorizationUrlRequest, "responseMode" | "earJwk" | "codeChallenge" | "codeChallengeMethod" | "requestedClaimsHash" | "platformBroker">>

accountIdentifiers

Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>

Zwraca

withMsal<P>(ComponentType<P>)

Wyższa kolejność składników zawija składniki z msal przez wstrzyknięcie wartości kontekstu msal do rekwizytów składnika

function withMsal<P>(Component: ComponentType<P>): FunctionComponent<Subtract<P, WithMsalProps>>

Parametry

Component

ComponentType<P>

Zwraca

FunctionComponent<Subtract<P, WithMsalProps>>

Szczegóły zmiennej

MsalConsumer

MsalConsumer: React.Consumer<IMsalContext>

Typ

React.Consumer<IMsalContext>

MsalContext

MsalContext: React.Context<IMsalContext>

Typ

React.Context<IMsalContext>

version

version: "3.0.29"

Typ

"3.0.29"