@whook/oauth2 27.0.3 → 27.1.0
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/README.md +44 -25
- package/dist/index.d.ts +11 -7
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/dist/index.test.js +131 -15
- package/dist/index.test.js.map +1 -1
- package/dist/libs/clients.d.ts +17 -1
- package/dist/libs/clients.js +39 -6
- package/dist/libs/clients.js.map +1 -1
- package/dist/libs/clients.test.d.ts +1 -0
- package/dist/libs/clients.test.js +32 -0
- package/dist/libs/clients.test.js.map +1 -0
- package/dist/libs/errors.d.ts +24 -0
- package/dist/libs/errors.js +42 -0
- package/dist/libs/errors.js.map +1 -1
- package/dist/libs/verifier.d.ts +3 -3
- package/dist/libs/verifier.js +4 -3
- package/dist/libs/verifier.js.map +1 -1
- package/dist/routes/getOAuth2Authorize.d.ts +19 -6
- package/dist/routes/getOAuth2Authorize.js +29 -14
- package/dist/routes/getOAuth2Authorize.js.map +1 -1
- package/dist/routes/getOAuth2WellKnownMetadata.d.ts +3 -4
- package/dist/routes/getOAuth2WellKnownMetadata.js +19 -7
- package/dist/routes/getOAuth2WellKnownMetadata.js.map +1 -1
- package/dist/routes/getOAuth2WellKnownMetadata.test.js +81 -0
- package/dist/routes/getOAuth2WellKnownMetadata.test.js.map +1 -1
- package/dist/routes/getOAuth2WellKnownProtectedResourceMetadata.d.ts +0 -2
- package/dist/routes/getOAuth2WellKnownProtectedResourceMetadata.js +1 -2
- package/dist/routes/getOAuth2WellKnownProtectedResourceMetadata.js.map +1 -1
- package/dist/routes/postAuthLogin.d.ts +1 -1
- package/dist/routes/postAuthLogin.js +1 -1
- package/dist/routes/postAuthLogin.js.map +1 -1
- package/dist/routes/postAuthRefresh.d.ts +1 -1
- package/dist/routes/postAuthRefresh.js +1 -1
- package/dist/routes/postAuthRefresh.js.map +1 -1
- package/dist/routes/postOAuth2Acknowledge.d.ts +0 -3
- package/dist/routes/postOAuth2Acknowledge.js +1 -3
- package/dist/routes/postOAuth2Acknowledge.js.map +1 -1
- package/dist/routes/postOAuth2DeviceAcknowledge.d.ts +64 -0
- package/dist/routes/postOAuth2DeviceAcknowledge.js +84 -0
- package/dist/routes/postOAuth2DeviceAcknowledge.js.map +1 -0
- package/dist/routes/postOAuth2DeviceAcknowledge.test.d.ts +1 -0
- package/dist/routes/postOAuth2DeviceAcknowledge.test.js +369 -0
- package/dist/routes/postOAuth2DeviceAcknowledge.test.js.map +1 -0
- package/dist/routes/postOAuth2DeviceAuthorization.d.ts +133 -0
- package/dist/routes/postOAuth2DeviceAuthorization.js +177 -0
- package/dist/routes/postOAuth2DeviceAuthorization.js.map +1 -0
- package/dist/routes/postOAuth2DeviceAuthorization.test.d.ts +1 -0
- package/dist/routes/postOAuth2DeviceAuthorization.test.js +174 -0
- package/dist/routes/postOAuth2DeviceAuthorization.test.js.map +1 -0
- package/dist/routes/postOAuth2PushedAuthorizationRequest.d.ts +1 -6
- package/dist/routes/postOAuth2PushedAuthorizationRequest.js +11 -14
- package/dist/routes/postOAuth2PushedAuthorizationRequest.js.map +1 -1
- package/dist/routes/postOAuth2PushedAuthorizationRequest.test.js +47 -0
- package/dist/routes/postOAuth2PushedAuthorizationRequest.test.js.map +1 -1
- package/dist/routes/postOAuth2Token.d.ts +2 -7
- package/dist/routes/postOAuth2Token.js +2 -6
- package/dist/routes/postOAuth2Token.js.map +1 -1
- package/dist/routes/postOAuth2Token.test.js +107 -0
- package/dist/routes/postOAuth2Token.test.js.map +1 -1
- package/dist/routes/schemas.d.ts +178 -0
- package/dist/routes/schemas.js +188 -0
- package/dist/routes/schemas.js.map +1 -0
- package/dist/services/oAuth2AuthorizationCodeGranter.d.ts +0 -70
- package/dist/services/oAuth2AuthorizationCodeGranter.js +7 -84
- package/dist/services/oAuth2AuthorizationCodeGranter.js.map +1 -1
- package/dist/services/oAuth2AuthorizationRequests.js +4 -5
- package/dist/services/oAuth2AuthorizationRequests.js.map +1 -1
- package/dist/services/oAuth2ClientCredentialsGranter.d.ts +1 -16
- package/dist/services/oAuth2ClientCredentialsGranter.js +7 -25
- package/dist/services/oAuth2ClientCredentialsGranter.js.map +1 -1
- package/dist/services/oAuth2DeviceAuthorizationCodeGranter.test.d.ts +1 -0
- package/dist/services/oAuth2DeviceAuthorizationCodeGranter.test.js +332 -0
- package/dist/services/oAuth2DeviceAuthorizationCodeGranter.test.js.map +1 -0
- package/dist/services/oAuth2DeviceAuthorizationGranter.d.ts +54 -0
- package/dist/services/oAuth2DeviceAuthorizationGranter.js +67 -0
- package/dist/services/oAuth2DeviceAuthorizationGranter.js.map +1 -0
- package/dist/services/oAuth2Granters.js +0 -2
- package/dist/services/oAuth2Granters.js.map +1 -1
- package/dist/services/oAuth2PasswordGranter.d.ts +1 -22
- package/dist/services/oAuth2PasswordGranter.js +5 -30
- package/dist/services/oAuth2PasswordGranter.js.map +1 -1
- package/dist/services/oAuth2RefreshTokenGranter.d.ts +1 -19
- package/dist/services/oAuth2RefreshTokenGranter.js +5 -28
- package/dist/services/oAuth2RefreshTokenGranter.js.map +1 -1
- package/package.json +2 -2
- package/src/index.test.ts +169 -26
- package/src/index.ts +21 -26
- package/src/libs/clients.test.ts +47 -0
- package/src/libs/clients.ts +60 -10
- package/src/libs/errors.ts +72 -0
- package/src/libs/verifier.ts +11 -3
- package/src/routes/__snapshots__/postOAuth2DeviceAcknowledge.test.ts.snap +5 -0
- package/src/routes/getOAuth2Authorize.ts +41 -26
- package/src/routes/getOAuth2WellKnownMetadata.test.ts +96 -0
- package/src/routes/getOAuth2WellKnownMetadata.ts +24 -10
- package/src/routes/getOAuth2WellKnownProtectedResourceMetadata.ts +1 -3
- package/src/routes/postAuthLogin.ts +1 -1
- package/src/routes/postAuthRefresh.ts +1 -1
- package/src/routes/postOAuth2Acknowledge.ts +2 -4
- package/src/routes/postOAuth2DeviceAcknowledge.test.ts +408 -0
- package/src/routes/postOAuth2DeviceAcknowledge.ts +157 -0
- package/src/routes/postOAuth2DeviceAuthorization.test.ts +192 -0
- package/src/routes/postOAuth2DeviceAuthorization.ts +261 -0
- package/src/routes/postOAuth2PushedAuthorizationRequest.test.ts +59 -0
- package/src/routes/postOAuth2PushedAuthorizationRequest.ts +16 -22
- package/src/routes/postOAuth2Token.test.ts +119 -0
- package/src/routes/postOAuth2Token.ts +6 -16
- package/src/routes/schemas.ts +210 -0
- package/src/services/oAuth2AuthorizationCodeGranter.ts +11 -94
- package/src/services/oAuth2AuthorizationRequests.ts +5 -5
- package/src/services/oAuth2ClientCredentialsGranter.ts +8 -27
- package/src/services/oAuth2DeviceAuthorizationCodeGranter.test.ts +372 -0
- package/src/services/oAuth2DeviceAuthorizationGranter.ts +194 -0
- package/src/services/oAuth2Granters.ts +0 -2
- package/src/services/oAuth2PasswordGranter.ts +7 -33
- package/src/services/oAuth2RefreshTokenGranter.ts +6 -31
- package/dist/libs/schemas.d.ts +0 -31
- package/dist/libs/schemas.js +0 -33
- package/dist/libs/schemas.js.map +0 -1
- package/src/libs/schemas.ts +0 -37
package/dist/libs/schemas.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export declare const scopeTokenSchema: {
|
|
2
|
-
readonly name: "ScopeToken";
|
|
3
|
-
readonly schema: {
|
|
4
|
-
readonly description: "OAuth 2.1 scope token, see https://www.ietf.org/archive/id/draft-ietf-oauth-v2-1-15.html#name-access-token-scope";
|
|
5
|
-
readonly type: "string";
|
|
6
|
-
readonly pattern: "^[!#-[\\]-~]+$";
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
export declare const scopeTokensSchema: {
|
|
10
|
-
readonly name: "ScopeTokens";
|
|
11
|
-
readonly schema: {
|
|
12
|
-
readonly type: "array";
|
|
13
|
-
readonly items: import("ya-json-schema-types").ExpressiveJSONSchema;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export declare const scopeSchema: {
|
|
17
|
-
readonly name: "Scope";
|
|
18
|
-
readonly schema: {
|
|
19
|
-
readonly description: "OAuth 2.1 scope, see https://www.ietf.org/archive/id/draft-ietf-oauth-v2-1-15.html#name-access-token-scope";
|
|
20
|
-
readonly type: "string";
|
|
21
|
-
readonly pattern: "^[!#-[\\]-~]+(?: [!#-[\\]-~]+)*$";
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
export declare const requestURISchema: {
|
|
25
|
-
readonly name: "RequestURI";
|
|
26
|
-
readonly schema: {
|
|
27
|
-
readonly description: "OAuth2 PAR request_uri, see https://datatracker.ietf.org/doc/html/rfc9126#section-2.2.";
|
|
28
|
-
readonly type: "string";
|
|
29
|
-
readonly pattern: "^urn:ietf:params:oauth:request_uri:";
|
|
30
|
-
};
|
|
31
|
-
};
|
package/dist/libs/schemas.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { refersTo } from '@whook/whook';
|
|
2
|
-
export const scopeTokenSchema = {
|
|
3
|
-
name: 'ScopeToken',
|
|
4
|
-
schema: {
|
|
5
|
-
description: 'OAuth 2.1 scope token, see https://www.ietf.org/archive/id/draft-ietf-oauth-v2-1-15.html#name-access-token-scope',
|
|
6
|
-
type: 'string',
|
|
7
|
-
pattern: '^[!#-[\\]-~]+$',
|
|
8
|
-
},
|
|
9
|
-
};
|
|
10
|
-
export const scopeTokensSchema = {
|
|
11
|
-
name: 'ScopeTokens',
|
|
12
|
-
schema: {
|
|
13
|
-
type: 'array',
|
|
14
|
-
items: refersTo(scopeTokenSchema),
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
export const scopeSchema = {
|
|
18
|
-
name: 'Scope',
|
|
19
|
-
schema: {
|
|
20
|
-
description: 'OAuth 2.1 scope, see https://www.ietf.org/archive/id/draft-ietf-oauth-v2-1-15.html#name-access-token-scope',
|
|
21
|
-
type: 'string',
|
|
22
|
-
pattern: '^[!#-[\\]-~]+(?: [!#-[\\]-~]+)*$',
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
export const requestURISchema = {
|
|
26
|
-
name: 'RequestURI',
|
|
27
|
-
schema: {
|
|
28
|
-
description: 'OAuth2 PAR request_uri, see https://datatracker.ietf.org/doc/html/rfc9126#section-2.2.',
|
|
29
|
-
type: 'string',
|
|
30
|
-
pattern: '^urn:ietf:params:oauth:request_uri:',
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=schemas.js.map
|
package/dist/libs/schemas.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/libs/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAiC,MAAM,cAAc,CAAC;AAEvE,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE;QACN,WAAW,EACT,kHAAkH;QACpH,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,gBAAgB;KAC1B;CAC0C,CAAC;AAC9C,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,aAAa;IACnB,MAAM,EAAE;QACN,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,QAAQ,CAAC,gBAAgB,CAAC;KAClC;CAC0C,CAAC;AAC9C,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,OAAO;IACb,MAAM,EAAE;QACN,WAAW,EACT,4GAA4G;QAC9G,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,kCAAkC;KAC5C;CAC0C,CAAC;AAE9C,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE;QACN,WAAW,EACT,wFAAwF;QAC1F,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,qCAAqC;KAC/C;CAC0C,CAAC"}
|
package/src/libs/schemas.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { refersTo, type WhookAPISchemaDefinition } from '@whook/whook';
|
|
2
|
-
|
|
3
|
-
export const scopeTokenSchema = {
|
|
4
|
-
name: 'ScopeToken',
|
|
5
|
-
schema: {
|
|
6
|
-
description:
|
|
7
|
-
'OAuth 2.1 scope token, see https://www.ietf.org/archive/id/draft-ietf-oauth-v2-1-15.html#name-access-token-scope',
|
|
8
|
-
type: 'string',
|
|
9
|
-
pattern: '^[!#-[\\]-~]+$',
|
|
10
|
-
},
|
|
11
|
-
} as const satisfies WhookAPISchemaDefinition;
|
|
12
|
-
export const scopeTokensSchema = {
|
|
13
|
-
name: 'ScopeTokens',
|
|
14
|
-
schema: {
|
|
15
|
-
type: 'array',
|
|
16
|
-
items: refersTo(scopeTokenSchema),
|
|
17
|
-
},
|
|
18
|
-
} as const satisfies WhookAPISchemaDefinition;
|
|
19
|
-
export const scopeSchema = {
|
|
20
|
-
name: 'Scope',
|
|
21
|
-
schema: {
|
|
22
|
-
description:
|
|
23
|
-
'OAuth 2.1 scope, see https://www.ietf.org/archive/id/draft-ietf-oauth-v2-1-15.html#name-access-token-scope',
|
|
24
|
-
type: 'string',
|
|
25
|
-
pattern: '^[!#-[\\]-~]+(?: [!#-[\\]-~]+)*$',
|
|
26
|
-
},
|
|
27
|
-
} as const satisfies WhookAPISchemaDefinition;
|
|
28
|
-
|
|
29
|
-
export const requestURISchema = {
|
|
30
|
-
name: 'RequestURI',
|
|
31
|
-
schema: {
|
|
32
|
-
description:
|
|
33
|
-
'OAuth2 PAR request_uri, see https://datatracker.ietf.org/doc/html/rfc9126#section-2.2.',
|
|
34
|
-
type: 'string',
|
|
35
|
-
pattern: '^urn:ietf:params:oauth:request_uri:',
|
|
36
|
-
},
|
|
37
|
-
} as const satisfies WhookAPISchemaDefinition;
|