@oauth2-cli/qui-cli 0.7.6 → 0.7.9
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/CHANGELOG.md +11 -0
- package/dist/Client.js +10 -6
- package/dist/OAuth2Plugin.d.ts +7 -0
- package/dist/OAuth2Plugin.js +26 -11
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [0.7.9](https://github.com/battis/oauth2-cli/compare/qui-cli-plugin/0.7.8...qui-cli-plugin/0.7.9) (2026-02-19)
|
|
6
|
+
|
|
7
|
+
## [0.7.8](https://github.com/battis/oauth2-cli/compare/qui-cli-plugin/0.7.7...qui-cli-plugin/0.7.8) (2026-02-19)
|
|
8
|
+
|
|
9
|
+
## [0.7.7](https://github.com/battis/oauth2-cli/compare/qui-cli-plugin/0.7.6...qui-cli-plugin/0.7.7) (2026-02-19)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* human-readable client name for clarity ([68b4287](https://github.com/battis/oauth2-cli/commit/68b42872998ec423440d07447012282528e3ee76))
|
|
15
|
+
|
|
5
16
|
## [0.7.6](https://github.com/battis/oauth2-cli/compare/qui-cli-plugin/0.7.5...qui-cli-plugin/0.7.6) (2026-02-19)
|
|
6
17
|
|
|
7
18
|
|
package/dist/Client.js
CHANGED
|
@@ -5,7 +5,7 @@ export class Client extends OAuth2CLI.Client {
|
|
|
5
5
|
const creating = !this.config;
|
|
6
6
|
const config = await super.getConfiguration();
|
|
7
7
|
if (creating) {
|
|
8
|
-
Log.debug(
|
|
8
|
+
Log.debug(`${this.clientName()} OAuth 2.0 configuration created`, {
|
|
9
9
|
credentials: this.credentials,
|
|
10
10
|
config: {
|
|
11
11
|
serverMetadata: config.serverMetadata(),
|
|
@@ -16,22 +16,26 @@ export class Client extends OAuth2CLI.Client {
|
|
|
16
16
|
return config;
|
|
17
17
|
}
|
|
18
18
|
async authorize() {
|
|
19
|
-
Log.debug(
|
|
19
|
+
Log.debug(`Authorizing ${this.clientName()} new access token`);
|
|
20
20
|
const response = await super.authorize();
|
|
21
|
-
Log.debug(
|
|
21
|
+
Log.debug(`Authorized ${this.clientName()} new access token`, { response });
|
|
22
22
|
return response;
|
|
23
23
|
}
|
|
24
24
|
async handleAuthorizationCodeRedirect(request, session) {
|
|
25
|
-
Log.debug(
|
|
25
|
+
Log.debug(`Handling ${this.clientName()} Authorization Code flow redirect`, {
|
|
26
26
|
request,
|
|
27
27
|
session
|
|
28
28
|
});
|
|
29
29
|
return super.handleAuthorizationCodeRedirect(request, session);
|
|
30
30
|
}
|
|
31
31
|
async refreshTokenGrant(token) {
|
|
32
|
-
Log.debug(
|
|
32
|
+
Log.debug(`Refreshing expired ${this.clientName()} access token`, {
|
|
33
|
+
token
|
|
34
|
+
});
|
|
33
35
|
const refreshed = await super.refreshTokenGrant(token);
|
|
34
|
-
Log.debug(
|
|
36
|
+
Log.debug(`Received refreshed ${this.clientName()} access token`, {
|
|
37
|
+
token: refreshed
|
|
38
|
+
});
|
|
35
39
|
return refreshed;
|
|
36
40
|
}
|
|
37
41
|
async request(url, method, body, headers, dPoPOptions) {
|
package/dist/OAuth2Plugin.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ type Usage = {
|
|
|
14
14
|
text?: string[];
|
|
15
15
|
};
|
|
16
16
|
export type Configuration<C extends OAuth2CLI.Credentials = OAuth2CLI.Credentials> = Plugin.Configuration & {
|
|
17
|
+
/** Human-readable name for client in messages. */
|
|
18
|
+
name?: string;
|
|
17
19
|
/** OAuth 2.0/OpenID Connect credential set */
|
|
18
20
|
credentials?: Partial<C>;
|
|
19
21
|
/** Base URL for all non-absolute requests */
|
|
@@ -40,6 +42,11 @@ export declare class OAuth2Plugin<C extends OAuth2CLI.Credentials = OAuth2CLI.Cr
|
|
|
40
42
|
[key: string]: unknown;
|
|
41
43
|
private static names;
|
|
42
44
|
private static registeredPorts;
|
|
45
|
+
private overrideName?;
|
|
46
|
+
/**
|
|
47
|
+
* @param name Human-readable name for client in messages. Must also be a
|
|
48
|
+
* unique qui-cli plugin name.
|
|
49
|
+
*/
|
|
43
50
|
constructor(name?: string);
|
|
44
51
|
private credentials?;
|
|
45
52
|
private base_url?;
|
package/dist/OAuth2Plugin.js
CHANGED
|
@@ -8,6 +8,11 @@ export class OAuth2Plugin {
|
|
|
8
8
|
name;
|
|
9
9
|
static names = [];
|
|
10
10
|
static registeredPorts = {};
|
|
11
|
+
overrideName;
|
|
12
|
+
/**
|
|
13
|
+
* @param name Human-readable name for client in messages. Must also be a
|
|
14
|
+
* unique qui-cli plugin name.
|
|
15
|
+
*/
|
|
11
16
|
constructor(name = '@oauth2-cli/qui-cli') {
|
|
12
17
|
this.name = name;
|
|
13
18
|
if (OAuth2Plugin.names.includes(name)) {
|
|
@@ -54,6 +59,7 @@ export class OAuth2Plugin {
|
|
|
54
59
|
}
|
|
55
60
|
return c;
|
|
56
61
|
}
|
|
62
|
+
this.overrideName = Plugin.hydrate(proposal.name, this.overrideName);
|
|
57
63
|
this.credentials = hydrate(proposal.credentials, this.credentials);
|
|
58
64
|
this.base_url = Plugin.hydrate(proposal.base_url, this.base_url);
|
|
59
65
|
this.storage = Plugin.hydrate(proposal.storage, this.storage);
|
|
@@ -67,20 +73,23 @@ export class OAuth2Plugin {
|
|
|
67
73
|
const url = requestish.URL.from(this.credentials.redirect_uri);
|
|
68
74
|
if (url.hostname !== 'localhost' &&
|
|
69
75
|
!/^\/https?\/localhost(:\d+)?\//.test(url.pathname)) {
|
|
70
|
-
Log.warning(`The ${Colors.varName(this.env.redirect_uri)} value ${Colors.url(this.credentials.redirect_uri)} may not work: it
|
|
76
|
+
Log.warning(`The ${Colors.varName(this.env.redirect_uri)} value ${Colors.url(this.credentials.redirect_uri)} for ${this.overrideName || this.name} may not work: it ` +
|
|
77
|
+
`${Colors.keyword('must')} redirect to ${Colors.url('localhost')}`);
|
|
71
78
|
}
|
|
72
79
|
if (url.protocol !== 'http:' &&
|
|
73
80
|
!/^\/http\/localhost(:\d+)?\//.test(url.pathname)) {
|
|
74
|
-
Log.warning(`The ${Colors.url(url.protocol)} protocol may not work without additional configuration. The
|
|
75
|
-
`server listening for the
|
|
81
|
+
Log.warning(`The ${Colors.url(url.protocol)} protocol may not work without additional configuration. The out-` +
|
|
82
|
+
`of-band server listening for the ` +
|
|
83
|
+
`${this.overrideName || this.name} redirect is not automatically ` +
|
|
76
84
|
`provisioned with an SSL certificate`);
|
|
77
85
|
}
|
|
78
86
|
if (OAuth2Plugin.registeredPorts[url.port] &&
|
|
79
87
|
OAuth2Plugin.registeredPorts[url.port] !== this.name) {
|
|
80
88
|
Log.warning(`The port ${Colors.value(url.port)} has already been registered to another instance of this plugin ` +
|
|
81
|
-
`named ${Colors.value(OAuth2Plugin.registeredPorts[url.port])}. This will likely cause a failure if both
|
|
82
|
-
|
|
83
|
-
`
|
|
89
|
+
`named ${Colors.value(OAuth2Plugin.registeredPorts[url.port])}. This will likely cause a failure if both ` +
|
|
90
|
+
`${this.overrideName || this.name} and ` +
|
|
91
|
+
`${OAuth2Plugin.registeredPorts[url.port]} are listening for ` +
|
|
92
|
+
`redirects at relatively proximate moments in time.`);
|
|
84
93
|
}
|
|
85
94
|
}
|
|
86
95
|
}
|
|
@@ -154,27 +163,33 @@ export class OAuth2Plugin {
|
|
|
154
163
|
get client() {
|
|
155
164
|
if (!this._client) {
|
|
156
165
|
if (!this.credentials?.client_id) {
|
|
157
|
-
throw new Error(`A ${Colors.varName(this.env.client_id)} ${Colors.keyword('must')}
|
|
166
|
+
throw new Error(`A ${Colors.varName(this.env.client_id)} ${Colors.keyword('must')} ` +
|
|
167
|
+
`be configured for ${this.overrideName || this.name}.`);
|
|
158
168
|
}
|
|
159
169
|
if (!this.credentials?.client_secret) {
|
|
160
|
-
throw new Error(`A ${Colors.varName(this.env.client_secret)} ${Colors.keyword('must')}
|
|
170
|
+
throw new Error(`A ${Colors.varName(this.env.client_secret)} ${Colors.keyword('must')} ` +
|
|
171
|
+
`be configured for ${this.overrideName || this.name}.`);
|
|
161
172
|
}
|
|
162
173
|
if (!this.credentials?.redirect_uri) {
|
|
163
|
-
throw new Error(`A ${Colors.varName(this.env.redirect_uri)} ${Colors.keyword('must')}
|
|
174
|
+
throw new Error(`A ${Colors.varName(this.env.redirect_uri)} ${Colors.keyword('must')} ` +
|
|
175
|
+
`be configured for ${this.overrideName || this.name}.`);
|
|
164
176
|
}
|
|
165
177
|
if (!this.credentials?.issuer) {
|
|
166
178
|
if (!this.credentials?.authorization_endpoint) {
|
|
167
179
|
throw new Error(`Either an ${Colors.varName(this.env.issuer)} or ` +
|
|
168
180
|
`${Colors.varName(this.env.authorization_endpoint)} ` +
|
|
169
|
-
`${Colors.keyword('must')} be configured
|
|
181
|
+
`${Colors.keyword('must')} be configured for ` +
|
|
182
|
+
`${this.overrideName || this.name}.`);
|
|
170
183
|
}
|
|
171
184
|
if (!this.credentials?.token_endpoint) {
|
|
172
185
|
throw new Error(`Either an ${Colors.varName(this.env.issuer)} or ` +
|
|
173
186
|
`${Colors.varName(this.env.token_endpoint)} ` +
|
|
174
|
-
`${Colors.keyword('must')} be configured
|
|
187
|
+
`${Colors.keyword('must')} be configured for ` +
|
|
188
|
+
`${this.overrideName || this.name}.`);
|
|
175
189
|
}
|
|
176
190
|
}
|
|
177
191
|
this._client = this.instantiateClient({
|
|
192
|
+
name: this.overrideName || this.name,
|
|
178
193
|
credentials: this.credentials,
|
|
179
194
|
base_url: this.base_url,
|
|
180
195
|
inject: this.inject,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oauth2-cli/qui-cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.9",
|
|
4
4
|
"description": "@qui-cli/plugin wrapper for oauth2-cli",
|
|
5
5
|
"homepage": "https://github.com/battis/oauth2-cli/tree/main/packages/qui-cli#readme",
|
|
6
6
|
"repository": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"types": "./dist/index.d.ts",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@qui-cli/colors": "^3.2.3",
|
|
20
|
-
"oauth2-cli": "0.8.
|
|
20
|
+
"oauth2-cli": "0.8.4",
|
|
21
21
|
"requestish": "0.1.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|