@celljs/oauth2-core 3.7.8 → 3.9.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.
Files changed (67) hide show
  1. package/esm/node/authentication/authentication-protocol.d.ts +10 -0
  2. package/esm/node/authentication/authentication-protocol.js +13 -0
  3. package/esm/node/authentication/authentication-protocol.js.map +1 -0
  4. package/esm/node/authentication/index.d.ts +1 -0
  5. package/esm/node/authentication/index.js +2 -0
  6. package/esm/node/authentication/index.js.map +1 -0
  7. package/esm/node/authorization/authorization-protocol.d.ts +11 -0
  8. package/esm/node/authorization/authorization-protocol.js +14 -0
  9. package/esm/node/authorization/authorization-protocol.js.map +1 -0
  10. package/esm/node/authorization/index.d.ts +1 -0
  11. package/esm/node/authorization/index.js +2 -0
  12. package/esm/node/authorization/index.js.map +1 -0
  13. package/esm/node/endpoint/access-token-response-converter.d.ts +16 -0
  14. package/esm/node/endpoint/access-token-response-converter.js +66 -0
  15. package/esm/node/endpoint/access-token-response-converter.js.map +1 -0
  16. package/esm/node/endpoint/endpoint-protocol.d.ts +128 -0
  17. package/esm/node/endpoint/endpoint-protocol.js +93 -0
  18. package/esm/node/endpoint/endpoint-protocol.js.map +1 -0
  19. package/esm/node/endpoint/index.d.ts +2 -0
  20. package/esm/node/endpoint/index.js +3 -0
  21. package/esm/node/endpoint/index.js.map +1 -0
  22. package/esm/node/error/error-protocol.d.ts +80 -0
  23. package/esm/node/error/error-protocol.js +82 -0
  24. package/esm/node/error/error-protocol.js.map +1 -0
  25. package/esm/node/error/error.d.ts +11 -0
  26. package/esm/node/error/error.js +15 -0
  27. package/esm/node/error/error.js.map +1 -0
  28. package/esm/node/error/index.d.ts +2 -0
  29. package/esm/node/error/index.js +3 -0
  30. package/esm/node/error/index.js.map +1 -0
  31. package/esm/node/index.d.ts +6 -0
  32. package/esm/node/index.js +7 -0
  33. package/esm/node/index.js.map +1 -0
  34. package/esm/node/module.d.ts +3 -0
  35. package/esm/node/module.js +4 -0
  36. package/esm/node/module.js.map +1 -0
  37. package/esm/node/oidc/index.d.ts +1 -0
  38. package/esm/node/oidc/index.js +2 -0
  39. package/esm/node/oidc/index.js.map +1 -0
  40. package/esm/node/oidc/oidc-protocol.d.ts +116 -0
  41. package/esm/node/oidc/oidc-protocol.js +120 -0
  42. package/esm/node/oidc/oidc-protocol.js.map +1 -0
  43. package/esm/node/token/index.d.ts +1 -0
  44. package/esm/node/token/index.js +2 -0
  45. package/esm/node/token/index.js.map +1 -0
  46. package/esm/node/token/token-protocol.d.ts +65 -0
  47. package/esm/node/token/token-protocol.js +57 -0
  48. package/esm/node/token/token-protocol.js.map +1 -0
  49. package/esm/package.json +3 -0
  50. package/lib/node/authentication/authentication-protocol.js.map +1 -1
  51. package/lib/node/authorization/authorization-protocol.js.map +1 -1
  52. package/lib/node/endpoint/access-token-response-converter.d.ts.map +1 -1
  53. package/lib/node/endpoint/access-token-response-converter.js.map +1 -1
  54. package/lib/node/endpoint/endpoint-protocol.js.map +1 -1
  55. package/lib/node/error/error-protocol.js.map +1 -1
  56. package/lib/node/error/error.d.ts.map +1 -1
  57. package/lib/node/error/error.js.map +1 -1
  58. package/lib/node/module.d.ts.map +1 -1
  59. package/lib/node/module.js.map +1 -1
  60. package/lib/node/oidc/oidc-protocol.js.map +1 -1
  61. package/lib/node/token/token-protocol.js.map +1 -1
  62. package/lib/package.spec.d.ts +1 -0
  63. package/lib/package.spec.js +5 -2
  64. package/lib/package.spec.js.map +1 -1
  65. package/package.json +63 -11
  66. package/src/package.spec.ts +1 -0
  67. package/LICENSE +0 -21
@@ -0,0 +1,10 @@
1
+ export declare enum AuthenticationMethod {
2
+ Header = "header",
3
+ Form = "form",
4
+ Query = "query"
5
+ }
6
+ export declare enum ClientAuthenticationMethod {
7
+ Basic = "basic",
8
+ Post = "post",
9
+ None = "none"
10
+ }
@@ -0,0 +1,13 @@
1
+ export var AuthenticationMethod;
2
+ (function (AuthenticationMethod) {
3
+ AuthenticationMethod["Header"] = "header";
4
+ AuthenticationMethod["Form"] = "form";
5
+ AuthenticationMethod["Query"] = "query";
6
+ })(AuthenticationMethod || (AuthenticationMethod = {}));
7
+ export var ClientAuthenticationMethod;
8
+ (function (ClientAuthenticationMethod) {
9
+ ClientAuthenticationMethod["Basic"] = "basic";
10
+ ClientAuthenticationMethod["Post"] = "post";
11
+ ClientAuthenticationMethod["None"] = "none";
12
+ })(ClientAuthenticationMethod || (ClientAuthenticationMethod = {}));
13
+ //# sourceMappingURL=authentication-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication-protocol.js","sourceRoot":"","sources":["../../../src/node/authentication/authentication-protocol.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC5B,yCAAiB,CAAA;IACjB,qCAAa,CAAA;IACb,uCAAe,CAAA;AACnB,CAAC,EAJW,oBAAoB,KAApB,oBAAoB,QAI/B;AAED,MAAM,CAAN,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IAClC,6CAAe,CAAA;IACf,2CAAa,CAAA;IACb,2CAAa,CAAA;AACjB,CAAC,EAJW,0BAA0B,KAA1B,0BAA0B,QAIrC"}
@@ -0,0 +1 @@
1
+ export * from './authentication-protocol.js';
@@ -0,0 +1,2 @@
1
+ export * from './authentication-protocol.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/authentication/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,11 @@
1
+ export declare enum AuthorizationGrantType {
2
+ AuthorizationCode = "authorization_code",
3
+ Implicit = "implicit",
4
+ RefreshToken = "refresh_token",
5
+ ClientCredentials = "client_credentials",
6
+ Password = "password"
7
+ }
8
+ export declare enum AuthorizationResponseType {
9
+ Code = "code",
10
+ Token = "token"
11
+ }
@@ -0,0 +1,14 @@
1
+ export var AuthorizationGrantType;
2
+ (function (AuthorizationGrantType) {
3
+ AuthorizationGrantType["AuthorizationCode"] = "authorization_code";
4
+ AuthorizationGrantType["Implicit"] = "implicit";
5
+ AuthorizationGrantType["RefreshToken"] = "refresh_token";
6
+ AuthorizationGrantType["ClientCredentials"] = "client_credentials";
7
+ AuthorizationGrantType["Password"] = "password";
8
+ })(AuthorizationGrantType || (AuthorizationGrantType = {}));
9
+ export var AuthorizationResponseType;
10
+ (function (AuthorizationResponseType) {
11
+ AuthorizationResponseType["Code"] = "code";
12
+ AuthorizationResponseType["Token"] = "token";
13
+ })(AuthorizationResponseType || (AuthorizationResponseType = {}));
14
+ //# sourceMappingURL=authorization-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization-protocol.js","sourceRoot":"","sources":["../../../src/node/authorization/authorization-protocol.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,sBAMX;AAND,WAAY,sBAAsB;IAC9B,kEAAwC,CAAA;IACxC,+CAAqB,CAAA;IACrB,wDAA8B,CAAA;IAC9B,kEAAwC,CAAA;IACxC,+CAAqB,CAAA;AACzB,CAAC,EANW,sBAAsB,KAAtB,sBAAsB,QAMjC;AAED,MAAM,CAAN,IAAY,yBAGX;AAHD,WAAY,yBAAyB;IACjC,0CAAa,CAAA;IACb,4CAAe,CAAA;AACnB,CAAC,EAHW,yBAAyB,KAAzB,yBAAyB,QAGpC"}
@@ -0,0 +1 @@
1
+ export * from './authorization-protocol.js';
@@ -0,0 +1,2 @@
1
+ export * from './authorization-protocol.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/authorization/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { TokenType } from '../token/index.js';
2
+ import { AccessTokenResponse } from './endpoint-protocol.js';
3
+ export declare class AccessTokenResponseConverter {
4
+ convert(tokenResponse: {
5
+ [key: string]: string;
6
+ }): AccessTokenResponse;
7
+ protected getScopes(tokenResponse: {
8
+ [key: string]: string;
9
+ }): string[];
10
+ protected getExpiresIn(tokenResponse: {
11
+ [key: string]: string;
12
+ }): number;
13
+ protected getAccessTokenType(tokenResponse: {
14
+ [key: string]: string;
15
+ }): TokenType.Bearer | undefined;
16
+ }
@@ -0,0 +1,66 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { TokenType } from '../token/index.js';
8
+ import { OAuth2ParameterNames } from './endpoint-protocol.js';
9
+ import { Component } from '@celljs/core';
10
+ let AccessTokenResponseConverter = class AccessTokenResponseConverter {
11
+ convert(tokenResponse) {
12
+ const accessToken = tokenResponse[OAuth2ParameterNames.ACCESS_TOKEN];
13
+ const tokenType = this.getAccessTokenType(tokenResponse);
14
+ const expiresIn = this.getExpiresIn(tokenResponse);
15
+ const scopes = this.getScopes(tokenResponse);
16
+ const refreshToken = tokenResponse[OAuth2ParameterNames.REFRESH_TOKEN];
17
+ const checkParameters = [
18
+ OAuth2ParameterNames.ACCESS_TOKEN,
19
+ OAuth2ParameterNames.EXPIRES_IN,
20
+ OAuth2ParameterNames.REFRESH_TOKEN,
21
+ OAuth2ParameterNames.SCOPE,
22
+ OAuth2ParameterNames.TOKEN_TYPE
23
+ ];
24
+ const additionalParameters = {};
25
+ for (const key in tokenResponse) {
26
+ if (Object.prototype.hasOwnProperty.call(tokenResponse, key) && !checkParameters.includes(key)) {
27
+ additionalParameters[key] = tokenResponse[key];
28
+ }
29
+ }
30
+ const issuedAt = Date.now();
31
+ const expiresAt = expiresIn > 0 ? issuedAt + 1000 * expiresIn : issuedAt + 1000;
32
+ return {
33
+ accessToken: {
34
+ tokenType,
35
+ issuedAt,
36
+ expiresAt,
37
+ tokenValue: accessToken,
38
+ scopes
39
+ },
40
+ refreshToken: refreshToken ? { tokenValue: refreshToken, issuedAt } : undefined,
41
+ additionalParameters
42
+ };
43
+ }
44
+ getScopes(tokenResponse) {
45
+ if (tokenResponse[OAuth2ParameterNames.SCOPE]) {
46
+ return tokenResponse[OAuth2ParameterNames.SCOPE].split(' ');
47
+ }
48
+ return [];
49
+ }
50
+ getExpiresIn(tokenResponse) {
51
+ if (tokenResponse[OAuth2ParameterNames.EXPIRES_IN]) {
52
+ return parseInt(tokenResponse[OAuth2ParameterNames.EXPIRES_IN]);
53
+ }
54
+ return 0;
55
+ }
56
+ getAccessTokenType(tokenResponse) {
57
+ if (TokenType.Bearer.toUpperCase() === (tokenResponse[OAuth2ParameterNames.TOKEN_TYPE] || '').toUpperCase()) {
58
+ return TokenType.Bearer;
59
+ }
60
+ }
61
+ };
62
+ AccessTokenResponseConverter = __decorate([
63
+ Component(AccessTokenResponseConverter)
64
+ ], AccessTokenResponseConverter);
65
+ export { AccessTokenResponseConverter };
66
+ //# sourceMappingURL=access-token-response-converter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access-token-response-converter.js","sourceRoot":"","sources":["../../../src/node/endpoint/access-token-response-converter.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAuB,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGlC,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IACrC,OAAO,CAAC,aAAwC;QAC5C,MAAM,WAAW,GAAG,aAAa,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;QACrE,MAAM,SAAS,GAAG,IAAI,CAAC,kB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AoB,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5C,OAAO,aAAa,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAChE,CAAC;QACD,OAAO,EAAE,CAAC;IACd,CAAC;IAES,YAAY,CAAC,aAAyC;QAC5D,IAAI,aAAa,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,CAAC;YACjD,OAAO,QAAQ,CAAC,aAAa,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC;QACpE,CAAC;QACD,OAAO,CAAC,CAAC;IACb,CAAC;IAES,kBAAkB,CAAC,aAAyC;QAClE,IAAI,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,aAAa,CAAC,oBAAoB,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;YAC1G,OAAO,SAAS,CAAC,MAAM,CAAC;QAC5B,CAAC;IACL,CAAC;CACJ,CAAA;AA1DY,4BAA4B;IADxC,SAAS,CAAC,4BAA4B,CAAC;GAC3B,4BAA4B,CA0DxC"}
@@ -0,0 +1,128 @@
1
+ import { AuthorizationGrantType, AuthorizationResponseType } from '../authorization/index.js';
2
+ import { RefreshToken, AccessToken } from '../token/index.js';
3
+ export declare namespace OAuth2ParameterNames {
4
+ /**
5
+ * used in Access Token Request.
6
+ */
7
+ const GRANT_TYPE = "grant_type";
8
+ /**
9
+ * used in Authorization Request.
10
+ */
11
+ const RESPONSE_TYPE = "response_type";
12
+ /**
13
+ * used in Authorization Request and Access Token Request.
14
+ */
15
+ const CLIENT_ID = "client_id";
16
+ /**
17
+ * used in Access Token Request.
18
+ */
19
+ const CLIENT_SECRET = "client_secret";
20
+ /**
21
+ * used in Authorization Request and Access Token Request.
22
+ */
23
+ const REDIRECT_URI = "redirect_uri";
24
+ /**
25
+ * used in Authorization Request, Authorization Response, Access Token Request and Access Token Response.
26
+ */
27
+ const SCOPE = "scope";
28
+ /**
29
+ * used in Authorization Request and Authorization Response.
30
+ */
31
+ const STATE = "state";
32
+ /**
33
+ * used in Authorization Response and Access Token Request.
34
+ */
35
+ const CODE = "code";
36
+ /**
37
+ * used in Authorization Response and Access Token Response.
38
+ */
39
+ const ACCESS_TOKEN = "access_token";
40
+ /**
41
+ * used in Authorization Response and Access Token Response.
42
+ */
43
+ const TOKEN_TYPE = "token_type";
44
+ /**
45
+ * used in Authorization Response and Access Token Response.
46
+ */
47
+ const EXPIRES_IN = "expires_in";
48
+ /**
49
+ * used in Access Token Request and Access Token Response.
50
+ */
51
+ const REFRESH_TOKEN = "refresh_token";
52
+ /**
53
+ * used in Access Token Request.
54
+ */
55
+ const USERNAME = "username";
56
+ /**
57
+ * used in Access Token Request.
58
+ */
59
+ const PASSWORD = "password";
60
+ /**
61
+ * used in Authorization Response and Access Token Response.
62
+ */
63
+ const ERROR = "error";
64
+ /**
65
+ * used in Authorization Response and Access Token Response.
66
+ */
67
+ const ERROR_DESCRIPTION = "error_description";
68
+ /**
69
+ * used in Authorization Response and Access Token Response.
70
+ */
71
+ const ERROR_URI = "error_uri";
72
+ /**
73
+ * Non-standard parameter (used internally).
74
+ */
75
+ const REGISTRATION_ID = "registration_id";
76
+ }
77
+ export declare namespace PkceParameterNames {
78
+ /**
79
+ * `code_challenge`- used in Authorization Request.
80
+ */
81
+ const CODE_CHALLENGE = "code_challenge";
82
+ /**
83
+ * `code_challenge_method`- used in Authorization Request.
84
+ */
85
+ const CODE_CHALLENGE_METHOD = "code_challenge_method";
86
+ /**
87
+ * `code_verifier`- used in Token Request.
88
+ */
89
+ const CODE_VERIFIER = "code_verifier";
90
+ }
91
+ export interface AuthorizationRequest {
92
+ authorizationUri: string;
93
+ authorizationGrantType: AuthorizationGrantType;
94
+ responseType: AuthorizationResponseType;
95
+ clientId: string;
96
+ redirectUri: string;
97
+ scopes: string[];
98
+ state: string;
99
+ additionalParameters: {
100
+ [key: string]: any;
101
+ };
102
+ authorizationRequestUri: string;
103
+ attributes: {
104
+ [key: string]: any;
105
+ };
106
+ }
107
+ export interface AuthorizationResponse {
108
+ redirectUri: string;
109
+ state: string;
110
+ code: string;
111
+ error: OAuth2Error;
112
+ }
113
+ export interface OAuth2Error {
114
+ errorCode: string;
115
+ description?: string;
116
+ uri?: string;
117
+ }
118
+ export interface AuthorizationExchange {
119
+ authorizationRequest: AuthorizationRequest;
120
+ authorizationResponse: AuthorizationResponse;
121
+ }
122
+ export declare class AccessTokenResponse {
123
+ accessToken: AccessToken;
124
+ refreshToken?: RefreshToken;
125
+ additionalParameters: {
126
+ [key: string]: any;
127
+ };
128
+ }
@@ -0,0 +1,93 @@
1
+ export var OAuth2ParameterNames;
2
+ (function (OAuth2ParameterNames) {
3
+ /**
4
+ * used in Access Token Request.
5
+ */
6
+ OAuth2ParameterNames.GRANT_TYPE = 'grant_type';
7
+ /**
8
+ * used in Authorization Request.
9
+ */
10
+ OAuth2ParameterNames.RESPONSE_TYPE = 'response_type';
11
+ /**
12
+ * used in Authorization Request and Access Token Request.
13
+ */
14
+ OAuth2ParameterNames.CLIENT_ID = 'client_id';
15
+ /**
16
+ * used in Access Token Request.
17
+ */
18
+ OAuth2ParameterNames.CLIENT_SECRET = 'client_secret';
19
+ /**
20
+ * used in Authorization Request and Access Token Request.
21
+ */
22
+ OAuth2ParameterNames.REDIRECT_URI = 'redirect_uri';
23
+ /**
24
+ * used in Authorization Request, Authorization Response, Access Token Request and Access Token Response.
25
+ */
26
+ OAuth2ParameterNames.SCOPE = 'scope';
27
+ /**
28
+ * used in Authorization Request and Authorization Response.
29
+ */
30
+ OAuth2ParameterNames.STATE = 'state';
31
+ /**
32
+ * used in Authorization Response and Access Token Request.
33
+ */
34
+ OAuth2ParameterNames.CODE = 'code';
35
+ /**
36
+ * used in Authorization Response and Access Token Response.
37
+ */
38
+ OAuth2ParameterNames.ACCESS_TOKEN = 'access_token';
39
+ /**
40
+ * used in Authorization Response and Access Token Response.
41
+ */
42
+ OAuth2ParameterNames.TOKEN_TYPE = 'token_type';
43
+ /**
44
+ * used in Authorization Response and Access Token Response.
45
+ */
46
+ OAuth2ParameterNames.EXPIRES_IN = 'expires_in';
47
+ /**
48
+ * used in Access Token Request and Access Token Response.
49
+ */
50
+ OAuth2ParameterNames.REFRESH_TOKEN = 'refresh_token';
51
+ /**
52
+ * used in Access Token Request.
53
+ */
54
+ OAuth2ParameterNames.USERNAME = 'username';
55
+ /**
56
+ * used in Access Token Request.
57
+ */
58
+ OAuth2ParameterNames.PASSWORD = 'password';
59
+ /**
60
+ * used in Authorization Response and Access Token Response.
61
+ */
62
+ OAuth2ParameterNames.ERROR = 'error';
63
+ /**
64
+ * used in Authorization Response and Access Token Response.
65
+ */
66
+ OAuth2ParameterNames.ERROR_DESCRIPTION = 'error_description';
67
+ /**
68
+ * used in Authorization Response and Access Token Response.
69
+ */
70
+ OAuth2ParameterNames.ERROR_URI = 'error_uri';
71
+ /**
72
+ * Non-standard parameter (used internally).
73
+ */
74
+ OAuth2ParameterNames.REGISTRATION_ID = 'registration_id';
75
+ })(OAuth2ParameterNames || (OAuth2ParameterNames = {}));
76
+ export var PkceParameterNames;
77
+ (function (PkceParameterNames) {
78
+ /**
79
+ * `code_challenge`- used in Authorization Request.
80
+ */
81
+ PkceParameterNames.CODE_CHALLENGE = 'code_challenge';
82
+ /**
83
+ * `code_challenge_method`- used in Authorization Request.
84
+ */
85
+ PkceParameterNames.CODE_CHALLENGE_METHOD = 'code_challenge_method';
86
+ /**
87
+ * `code_verifier`- used in Token Request.
88
+ */
89
+ PkceParameterNames.CODE_VERIFIER = 'code_verifier';
90
+ })(PkceParameterNames || (PkceParameterNames = {}));
91
+ export class AccessTokenResponse {
92
+ }
93
+ //# sourceMappingURL=endpoint-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoint-protocol.js","sourceRoot":"","sources":["../../../src/node/endpoint/endpoint-protocol.ts"],"names":[],"mappings":"AAGA,MAAM,KAAW,oBAAoB,CA2FpC;AA3FD,WAA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+1,3 @@
1
+ export * from './endpoint-protocol.js';
2
+ export * from './access-token-response-converter.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/endpoint/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mCAAmC,CAAC"}
@@ -0,0 +1,80 @@
1
+ export declare enum OAuth2ErrorCodes {
2
+ /**
3
+ * `invalid_request` - The request is missing a required parameter,
4
+ * includes an invalid parameter value,
5
+ * includes a parameter more than once, or is otherwise malformed.
6
+ */
7
+ INVALID_REQUEST = "invalid_request",
8
+ /**
9
+ * `unauthorized_client` - The client is not authorized to request
10
+ * an authorization code or access token using this method.
11
+ */
12
+ UNAUTHORIZED_CLIENT = "unauthorized_client",
13
+ /**
14
+ * `access_denied` - The resource owner or authorization server denied the request.
15
+ */
16
+ ACCESS_DENIED = "access_denied",
17
+ /**
18
+ * `unsupported_response_type` - The authorization server does not support
19
+ * obtaining an authorization code or access token using this method.
20
+ */
21
+ UNSUPPORTED_RESPONSE_TYPE = "unsupported_response_type",
22
+ /**
23
+ * `invalid_scope` - The requested scope is invalid, unknown, malformed or
24
+ * exceeds the scope granted by the resource owner.
25
+ */
26
+ INVALID_SCOPE = "invalid_scope",
27
+ /**
28
+ * `insufficient_scope` - The request requires higher privileges than
29
+ * provided by the access token.
30
+ * The resource server SHOULD respond with the HTTP 403 (Forbidden)
31
+ * status code and MAY include the 'scope' attribute with the scope
32
+ * necessary to access the protected resource.
33
+ *
34
+ * @see <a href='https://tools.ietf.org/html/rfc6750#section-3.1'>RFC-6750 - Section 3.1 - Error Codes</a>
35
+ */
36
+ INSUFFICIENT_SCOPE = "insufficient_scope",
37
+ /**
38
+ * `invalid_token` - The access token provided is expired, revoked,
39
+ * malformed, or invalid for other reasons.
40
+ * The resource SHOULD respond with the HTTP 401 (Unauthorized) status code.
41
+ * The client MAY request a new access token and retry the protected resource request.
42
+ *
43
+ * @see <a href='https://tools.ietf.org/html/rfc6750#section-3.1'>RFC-6750 - Section 3.1 - Error Codes</a>
44
+ */
45
+ INVALID_TOKEN = "invalid_token",
46
+ /**
47
+ * `server_error` - The authorization server encountered an
48
+ * unexpected condition that prevented it from fulfilling the request.
49
+ * (This error code is needed because a 500 Internal Server Error HTTP status code
50
+ * cannot be returned to the client via a HTTP redirect.)
51
+ */
52
+ SERVER_ERROR = "server_error",
53
+ /**
54
+ * `temporarily_unavailable` - The authorization server is currently unable
55
+ * to handle the request due to a temporary overloading or maintenance of the server.
56
+ * (This error code is needed because a 503 Service Unavailable HTTP status code
57
+ * cannot be returned to the client via an HTTP redirect.)
58
+ */
59
+ TEMPORARILY_UNAVAILABLE = "temporarily_unavailable",
60
+ /**
61
+ * `invalid_client` - Client authentication failed (e.g., unknown client,
62
+ * no client authentication included, or unsupported authentication method).
63
+ * The authorization server MAY return a HTTP 401 (Unauthorized) status code
64
+ * to indicate which HTTP authentication schemes are supported.
65
+ * If the client attempted to authenticate via the &quot;Authorization&quot; request header field,
66
+ * the authorization server MUST respond with a HTTP 401 (Unauthorized) status code and
67
+ * include the &quot;WWW-Authenticate&quot; response header field matching the authentication scheme used by the client.
68
+ */
69
+ INVALID_CLIENT = "invalid_client",
70
+ /**
71
+ * `invalid_grant` - The provided authorization grant
72
+ * (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked,
73
+ * does not match the redirection URI used in the authorization request, or was issued to another client.
74
+ */
75
+ INVALID_GRANT = "invalid_grant",
76
+ /**
77
+ * `unsupported_grant_type` - The authorization grant type is not supported by the authorization server.
78
+ */
79
+ UNSUPPORTED_GRANT_TYPE = "unsupported_grant_type"
80
+ }
@@ -0,0 +1,82 @@
1
+ export var OAuth2ErrorCodes;
2
+ (function (OAuth2ErrorCodes) {
3
+ /**
4
+ * `invalid_request` - The request is missing a required parameter,
5
+ * includes an invalid parameter value,
6
+ * includes a parameter more than once, or is otherwise malformed.
7
+ */
8
+ OAuth2ErrorCodes["INVALID_REQUEST"] = "invalid_request";
9
+ /**
10
+ * `unauthorized_client` - The client is not authorized to request
11
+ * an authorization code or access token using this method.
12
+ */
13
+ OAuth2ErrorCodes["UNAUTHORIZED_CLIENT"] = "unauthorized_client";
14
+ /**
15
+ * `access_denied` - The resource owner or authorization server denied the request.
16
+ */
17
+ OAuth2ErrorCodes["ACCESS_DENIED"] = "access_denied";
18
+ /**
19
+ * `unsupported_response_type` - The authorization server does not support
20
+ * obtaining an authorization code or access token using this method.
21
+ */
22
+ OAuth2ErrorCodes["UNSUPPORTED_RESPONSE_TYPE"] = "unsupported_response_type";
23
+ /**
24
+ * `invalid_scope` - The requested scope is invalid, unknown, malformed or
25
+ * exceeds the scope granted by the resource owner.
26
+ */
27
+ OAuth2ErrorCodes["INVALID_SCOPE"] = "invalid_scope";
28
+ /**
29
+ * `insufficient_scope` - The request requires higher privileges than
30
+ * provided by the access token.
31
+ * The resource server SHOULD respond with the HTTP 403 (Forbidden)
32
+ * status code and MAY include the 'scope' attribute with the scope
33
+ * necessary to access the protected resource.
34
+ *
35
+ * @see <a href='https://tools.ietf.org/html/rfc6750#section-3.1'>RFC-6750 - Section 3.1 - Error Codes</a>
36
+ */
37
+ OAuth2ErrorCodes["INSUFFICIENT_SCOPE"] = "insufficient_scope";
38
+ /**
39
+ * `invalid_token` - The access token provided is expired, revoked,
40
+ * malformed, or invalid for other reasons.
41
+ * The resource SHOULD respond with the HTTP 401 (Unauthorized) status code.
42
+ * The client MAY request a new access token and retry the protected resource request.
43
+ *
44
+ * @see <a href='https://tools.ietf.org/html/rfc6750#section-3.1'>RFC-6750 - Section 3.1 - Error Codes</a>
45
+ */
46
+ OAuth2ErrorCodes["INVALID_TOKEN"] = "invalid_token";
47
+ /**
48
+ * `server_error` - The authorization server encountered an
49
+ * unexpected condition that prevented it from fulfilling the request.
50
+ * (This error code is needed because a 500 Internal Server Error HTTP status code
51
+ * cannot be returned to the client via a HTTP redirect.)
52
+ */
53
+ OAuth2ErrorCodes["SERVER_ERROR"] = "server_error";
54
+ /**
55
+ * `temporarily_unavailable` - The authorization server is currently unable
56
+ * to handle the request due to a temporary overloading or maintenance of the server.
57
+ * (This error code is needed because a 503 Service Unavailable HTTP status code
58
+ * cannot be returned to the client via an HTTP redirect.)
59
+ */
60
+ OAuth2ErrorCodes["TEMPORARILY_UNAVAILABLE"] = "temporarily_unavailable";
61
+ /**
62
+ * `invalid_client` - Client authentication failed (e.g., unknown client,
63
+ * no client authentication included, or unsupported authentication method).
64
+ * The authorization server MAY return a HTTP 401 (Unauthorized) status code
65
+ * to indicate which HTTP authentication schemes are supported.
66
+ * If the client attempted to authenticate via the &quot;Authorization&quot; request header field,
67
+ * the authorization server MUST respond with a HTTP 401 (Unauthorized) status code and
68
+ * include the &quot;WWW-Authenticate&quot; response header field matching the authentication scheme used by the client.
69
+ */
70
+ OAuth2ErrorCodes["INVALID_CLIENT"] = "invalid_client";
71
+ /**
72
+ * `invalid_grant` - The provided authorization grant
73
+ * (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked,
74
+ * does not match the redirection URI used in the authorization request, or was issued to another client.
75
+ */
76
+ OAuth2ErrorCodes["INVALID_GRANT"] = "invalid_grant";
77
+ /**
78
+ * `unsupported_grant_type` - The authorization grant type is not supported by the authorization server.
79
+ */
80
+ OAuth2ErrorCodes["UNSUPPORTED_GRANT_TYPE"] = "unsupported_grant_type";
81
+ })(OAuth2ErrorCodes || (OAuth2ErrorCodes = {}));
82
+ //# sourceMappingURL=error-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-protocol.js","sourceRoot":"","sources":["../../../src/node/error/error-protocol.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,gBA4FX;AA5FD,WAAY,gBAAgB;IAExB;;;;OAIG;IACH,uDAAmC,CAAA;IAEnC;;;OAGG;IACH,+DAA2C,CAAA;IAE3C;;OAEG;IACH,mDAA+B,CAAA;IAE/B;;;OAGG;IACH,2EAAuD,CAAA;IAEvD;;;OAGG;IACH,mDAA+B,CAAA;IAE/B;;;;;;;;OAQG;IACH,6DAAyC,CAAA;IAEzC;;;;;;;OAOG;IACH,mDAA+B,CAAA;IAE/B;;;;;OAKG;IACH,iDAA6B,CAAA;IAE7B;;;;;OAKG;IACH,uEAAmD,CAAA;IAEnD;;;;;;;;OAQG;IACH,qDAAiC,CAAA;IAEjC;;;;OAIG;IACH,mDAA+B,CAAA;IAE/B;;OAEG;IACH,qEAAiD,CAAA;AAErD,CAAC,EA5FW,gBAAgB,KAAhB,gBAAgB,QA4F3B"}
@@ -0,0 +1,11 @@
1
+ import { CustomError } from '@celljs/core';
2
+ import { OAuth2Error } from '../endpoint/index.js';
3
+ import { AuthenticationError } from '@celljs/security/lib/node';
4
+ export declare class OAuth2AuthorizationError extends CustomError {
5
+ oauth2Error: OAuth2Error;
6
+ constructor(oauth2Error: OAuth2Error, error?: Error);
7
+ }
8
+ export declare class OAuth2AuthenticationError extends AuthenticationError {
9
+ oauth2Error: OAuth2Error;
10
+ constructor(oauth2Error: OAuth2Error, error?: Error);
11
+ }
@@ -0,0 +1,15 @@
1
+ import { CustomError } from '@celljs/core';
2
+ import { AuthenticationError } from '@celljs/security/lib/node';
3
+ export class OAuth2AuthorizationError extends CustomError {
4
+ constructor(oauth2Error, error) {
5
+ super(error ? error.message : oauth2Error.description);
6
+ this.oauth2Error = oauth2Error;
7
+ }
8
+ }
9
+ export class OAuth2AuthenticationError extends AuthenticationError {
10
+ constructor(oauth2Error, error) {
11
+ super(error ? error.message : oauth2Error.description);
12
+ this.oauth2Error = oauth2Error;
13
+ }
14
+ }
15
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/node/error/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,MAAM,OAAO,wBAAyB,SAAQ,WAAW;IAErD,YAAmB,WAAwB,EAAE,KAAa;QACtD,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;2BADxC,WAAW;IAE9B,CAAC;CAEJ;AAED,MAAM,OAAO,yBAA0B,SAAQ,mBAAmB;IAE9D,YAAmB,WAAwB,EAAE,KAAa;QACtD,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;2BADxC,WAAW;IAE9B,CAAC;CAEJ"}
@@ -0,0 +1,2 @@
1
+ export * from './error.js';
2
+ export * from './error-protocol.js';
@@ -0,0 +1,3 @@
1
+ export * from './error.js';
2
+ export * from './error-protocol.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/error/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './authentication/index.js';
2
+ export * from './authorization/index.js';
3
+ export * from './endpoint/index.js';
4
+ export * from './oidc/index.js';
5
+ export * from './token/index.js';
6
+ export * from './error/index.js';
@@ -0,0 +1,7 @@
1
+ export * from './authentication/index.js';
2
+ export * from './authorization/index.js';
3
+ export * from './endpoint/index.js';
4
+ export * from './oidc/index.js';
5
+ export * from './token/index.js';
6
+ export * from './error/index.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}