UserTokenCredentials class
- Extends
Costruttori
| User |
Crea un nuovo oggetto UserTokenCredentials. |
Proprietà ereditate
| auth |
|
| client |
|
| domain | |
| environment | |
| token |
|
| token |
Metodi
| get |
Prova a ottenere inizialmente il token dalla cache. Se l'operazione ha esito negativo, prova a ottenere il token da ADAL. |
Metodi ereditati
| set |
|
| sign |
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 di 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
Gruppo di destinatari per il quale viene richiesto il token. I valori validi sono 'graph', 'batch' o qualsiasi altra risorsa come 'https://vault.azure.net/'. Se tokenAudience è 'graph', deve essere fornito 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 dei token. Il valore predefinito è l'oggetto MemoryCache da 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
domain
environment
tokenAudience
tokenCache
tokenCache: TokenCache
Valore della proprietà
TokenCache
ereditato daTokenCredentialsBase.tokenCache
Dettagli metodo
getToken()
Prova a ottenere inizialmente il token dalla cache. Se l'operazione ha esito negativo, prova a 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
WebResource da firmare.
Restituisce
Promise<WebResource>
ereditato daTokenCredentialsBase.signRequest