wangzhibo
2026-05-09 53418655c061ac26f66058253f39200aced1ab1d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import type { AbortSignalLike } from "@azure/abort-controller";
import type { TracingContext } from "./tracing.js";
import type { HttpMethods } from "@azure/core-util";
/**
 * Represents a credential capable of providing an authentication token.
 */
export interface TokenCredential {
    /**
     * Gets the token provided by this credential.
     *
     * This method is called automatically by Azure SDK client libraries. You may call this method
     * directly, but you must also handle token caching and token refreshing.
     *
     * @param scopes - The list of scopes for which the token will have access.
     * @param options - The options used to configure any requests this
     *                TokenCredential implementation might make.
     */
    getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null>;
}
/**
 * Defines options for TokenCredential.getToken.
 */
export interface GetTokenOptions {
    /**
     * The signal which can be used to abort requests.
     */
    abortSignal?: AbortSignalLike;
    /**
     * Options used when creating and sending HTTP requests for this operation.
     */
    requestOptions?: {
        /**
         * The number of milliseconds a request can take before automatically being terminated.
         */
        timeout?: number;
    };
    /**
     * Options used when tracing is enabled.
     */
    tracingOptions?: {
        /**
         * Tracing Context for the current request.
         */
        tracingContext?: TracingContext;
    };
    /**
     * Claim details to perform the Continuous Access Evaluation authentication flow
     */
    claims?: string;
    /**
     * Indicates whether to enable the Continuous Access Evaluation authentication flow
     */
    enableCae?: boolean;
    /**
     * Allows specifying a tenantId. Useful to handle challenges that provide tenant Id hints.
     */
    tenantId?: string;
    /**
     * Options for Proof of Possession token requests
     */
    proofOfPossessionOptions?: {
        /**
         * The nonce value required for PoP token requests.
         * This is typically retrieved from the WWW-Authenticate header of a 401 challenge response.
         * This is used in combination with {@link resourceRequestUrl} and {@link resourceRequestMethod} to generate the PoP token.
         */
        nonce: string;
        /**
         * The HTTP method of the request.
         * This is used in combination with {@link resourceRequestUrl} and {@link nonce} to generate the PoP token.
         */
        resourceRequestMethod: HttpMethods;
        /**
         * The URL of the request.
         * This is used in combination with {@link resourceRequestMethod} and {@link nonce} to generate the PoP token.
         */
        resourceRequestUrl: string;
    };
}
/**
 * Represents an access token with an expiration time.
 */
export interface AccessToken {
    /**
     * The access token returned by the authentication service.
     */
    token: string;
    /**
     * The access token's expiration timestamp in milliseconds, UNIX epoch time.
     */
    expiresOnTimestamp: number;
    /**
     * The timestamp when the access token should be refreshed, in milliseconds, UNIX epoch time.
     */
    refreshAfterTimestamp?: number;
    /** Type of token - `Bearer` or `pop` */
    tokenType?: "Bearer" | "pop";
}
/**
 * @internal
 * @param accessToken - Access token
 * @returns Whether a token is bearer type or not
 */
export declare function isBearerToken(accessToken: AccessToken): boolean;
/**
 * @internal
 * @param accessToken - Access token
 * @returns Whether a token is Pop token or not
 */
export declare function isPopToken(accessToken: AccessToken): boolean;
/**
 * Tests an object to determine whether it implements TokenCredential.
 *
 * @param credential - The assumed TokenCredential to be tested.
 */
export declare function isTokenCredential(credential: unknown): credential is TokenCredential;
//# sourceMappingURL=tokenCredential.d.ts.map