@shad-claiborne/basic-oidc 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,281 @@
1
- import { IdentityProvider } from "./identity-provider";
1
+ export interface IdentityProviderConfiguration {
2
+ issuer: string;
3
+ authorization_endpoint: string;
4
+ token_endpoint: string;
5
+ userinfo_endpoint: string;
6
+ registration_endpoint: string;
7
+ jwks_uri: string;
8
+ response_types_supported: string[];
9
+ response_modes_supported: string[];
10
+ grant_types_supported: string[];
11
+ subject_types_supported: string[];
12
+ id_token_signing_alg_values_supported: string[];
13
+ scopes_supported: string[];
14
+ token_endpoint_auth_methods_supported: string[];
15
+ claims_supported: string[];
16
+ code_challenge_methods_supported: string[];
17
+ introspection_endpoint: string;
18
+ introspection_endpoint_auth_methods_supported: string[];
19
+ revocation_endpoint: string;
20
+ revocation_endpoint_auth_methods_supported: string[];
21
+ end_session_endpoint: string;
22
+ request_parameter_supported: boolean;
23
+ request_object_signing_alg_values_supported: string[];
24
+ device_authorization_endpoint: string;
25
+ pushed_authorization_request_endpoint: string;
26
+ backchannel_token_delivery_modes_supported: string[];
27
+ backchannel_authentication_request_signing_alg_values_supported: string[];
28
+ dpop_signing_alg_values_supported: string[];
29
+ }
30
+ export interface AuthorizationResponse {
31
+ code?: string;
32
+ id_token?: string;
33
+ state?: string;
34
+ }
35
+ export interface TokenSet {
36
+ token_type: string;
37
+ access_token: string;
38
+ expires_in: number;
39
+ refresh_token: string;
40
+ id_token?: string;
41
+ }
42
+ export interface Identity {
43
+ sub: string;
44
+ name?: string;
45
+ email?: string;
46
+ }
47
+ /**
48
+ * class AuthorizationRequest
49
+ */
50
+ export declare class AuthorizationRequest {
51
+ private client;
52
+ private responseType;
53
+ private responseMode;
54
+ private redirectUri;
55
+ private scope;
56
+ private state;
57
+ private codeChallenge;
58
+ private codeChallengeMethod;
59
+ /**
60
+ * constructor
61
+ * @param client Client
62
+ */
63
+ constructor(client: Client);
64
+ /**
65
+ * setRedirectUri
66
+ * @param uri string
67
+ */
68
+ setRedirectUri(uri: string): AuthorizationRequest;
69
+ /**
70
+ * setState
71
+ * @param state string
72
+ */
73
+ setState(state: string): AuthorizationRequest;
74
+ /**
75
+ * setResponseMode
76
+ * @param mode string
77
+ */
78
+ setResponseMode(mode: string): AuthorizationRequest;
79
+ /**
80
+ * setResponseType
81
+ * @param type string[]
82
+ */
83
+ setResponseType(type: string): AuthorizationRequest;
84
+ /**
85
+ * setScope
86
+ * @param scope string[]
87
+ */
88
+ setScope(scope: string[]): AuthorizationRequest;
89
+ /**
90
+ * setCodeChallenge
91
+ * @param challenge string
92
+ * @param method string
93
+ */
94
+ setCodeChallenge(challenge: string, method?: string): AuthorizationRequest;
95
+ /**
96
+ * toURLSearchParams
97
+ * @returns URLSearchParams
98
+ */
99
+ toURLSearchParams(): URLSearchParams;
100
+ /**
101
+ * toURL
102
+ * @returns URL
103
+ */
104
+ toURL(): URL;
105
+ }
106
+ /**
107
+ * class TokenRequest
108
+ */
109
+ export declare class TokenRequest {
110
+ private client;
111
+ private code;
112
+ private codeVerifier;
113
+ private redirectUri;
114
+ private grantType;
115
+ private refreshToken;
116
+ /**
117
+ * constructor
118
+ * @param client Client
119
+ */
120
+ constructor(client: Client);
121
+ /**
122
+ * setCode
123
+ * @param code string
124
+ */
125
+ setCode(code: string): TokenRequest;
126
+ /**
127
+ * setRedirectUri
128
+ * @param uri string
129
+ */
130
+ setRedirectUri(uri: string): TokenRequest;
131
+ /**
132
+ * setCodeVerifier
133
+ * @param verifier string
134
+ */
135
+ setCodeVerifier(verifier: string): TokenRequest;
136
+ /**
137
+ * setGrantType
138
+ * @param type string
139
+ */
140
+ setGrantType(type: string): TokenRequest;
141
+ /**
142
+ * setRefreshToken
143
+ * @param token string
144
+ */
145
+ setRefreshToken(token: string): TokenRequest;
146
+ /**
147
+ * toURLSearchParams
148
+ * @returns URLSearchParams
149
+ */
150
+ toURLSearchParams(): URLSearchParams;
151
+ }
152
+ /**
153
+ * class IdentityProvider
154
+ */
155
+ export declare class IdentityProvider {
156
+ private config;
157
+ /**
158
+ * constructor
159
+ * @param config IdentityProviderConfiguration
160
+ */
161
+ constructor(config: IdentityProviderConfiguration);
162
+ /**
163
+ * getAuthorizationEndpoint
164
+ * @returns string
165
+ */
166
+ getAuthorizationEndpoint(): string;
167
+ /**
168
+ * getTokenEndpoint
169
+ * @returns string
170
+ */
171
+ getTokenEndpoint(): string;
172
+ /**
173
+ * getUserinfoEndpoint
174
+ * @returns string
175
+ */
176
+ getUserinfoEndpoint(): string;
177
+ /**
178
+ * getRevocationEndpoint
179
+ * @returns string
180
+ */
181
+ getRevocationEndpoint(): string;
182
+ /**
183
+ * isResponseModeSupported
184
+ * @param mode string
185
+ * @returns boolean
186
+ */
187
+ isResponseModeSupported(mode: string): boolean;
188
+ /**
189
+ * isResponseTypeSupported
190
+ * @param type string[]
191
+ * @returns boolean
192
+ */
193
+ isResponseTypeSupported(type: string): boolean;
194
+ /**
195
+ * isScopeSupported
196
+ * @param scope string[]
197
+ * @returns boolean
198
+ */
199
+ isScopeSupported(scope: string[]): boolean;
200
+ /**
201
+ * isChallengeMethodSupported
202
+ * @param method string
203
+ * @returns boolean
204
+ */
205
+ isChallengeMethodSupported(method: string): boolean;
206
+ /**
207
+ * isGrantTypeSupported
208
+ * @param method string
209
+ * @returns boolean
210
+ */
211
+ isGrantTypeSupported(type: string): boolean;
212
+ /**
213
+ * createClient
214
+ * @returns Client
215
+ */
216
+ createClient(id: string, secret: string): Client;
217
+ /**
218
+ * getIdentity
219
+ * @param client Client
220
+ * @param tokenSet TokenSet
221
+ * @returns Promise<Identity | null>
222
+ */
223
+ getIdentity(client: Client, tokenSet: TokenSet): Promise<Identity | null>;
224
+ }
225
+ /**
226
+ * class Client
227
+ */
228
+ export declare class Client {
229
+ private provider;
230
+ private clientId;
231
+ private clientSecret;
232
+ /**
233
+ * constructor
234
+ * @param provider IdentityProvider
235
+ * @param id string
236
+ * @param secret string
237
+ */
238
+ constructor(provider: IdentityProvider, id: string, secret: string);
239
+ /**
240
+ * getProvider
241
+ * @returns IdentityProvider
242
+ */
243
+ getProvider(): IdentityProvider;
244
+ /**
245
+ * getClientId
246
+ * @returns string
247
+ */
248
+ getClientId(): string;
249
+ /**
250
+ * getClientSecret
251
+ * @returns string
252
+ */
253
+ getClientSecret(): string;
254
+ /**
255
+ * newAuthorizationRequest
256
+ * @returns AuthorizationRequest
257
+ */
258
+ newAuthorizationRequest(): AuthorizationRequest;
259
+ /**
260
+ * requestAccess
261
+ * @param authResponse AuthorizationResponse
262
+ * @param codeVerifier string
263
+ * @returns Promise<TokenSet>
264
+ */
265
+ requestAccess(authResponse: AuthorizationResponse, codeVerifier?: string): Promise<TokenSet>;
266
+ /**
267
+ * refreshAccess
268
+ * @param tokenSet TokenSet
269
+ * @returns Promise<TokenSet>
270
+ */
271
+ refreshAccess(tokenSet: TokenSet): Promise<TokenSet>;
272
+ /**
273
+ * revokeAccess
274
+ * @param tokenSet TokenSet
275
+ * @returns Promise<void>
276
+ */
277
+ revokeAccess(tokenSet: TokenSet): Promise<void>;
278
+ }
2
279
  /**
3
280
  * createIdentityProvider
4
281
  * @param issuer string