Condividi tramite


UserTokenCredentials class

Extends

Costruttori

UserTokenCredentials(string, string, string, string, TokenAudience, Environment, TokenCache)

Crea un nuovo oggetto UserTokenCredentials.

Proprietà

password
username

Proprietà ereditate

authContext
clientId
domain
environment
tokenAudience
tokenCache

Metodi

getToken()

Prova inizialmente a ottenere il token dalla cache. Se l'operazione ha esito negativo, tenta di ottenere il token da ADAL.

Metodi ereditati

setDomain(string)
signRequest(WebResource)

Firma una richiesta con l'intestazione Authentication.

Dettagli costruttore

UserTokenCredentials(string, string, string, string, TokenAudience, Environment, TokenCache)

Crea un nuovo oggetto UserTokenCredentials.

new UserTokenCredentials(clientId: string, domain: string, username: string, password: string, tokenAudience?: TokenAudience, environment?: Environment, tokenCache?: TokenCache)

Parametri

clientId

string

ID client dell'applicazione Active Directory. Per un esempio, vedere Guida introduttiva ad Active Directory per .NET .

domain

string

ID di dominio o tenant contenente l'applicazione.

username

string

Nome utente per l'account ID organizzazione.

password

string

Password per l'account ID organizzazione.

tokenAudience
TokenAudience

Destinatari per cui viene richiesto il token. I valori validi sono 'graph', 'batch' o qualsiasi altra risorsa, ad esempio 'https://vault.azure.net/'. Se tokenAudience è 'graph', è necessario specificare anche il dominio e il relativo valore non deve essere il tenant 'common' predefinito. Deve essere una stringa (preferibilmente in un formato GUID).

environment
Environment

Ambiente azure con cui eseguire l'autenticazione.

tokenCache

TokenCache

Cache del token. Il valore predefinito è l'oggetto MemoryCache di adal.

Dettagli proprietà

password

password: string

Valore della proprietà

string

username

username: string

Valore della proprietà

string

Dettagli proprietà ereditate

authContext

authContext: AuthenticationContext

Valore della proprietà

AuthenticationContext

Ereditato daTokenCredentialsBase.authContext

clientId

clientId: string

Valore della proprietà

string

Ereditato daTokenCredentialsBase.clientId

domain

domain: string

Valore della proprietà

string

Ereditato daTokenCredentialsBase.domain

environment

environment: Environment

Valore della proprietà

Ereditato daTokenCredentialsBase.environment

tokenAudience

tokenAudience?: string

Valore della proprietà

string

Ereditato daTokenCredentialsBase.tokenAudience

tokenCache

tokenCache: TokenCache

Valore della proprietà

TokenCache

Ereditato daTokenCredentialsBase.tokenCache

Dettagli metodo

getToken()

Prova inizialmente a ottenere il token dalla cache. Se l'operazione ha esito negativo, tenta di ottenere il token da ADAL.

function getToken(): Promise<TokenResponse>

Restituisce

Promise<TokenResponse>

TokenResponse (tokenType e accessToken sono le due proprietà importanti).

Dettagli dei metodi ereditati

setDomain(string)

function setDomain(domain: string)

Parametri

domain

string

Ereditato daTokenCredentialsBase.setDomain

signRequest(WebResource)

Firma una richiesta con l'intestazione Authentication.

function signRequest(webResource: WebResource): Promise<WebResource>

Parametri

webResource
WebResource

Oggetto WebResource da firmare.

Restituisce

Promise<WebResource>

Ereditato daTokenCredentialsBase.signRequest