1 | import { GaxiosOptions } from 'gaxios';
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | type OAuthErrorCode = 'invalid_request' | 'invalid_client' | 'invalid_grant' | 'unauthorized_client' | 'unsupported_grant_type' | 'invalid_scope' | string;
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | export interface OAuthErrorResponse {
|
12 | error: OAuthErrorCode;
|
13 | error_description?: string;
|
14 | error_uri?: string;
|
15 | }
|
16 |
|
17 |
|
18 |
|
19 |
|
20 | export type ConfidentialClientType = 'basic' | 'request-body';
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | export interface ClientAuthentication {
|
27 | confidentialClientType: ConfidentialClientType;
|
28 | clientId: string;
|
29 | clientSecret?: string;
|
30 | }
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 | export declare abstract class OAuthClientAuthHandler {
|
39 | private readonly clientAuthentication?;
|
40 | private crypto;
|
41 | |
42 |
|
43 |
|
44 |
|
45 | constructor(clientAuthentication?: ClientAuthentication | undefined);
|
46 | /**
|
47 | * Applies client authentication on the OAuth request's headers or POST
|
48 | * body but does not process the request.
|
49 | * @param opts The GaxiosOptions whose headers or data are to be modified
|
50 | * depending on the client authentication mechanism to be used.
|
51 | * @param bearerToken The optional bearer token to use for authentication.
|
52 | * When this is used, no client authentication credentials are needed.
|
53 | */
|
54 | protected applyClientAuthenticationOptions(opts: GaxiosOptions, bearerToken?: string): void;
|
55 | /**
|
56 | * Applies client authentication on the request's header if either
|
57 | * basic authentication or bearer token authentication is selected.
|
58 | *
|
59 | * @param opts The GaxiosOptions whose headers or data are to be modified
|
60 | * depending on the client authentication mechanism to be used.
|
61 | * @param bearerToken The optional bearer token to use for authentication.
|
62 | * When this is used, no client authentication credentials are needed.
|
63 | */
|
64 | private injectAuthenticatedHeaders;
|
65 | /**
|
66 | * Applies client authentication on the request's body if request-body
|
67 | * client authentication is selected.
|
68 | *
|
69 | * @param opts The GaxiosOptions whose headers or data are to be modified
|
70 | * depending on the client authentication mechanism to be used.
|
71 | */
|
72 | private injectAuthenticatedRequestBody;
|
73 | /**
|
74 | * Retry config for Auth-related requests.
|
75 | *
|
76 | * @remarks
|
77 | *
|
78 | * This is not a part of the default {@link AuthClient.transporter transporter/gaxios}
|
79 | * config as some downstream APIs would prefer if customers explicitly enable retries,
|
80 | * such as GCS.
|
81 | */
|
82 | protected static get RETRY_CONFIG(): GaxiosOptions;
|
83 | }
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 | export declare function getErrorFromOAuthErrorResponse(resp: OAuthErrorResponse, err?: Error): Error;
|
92 | export {};
|