@azure/msal-react package
Interfejsy
| IMsalContext |
Aliasy typu
| AccountIdentifiers | |
| AuthenticatedTemplateProps | |
| MsalAuthenticationProps | |
| MsalAuthenticationResult | |
| MsalProviderProps | |
| SetComplement | |
| SetDifference | |
| Subtract | |
| UnauthenticatedTemplateProps | |
| WithMsalProps |
Funkcje
| Authenticated |
Renderuje składniki podrzędne, jeśli użytkownik jest uwierzytelniony |
| Msal |
Próbuje uwierzytelnić użytkownika, jeśli nie został jeszcze uwierzytelniony, renderuje składniki podrzędne |
| Msal |
Składnik dostawcy kontekstu BIBLIOTEKI MSAL. Należy to renderować powyżej innych składników korzystających z biblioteki MSAL. |
| Unauthenticated |
Renderuje składniki podrzędne, jeśli użytkownik jest nieuwierzytelniony |
| use |
Biorąc pod uwagę co najmniej 1 element accountIdentifiers, zwraca obiekt Account, jeśli użytkownik jest zalogowany |
| use |
Zwraca, czy użytkownik jest obecnie zalogowany. Opcjonalnie podaj co najmniej 1 element accountIdentifiers, aby określić, czy określony użytkownik jest zalogowany |
| use |
Zwraca wartości kontekstu msal |
| use |
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. |
| with |
Wyższa kolejność składników zawija składniki z msal przez wstrzyknięcie wartości kontekstu msal do rekwizytów składnika |
Zmienne
| Msal |
|
| Msal |
|
| version |
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
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()
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
MsalContext
version
version: "3.0.29"
Typ
"3.0.29"