@aura-stack/auth 0.4.0-rc.5 → 0.5.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/dist/@types/index.d.ts +8 -3
- package/dist/@types/router.d.cjs +0 -17
- package/dist/@types/router.d.d.ts +7 -2
- package/dist/@types/router.d.js +0 -1
- package/dist/actions/callback/access-token.cjs +130 -71
- package/dist/actions/callback/access-token.d.ts +9 -4
- package/dist/actions/callback/access-token.js +3 -4
- package/dist/actions/callback/callback.cjs +428 -152
- package/dist/actions/callback/callback.d.ts +11 -3
- package/dist/actions/callback/callback.js +12 -10
- package/dist/actions/callback/userinfo.cjs +159 -65
- package/dist/actions/callback/userinfo.d.ts +8 -3
- package/dist/actions/callback/userinfo.js +7 -6
- package/dist/actions/csrfToken/csrfToken.cjs +70 -19
- package/dist/actions/csrfToken/csrfToken.js +8 -7
- package/dist/actions/index.cjs +780 -348
- package/dist/actions/index.d.ts +6 -2
- package/dist/actions/index.js +23 -18
- package/dist/actions/session/session.cjs +107 -26
- package/dist/actions/session/session.js +7 -5
- package/dist/actions/signIn/authorization-url.cjs +288 -0
- package/dist/actions/signIn/authorization-url.d.ts +31 -0
- package/dist/actions/signIn/authorization-url.js +16 -0
- package/dist/actions/signIn/authorization.cjs +209 -211
- package/dist/actions/signIn/authorization.d.ts +32 -21
- package/dist/actions/signIn/authorization.js +12 -9
- package/dist/actions/signIn/signIn.cjs +470 -235
- package/dist/actions/signIn/signIn.d.ts +12 -3
- package/dist/actions/signIn/signIn.js +11 -8
- package/dist/actions/signOut/signOut.cjs +376 -228
- package/dist/actions/signOut/signOut.d.ts +1 -1
- package/dist/actions/signOut/signOut.js +10 -9
- package/dist/api/createApi.cjs +750 -0
- package/dist/api/createApi.d.ts +12 -0
- package/dist/api/createApi.js +19 -0
- package/dist/api/getSession.cjs +141 -0
- package/dist/api/getSession.d.ts +16 -0
- package/dist/api/getSession.js +10 -0
- package/dist/api/signIn.cjs +549 -0
- package/dist/api/signIn.d.ts +26 -0
- package/dist/api/signIn.js +15 -0
- package/dist/api/signOut.cjs +279 -0
- package/dist/api/signOut.d.ts +16 -0
- package/dist/api/signOut.js +13 -0
- package/dist/assert.cjs +150 -5
- package/dist/assert.d.ts +26 -3
- package/dist/assert.js +17 -3
- package/dist/{chunk-YRCB5FLE.js → chunk-2A5B7GWR.js} +52 -6
- package/dist/chunk-2GQLSIJ2.js +40 -0
- package/dist/chunk-2IR674WX.js +44 -0
- package/dist/chunk-3J5TUH2I.js +50 -0
- package/dist/chunk-4RWSYUKX.js +98 -0
- package/dist/chunk-4YHJ4IEQ.js +25 -0
- package/dist/chunk-54CZPKR4.js +25 -0
- package/dist/chunk-5LZ7TOM3.js +25 -0
- package/dist/chunk-7BE46WWS.js +88 -0
- package/dist/chunk-7YYXFKLR.js +35 -0
- package/dist/chunk-C3A37LQC.js +33 -0
- package/dist/chunk-CITNGXDA.js +31 -0
- package/dist/chunk-CWX724AG.js +78 -0
- package/dist/chunk-D2CSIUKP.js +74 -0
- package/dist/chunk-E6G5YCI6.js +25 -0
- package/dist/chunk-EBAMFRB7.js +34 -0
- package/dist/chunk-EEE7UM5T.js +25 -0
- package/dist/{chunk-HT4YLL7N.js → chunk-FPCVZUVG.js} +10 -8
- package/dist/chunk-FW4W3REU.js +25 -0
- package/dist/chunk-GNNBM2WJ.js +83 -0
- package/dist/chunk-IPKO6UQN.js +25 -0
- package/dist/chunk-JOCGX3RP.js +59 -0
- package/dist/chunk-KBXWTD6E.js +94 -0
- package/dist/chunk-KMMAZFSJ.js +25 -0
- package/dist/chunk-LATR3NIV.js +117 -0
- package/dist/chunk-LAYPUDQF.js +39 -0
- package/dist/chunk-LDU7A2JE.js +25 -0
- package/dist/chunk-LX3TJ2TJ.js +294 -0
- package/dist/chunk-NHZBQNRR.js +143 -0
- package/dist/chunk-OVHNRULD.js +33 -0
- package/dist/chunk-PDP3PHB3.js +127 -0
- package/dist/chunk-PHYNROD4.js +47 -0
- package/dist/chunk-QQEKY4XP.js +29 -0
- package/dist/chunk-U4RK4LKJ.js +348 -0
- package/dist/{chunk-RRLIF4PQ.js → chunk-U5663F2U.js} +16 -1
- package/dist/chunk-UN7X6SU5.js +53 -0
- package/dist/chunk-UZQJJD6A.js +100 -0
- package/dist/chunk-V6LLEAR4.js +80 -0
- package/dist/chunk-WHNDRO3N.js +50 -0
- package/dist/{chunk-W6LG7BFW.js → chunk-XY5R3EHH.js} +30 -23
- package/dist/client/client.cjs +135 -0
- package/dist/client/client.d.ts +85 -0
- package/dist/client/client.js +9 -0
- package/dist/client/index.cjs +135 -0
- package/dist/client/index.d.ts +14 -0
- package/dist/client/index.js +10 -0
- package/dist/context.cjs +1237 -0
- package/dist/context.d.ts +16 -0
- package/dist/context.js +28 -0
- package/dist/cookie.cjs +57 -22
- package/dist/cookie.d.ts +11 -6
- package/dist/cookie.js +3 -2
- package/dist/createAuth.cjs +2320 -0
- package/dist/createAuth.d.ts +12 -0
- package/dist/createAuth.js +48 -0
- package/dist/env.cjs +78 -0
- package/dist/env.d.ts +10 -0
- package/dist/env.js +12 -0
- package/dist/errors.cjs +17 -0
- package/dist/errors.d.ts +15 -4
- package/dist/errors.js +5 -1
- package/dist/headers.cjs +28 -2
- package/dist/headers.d.ts +25 -1
- package/dist/headers.js +9 -3
- package/dist/index-_aXtxb_s.d.ts +1377 -0
- package/dist/index.cjs +1843 -610
- package/dist/index.d.ts +11 -92
- package/dist/index.js +53 -85
- package/dist/jose.cjs +113 -38
- package/dist/jose.d.ts +12 -23
- package/dist/jose.js +17 -7
- package/dist/logger.cjs +424 -0
- package/dist/logger.d.ts +12 -0
- package/dist/logger.js +17 -0
- package/dist/oauth/atlassian.cjs +57 -0
- package/dist/oauth/atlassian.d.ts +12 -0
- package/dist/oauth/atlassian.js +6 -0
- package/dist/oauth/bitbucket.cjs +19 -15
- package/dist/oauth/bitbucket.d.ts +7 -2
- package/dist/oauth/bitbucket.js +1 -1
- package/dist/oauth/discord.cjs +27 -24
- package/dist/oauth/discord.d.ts +7 -2
- package/dist/oauth/discord.js +1 -1
- package/dist/oauth/dropbox.cjs +53 -0
- package/dist/oauth/dropbox.d.ts +12 -0
- package/dist/oauth/dropbox.js +6 -0
- package/dist/oauth/figma.cjs +19 -16
- package/dist/oauth/figma.d.ts +7 -2
- package/dist/oauth/figma.js +1 -1
- package/dist/oauth/github.cjs +19 -8
- package/dist/oauth/github.d.ts +7 -2
- package/dist/oauth/github.js +1 -1
- package/dist/oauth/gitlab.cjs +19 -16
- package/dist/oauth/gitlab.d.ts +7 -2
- package/dist/oauth/gitlab.js +1 -1
- package/dist/oauth/index.cjs +529 -239
- package/dist/oauth/index.d.ts +7 -2
- package/dist/oauth/index.js +39 -22
- package/dist/oauth/mailchimp.cjs +19 -16
- package/dist/oauth/mailchimp.d.ts +7 -2
- package/dist/oauth/mailchimp.js +1 -1
- package/dist/oauth/notion.cjs +131 -0
- package/dist/oauth/notion.d.ts +12 -0
- package/dist/oauth/notion.js +9 -0
- package/dist/oauth/pinterest.cjs +19 -16
- package/dist/oauth/pinterest.d.ts +7 -2
- package/dist/oauth/pinterest.js +1 -1
- package/dist/oauth/spotify.cjs +19 -16
- package/dist/oauth/spotify.d.ts +7 -2
- package/dist/oauth/spotify.js +1 -1
- package/dist/oauth/strava.cjs +19 -16
- package/dist/oauth/strava.d.ts +7 -2
- package/dist/oauth/strava.js +1 -1
- package/dist/oauth/twitch.cjs +95 -0
- package/dist/oauth/twitch.d.ts +12 -0
- package/dist/oauth/twitch.js +7 -0
- package/dist/oauth/x.cjs +19 -16
- package/dist/oauth/x.d.ts +7 -2
- package/dist/oauth/x.js +1 -1
- package/dist/schemas.cjs +89 -42
- package/dist/schemas.d.ts +114 -18
- package/dist/schemas.js +5 -3
- package/dist/secure.cjs +73 -31
- package/dist/secure.d.ts +11 -11
- package/dist/secure.js +7 -6
- package/dist/utils.cjs +203 -90
- package/dist/utils.d.ts +21 -40
- package/dist/utils.js +21 -12
- package/package.json +9 -6
- package/dist/chunk-3EUWD5BB.js +0 -63
- package/dist/chunk-42XB3YCW.js +0 -22
- package/dist/chunk-6R2YZ4AC.js +0 -22
- package/dist/chunk-A3N4PVAT.js +0 -70
- package/dist/chunk-B737EUJV.js +0 -22
- package/dist/chunk-CXLATHS5.js +0 -143
- package/dist/chunk-E3OXBRYF.js +0 -22
- package/dist/chunk-EIL2FPSS.js +0 -22
- package/dist/chunk-EMKJA2GJ.js +0 -89
- package/dist/chunk-FIPU4MLT.js +0 -21
- package/dist/chunk-FKRDCWBF.js +0 -22
- package/dist/chunk-GA2SMTJO.js +0 -58
- package/dist/chunk-HP34YGGJ.js +0 -22
- package/dist/chunk-IKHPGFCW.js +0 -14
- package/dist/chunk-IUYZQTJV.js +0 -30
- package/dist/chunk-IVET23KF.js +0 -58
- package/dist/chunk-JVFTCTTE.js +0 -33
- package/dist/chunk-KRNOMBXQ.js +0 -22
- package/dist/chunk-KSWLO5ZU.js +0 -102
- package/dist/chunk-N2APGLXA.js +0 -71
- package/dist/chunk-N4SX7TZT.js +0 -96
- package/dist/chunk-STHEPPUZ.js +0 -11
- package/dist/chunk-TLE4PXY3.js +0 -39
- package/dist/index-B8jeIElf.d.ts +0 -679
- /package/dist/{chunk-DIVDFNAP.js → chunk-5X7JZMEF.js} +0 -0
package/dist/logger.cjs
ADDED
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/logger.ts
|
|
21
|
+
var logger_exports = {};
|
|
22
|
+
__export(logger_exports, {
|
|
23
|
+
createLogEntry: () => createLogEntry,
|
|
24
|
+
createLogger: () => createLogger,
|
|
25
|
+
createProxyLogger: () => createProxyLogger,
|
|
26
|
+
createSyslogMessage: () => createSyslogMessage,
|
|
27
|
+
logMessages: () => logMessages
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(logger_exports);
|
|
30
|
+
|
|
31
|
+
// src/env.ts
|
|
32
|
+
var import_meta = {};
|
|
33
|
+
var env = new Proxy({}, {
|
|
34
|
+
get(_, prop) {
|
|
35
|
+
if (typeof prop !== "string") return void 0;
|
|
36
|
+
const hasProperty = (process2) => {
|
|
37
|
+
return process2 && Object.prototype.hasOwnProperty.call(process2, prop);
|
|
38
|
+
};
|
|
39
|
+
try {
|
|
40
|
+
if (typeof process !== "undefined" && hasProperty(process.env)) {
|
|
41
|
+
return process.env[prop];
|
|
42
|
+
}
|
|
43
|
+
if (typeof import_meta !== "undefined" && hasProperty(import_meta.env)) {
|
|
44
|
+
return import_meta.env[prop];
|
|
45
|
+
}
|
|
46
|
+
if (typeof Deno !== "undefined" && Deno.env?.get) {
|
|
47
|
+
return Deno.env.get(prop);
|
|
48
|
+
}
|
|
49
|
+
if (typeof Bun !== "undefined" && hasProperty(Bun.env)) {
|
|
50
|
+
return Bun.env[prop];
|
|
51
|
+
}
|
|
52
|
+
const globalValue = globalThis[prop];
|
|
53
|
+
return typeof globalValue === "string" ? globalValue : void 0;
|
|
54
|
+
} catch {
|
|
55
|
+
return void 0;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
var getEnv = (key) => {
|
|
60
|
+
const keys = [`AURA_AUTH_${key.toUpperCase()}`, `AURA_${key.toUpperCase()}`, `AUTH_${key.toUpperCase()}`, key.toUpperCase()];
|
|
61
|
+
return env[keys.find((k) => env[k]) ?? ""];
|
|
62
|
+
};
|
|
63
|
+
var getEnvBoolean = (key) => {
|
|
64
|
+
const value = getEnv(key);
|
|
65
|
+
if (value === void 0) return false;
|
|
66
|
+
const normalized = value.trim().toLowerCase();
|
|
67
|
+
if (["1", "true", "yes", "on", "debug"].includes(normalized)) return true;
|
|
68
|
+
return false;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// src/utils.ts
|
|
72
|
+
var import_router = require("@aura-stack/router");
|
|
73
|
+
|
|
74
|
+
// src/assert.ts
|
|
75
|
+
var import_crypto = require("@aura-stack/jose/crypto");
|
|
76
|
+
|
|
77
|
+
// src/utils.ts
|
|
78
|
+
var createStructuredData = (data, sdID = "metadata") => {
|
|
79
|
+
const entries = Object.entries(data);
|
|
80
|
+
if (entries.length === 0) return `[${sdID}]`;
|
|
81
|
+
const values = entries.map(([key, value]) => `${key}="${String(value).replace(/(["\\\]])/g, "\\$1")}"`).join(" ");
|
|
82
|
+
return `[${sdID} ${values}]`;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// src/logger.ts
|
|
86
|
+
var logMessages = {
|
|
87
|
+
ROUTER_INTERNAL_ERROR: {
|
|
88
|
+
facility: 10,
|
|
89
|
+
severity: "error",
|
|
90
|
+
msgId: "ROUTER_INTERNAL_ERROR",
|
|
91
|
+
message: "Unhandled router error while processing the request"
|
|
92
|
+
},
|
|
93
|
+
INVALID_REQUEST: {
|
|
94
|
+
facility: 10,
|
|
95
|
+
severity: "warning",
|
|
96
|
+
msgId: "INVALID_REQUEST",
|
|
97
|
+
message: "Request validation failed against the expected schema"
|
|
98
|
+
},
|
|
99
|
+
SERVER_ERROR: {
|
|
100
|
+
facility: 10,
|
|
101
|
+
severity: "error",
|
|
102
|
+
msgId: "SERVER_ERROR",
|
|
103
|
+
message: "Unexpected internal server error during authentication"
|
|
104
|
+
},
|
|
105
|
+
OAUTH_PROTOCOL_ERROR: {
|
|
106
|
+
facility: 10,
|
|
107
|
+
severity: "warning",
|
|
108
|
+
msgId: "OAUTH_PROTOCOL_ERROR",
|
|
109
|
+
message: "OAuth provider returned an invalid or unexpected protocol response"
|
|
110
|
+
},
|
|
111
|
+
OAUTH_AUTHORIZATION_ERROR: {
|
|
112
|
+
facility: 10,
|
|
113
|
+
severity: "error",
|
|
114
|
+
msgId: "OAUTH_AUTHORIZATION_ERROR",
|
|
115
|
+
message: "OAuth authorization request was rejected or failed"
|
|
116
|
+
},
|
|
117
|
+
INVALID_OAUTH_CONFIGURATION: {
|
|
118
|
+
facility: 10,
|
|
119
|
+
severity: "error",
|
|
120
|
+
msgId: "INVALID_OAUTH_CONFIGURATION",
|
|
121
|
+
message: "The OAuth provider configuration is invalid or incomplete"
|
|
122
|
+
},
|
|
123
|
+
OAUTH_ACCESS_TOKEN_REQUEST_INITIATED: {
|
|
124
|
+
facility: 10,
|
|
125
|
+
severity: "debug",
|
|
126
|
+
msgId: "OAUTH_ACCESS_TOKEN_REQUEST_INITIATED",
|
|
127
|
+
message: "Starting OAuth access token request to the provider"
|
|
128
|
+
},
|
|
129
|
+
INVALID_OAUTH_ACCESS_TOKEN_RESPONSE: {
|
|
130
|
+
facility: 10,
|
|
131
|
+
severity: "error",
|
|
132
|
+
msgId: "INVALID_OAUTH_ACCESS_TOKEN_RESPONSE",
|
|
133
|
+
message: "OAuth access token endpoint returned an invalid or malformed response"
|
|
134
|
+
},
|
|
135
|
+
OAUTH_ACCESS_TOKEN_ERROR: {
|
|
136
|
+
facility: 10,
|
|
137
|
+
severity: "error",
|
|
138
|
+
msgId: "OAUTH_ACCESS_TOKEN_ERROR",
|
|
139
|
+
message: "OAuth access token endpoint returned an error response"
|
|
140
|
+
},
|
|
141
|
+
OAUTH_ACCESS_TOKEN_SUCCESS: {
|
|
142
|
+
facility: 10,
|
|
143
|
+
severity: "info",
|
|
144
|
+
msgId: "OAUTH_ACCESS_TOKEN_SUCCESS",
|
|
145
|
+
message: "Successfully retrieved OAuth access token from the provider"
|
|
146
|
+
},
|
|
147
|
+
OAUTH_ACCESS_TOKEN_REQUEST_FAILED: {
|
|
148
|
+
facility: 10,
|
|
149
|
+
severity: "error",
|
|
150
|
+
msgId: "OAUTH_ACCESS_TOKEN_REQUEST_FAILED",
|
|
151
|
+
message: "Network or server error while requesting OAuth access token"
|
|
152
|
+
},
|
|
153
|
+
OAUTH_USERINFO_REQUEST_INITIATED: {
|
|
154
|
+
facility: 10,
|
|
155
|
+
severity: "debug",
|
|
156
|
+
msgId: "OAUTH_USERINFO_REQUEST_INITIATED",
|
|
157
|
+
message: "Starting OAuth userinfo request to the provider"
|
|
158
|
+
},
|
|
159
|
+
OAUTH_USERINFO_INVALID_RESPONSE: {
|
|
160
|
+
facility: 10,
|
|
161
|
+
severity: "error",
|
|
162
|
+
msgId: "OAUTH_USERINFO_INVALID_RESPONSE",
|
|
163
|
+
message: "OAuth userinfo endpoint returned an invalid or malformed response"
|
|
164
|
+
},
|
|
165
|
+
OAUTH_USERINFO_ERROR: {
|
|
166
|
+
facility: 10,
|
|
167
|
+
severity: "error",
|
|
168
|
+
msgId: "OAUTH_USERINFO_ERROR",
|
|
169
|
+
message: "OAuth userinfo endpoint returned an error response"
|
|
170
|
+
},
|
|
171
|
+
OAUTH_USERINFO_SUCCESS: {
|
|
172
|
+
facility: 10,
|
|
173
|
+
severity: "info",
|
|
174
|
+
msgId: "OAUTH_USERINFO_SUCCESS",
|
|
175
|
+
message: "Successfully retrieved user information from the OAuth provider"
|
|
176
|
+
},
|
|
177
|
+
OAUTH_USERINFO_REQUEST_FAILED: {
|
|
178
|
+
facility: 10,
|
|
179
|
+
severity: "error",
|
|
180
|
+
msgId: "OAUTH_USERINFO_REQUEST_FAILED",
|
|
181
|
+
message: "Network or server error while requesting user information from the OAuth provider"
|
|
182
|
+
},
|
|
183
|
+
OAUTH_CALLBACK_SUCCESS: {
|
|
184
|
+
facility: 4,
|
|
185
|
+
severity: "info",
|
|
186
|
+
msgId: "OAUTH_CALLBACK_SUCCESS",
|
|
187
|
+
message: "OAuth callback completed successfully and session was created"
|
|
188
|
+
},
|
|
189
|
+
MISMATCHING_STATE: {
|
|
190
|
+
facility: 4,
|
|
191
|
+
severity: "critical",
|
|
192
|
+
msgId: "MISMATCHING_STATE",
|
|
193
|
+
message: "OAuth response state parameter does not match the stored state value"
|
|
194
|
+
},
|
|
195
|
+
POTENTIAL_OPEN_REDIRECT_ATTACK_DETECTED: {
|
|
196
|
+
facility: 4,
|
|
197
|
+
severity: "critical",
|
|
198
|
+
msgId: "POTENTIAL_OPEN_REDIRECT_ATTACK_DETECTED",
|
|
199
|
+
message: "Blocked redirect to untrusted or external URL (potential open redirect attack)"
|
|
200
|
+
},
|
|
201
|
+
OPEN_REDIRECT_ATTACK: {
|
|
202
|
+
facility: 4,
|
|
203
|
+
severity: "warning",
|
|
204
|
+
msgId: "OPEN_REDIRECT_ATTACK",
|
|
205
|
+
message: "Detected redirect target that does not match the trusted origin"
|
|
206
|
+
},
|
|
207
|
+
SESSION_TOKEN_MISSING: {
|
|
208
|
+
facility: 4,
|
|
209
|
+
severity: "warning",
|
|
210
|
+
msgId: "SESSION_TOKEN_MISSING",
|
|
211
|
+
message: "Session cookie is missing from the request"
|
|
212
|
+
},
|
|
213
|
+
CSRF_TOKEN_MISSING: {
|
|
214
|
+
facility: 4,
|
|
215
|
+
severity: "warning",
|
|
216
|
+
msgId: "CSRF_TOKEN_MISSING",
|
|
217
|
+
message: "CSRF token cookie is missing from the request"
|
|
218
|
+
},
|
|
219
|
+
CSRF_HEADER_MISSING: {
|
|
220
|
+
facility: 4,
|
|
221
|
+
severity: "warning",
|
|
222
|
+
msgId: "CSRF_HEADER_MISSING",
|
|
223
|
+
message: "CSRF header is missing from the request"
|
|
224
|
+
},
|
|
225
|
+
CSRF_TOKEN_INVALID: {
|
|
226
|
+
facility: 4,
|
|
227
|
+
severity: "error",
|
|
228
|
+
msgId: "CSRF_TOKEN_INVALID",
|
|
229
|
+
message: "CSRF token verification failed or token is invalid"
|
|
230
|
+
},
|
|
231
|
+
SIGN_IN_INITIATED: {
|
|
232
|
+
facility: 4,
|
|
233
|
+
severity: "info",
|
|
234
|
+
msgId: "SIGN_IN_INITIATED",
|
|
235
|
+
message: "Starting OAuth sign-in flow for the selected provider"
|
|
236
|
+
},
|
|
237
|
+
SIGN_OUT_ATTEMPT: {
|
|
238
|
+
facility: 4,
|
|
239
|
+
severity: "debug",
|
|
240
|
+
msgId: "SIGN_OUT_ATTEMPT",
|
|
241
|
+
message: "Received sign-out request from client"
|
|
242
|
+
},
|
|
243
|
+
SIGN_OUT_CSRF_VERIFIED: {
|
|
244
|
+
facility: 4,
|
|
245
|
+
severity: "info",
|
|
246
|
+
msgId: "SIGN_OUT_CSRF_VERIFIED",
|
|
247
|
+
message: "CSRF token was successfully verified during sign-out"
|
|
248
|
+
},
|
|
249
|
+
SIGN_OUT_SUCCESS: {
|
|
250
|
+
facility: 4,
|
|
251
|
+
severity: "info",
|
|
252
|
+
msgId: "SIGN_OUT_SUCCESS",
|
|
253
|
+
message: "User session was cleared and sign-out completed successfully"
|
|
254
|
+
},
|
|
255
|
+
SIGN_OUT_REDIRECT: {
|
|
256
|
+
facility: 4,
|
|
257
|
+
severity: "debug",
|
|
258
|
+
msgId: "SIGN_OUT_REDIRECT",
|
|
259
|
+
message: "Redirecting client after successful sign-out"
|
|
260
|
+
},
|
|
261
|
+
AUTH_SESSION_VALID: {
|
|
262
|
+
facility: 4,
|
|
263
|
+
severity: "info",
|
|
264
|
+
msgId: "AUTH_SESSION_VALID",
|
|
265
|
+
message: "Session token is valid and user session was returned"
|
|
266
|
+
},
|
|
267
|
+
AUTH_SESSION_INVALID: {
|
|
268
|
+
facility: 4,
|
|
269
|
+
severity: "notice",
|
|
270
|
+
msgId: "AUTH_SESSION_INVALID",
|
|
271
|
+
message: "Session token is missing, expired, or invalid"
|
|
272
|
+
},
|
|
273
|
+
INVALID_JWT_TOKEN: {
|
|
274
|
+
facility: 4,
|
|
275
|
+
severity: "warning",
|
|
276
|
+
msgId: "INVALID_JWT_TOKEN",
|
|
277
|
+
message: "JWT session token failed validation during sign-out"
|
|
278
|
+
},
|
|
279
|
+
CSRF_TOKEN_REQUESTED: {
|
|
280
|
+
facility: 4,
|
|
281
|
+
severity: "debug",
|
|
282
|
+
msgId: "CSRF_TOKEN_REQUESTED",
|
|
283
|
+
message: "Client requested a CSRF token"
|
|
284
|
+
},
|
|
285
|
+
CSRF_TOKEN_ISSUED: {
|
|
286
|
+
facility: 4,
|
|
287
|
+
severity: "debug",
|
|
288
|
+
msgId: "CSRF_TOKEN_ISSUED",
|
|
289
|
+
message: "Issued a new CSRF token to the client"
|
|
290
|
+
},
|
|
291
|
+
INVALID_URL: {
|
|
292
|
+
facility: 10,
|
|
293
|
+
severity: "error",
|
|
294
|
+
msgId: "INVALID_URL",
|
|
295
|
+
message: "Derived origin URL is invalid or malformed"
|
|
296
|
+
},
|
|
297
|
+
COOKIE_HTTPONLY_DISABLED: {
|
|
298
|
+
facility: 10,
|
|
299
|
+
severity: "critical",
|
|
300
|
+
msgId: "COOKIE_HTTPONLY_DISABLED",
|
|
301
|
+
message: "Cookie is configured without HttpOnly. This allows JavaScript access via document.cookie and increases XSS exposure."
|
|
302
|
+
},
|
|
303
|
+
COOKIE_WILDCARD_DOMAIN: {
|
|
304
|
+
facility: 10,
|
|
305
|
+
severity: "critical",
|
|
306
|
+
msgId: "COOKIE_WILDCARD_DOMAIN",
|
|
307
|
+
message: "Cookie 'Domain' is set to a wildcard, which is insecure and should be avoided."
|
|
308
|
+
},
|
|
309
|
+
COOKIE_SECURE_DISABLED: {
|
|
310
|
+
facility: 10,
|
|
311
|
+
severity: "warning",
|
|
312
|
+
msgId: "COOKIE_SECURE_DISABLED",
|
|
313
|
+
message: "Cookie is configured with 'Secure' but the request is not HTTPS. The 'Secure' attribute will be ignored by the browser."
|
|
314
|
+
},
|
|
315
|
+
COOKIE_SAMESITE_NONE_WITHOUT_SECURE: {
|
|
316
|
+
facility: 10,
|
|
317
|
+
severity: "warning",
|
|
318
|
+
msgId: "COOKIE_SAMESITE_NONE_WITHOUT_SECURE",
|
|
319
|
+
message: "Cookie uses SameSite=None without Secure. Falling back to SameSite=Lax for safer defaults."
|
|
320
|
+
},
|
|
321
|
+
COOKIE_INSECURE_IN_PRODUCTION: {
|
|
322
|
+
facility: 10,
|
|
323
|
+
severity: "critical",
|
|
324
|
+
msgId: "COOKIE_INSECURE_IN_PRODUCTION",
|
|
325
|
+
message: "Cookies are being served over an insecure connection in production, which is a serious security risk."
|
|
326
|
+
},
|
|
327
|
+
COOKIE_HOST_STRATEGY_INSECURE: {
|
|
328
|
+
facility: 10,
|
|
329
|
+
severity: "critical",
|
|
330
|
+
msgId: "COOKIE_HOST_STRATEGY_INSECURE",
|
|
331
|
+
message: "__Host- cookies require a secure HTTPS context. Falling back to standard cookie settings."
|
|
332
|
+
},
|
|
333
|
+
UNTRUSTED_ORIGIN: {
|
|
334
|
+
facility: 10,
|
|
335
|
+
severity: "error",
|
|
336
|
+
msgId: "UNTRUSTED_ORIGIN",
|
|
337
|
+
message: "The constructed origin URL is not trusted."
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
var createLogEntry = (key, overrides) => {
|
|
341
|
+
const message = logMessages[key];
|
|
342
|
+
return {
|
|
343
|
+
...message,
|
|
344
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
345
|
+
hostname: "aura-auth",
|
|
346
|
+
procId: typeof process !== "undefined" && process.pid ? process.pid.toString() : "-",
|
|
347
|
+
...overrides
|
|
348
|
+
};
|
|
349
|
+
};
|
|
350
|
+
var logLevelToSeverity = {
|
|
351
|
+
debug: ["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"],
|
|
352
|
+
info: ["info", "notice", "warning", "error", "critical", "alert", "emergency"],
|
|
353
|
+
warn: ["warning", "error", "critical", "alert", "emergency"],
|
|
354
|
+
error: ["error", "critical", "alert", "emergency"]
|
|
355
|
+
};
|
|
356
|
+
var isValidLogLevel = (value) => {
|
|
357
|
+
return value === "debug" || value === "info" || value === "warn" || value === "error";
|
|
358
|
+
};
|
|
359
|
+
var getSeverityLevel = (severity) => {
|
|
360
|
+
const severities = {
|
|
361
|
+
emergency: 0,
|
|
362
|
+
alert: 1,
|
|
363
|
+
critical: 2,
|
|
364
|
+
error: 3,
|
|
365
|
+
warning: 4,
|
|
366
|
+
notice: 5,
|
|
367
|
+
info: 6,
|
|
368
|
+
debug: 7
|
|
369
|
+
};
|
|
370
|
+
return severities[severity] ?? 6;
|
|
371
|
+
};
|
|
372
|
+
var createSyslogMessage = (options) => {
|
|
373
|
+
const { timestamp, hostname, appName = "aura-auth", procId = "-", msgId, structuredData, message } = options;
|
|
374
|
+
const pri = (options.facility ?? 16) * 8 + getSeverityLevel(options.severity);
|
|
375
|
+
const structuredDataStr = createStructuredData(structuredData ?? {});
|
|
376
|
+
return `<${pri}>1 ${timestamp} ${hostname} ${appName} ${procId} ${msgId} ${structuredDataStr} ${message}`;
|
|
377
|
+
};
|
|
378
|
+
var createLogger = (logger) => {
|
|
379
|
+
if (!logger) return void 0;
|
|
380
|
+
const level = logger.level;
|
|
381
|
+
const allowedSeverities = logLevelToSeverity[level] ?? [];
|
|
382
|
+
return {
|
|
383
|
+
level,
|
|
384
|
+
log(key, overrides) {
|
|
385
|
+
const entry = createLogEntry(key, overrides);
|
|
386
|
+
if (!allowedSeverities.includes(entry.severity)) return entry;
|
|
387
|
+
logger.log({
|
|
388
|
+
timestamp: entry.timestamp,
|
|
389
|
+
appName: entry.appName ?? "aura-auth",
|
|
390
|
+
hostname: entry.hostname ?? "aura-auth",
|
|
391
|
+
...entry
|
|
392
|
+
});
|
|
393
|
+
return entry;
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
};
|
|
397
|
+
var createProxyLogger = (config) => {
|
|
398
|
+
const level = getEnv("LOG_LEVEL");
|
|
399
|
+
const debug = getEnvBoolean("DEBUG");
|
|
400
|
+
if (typeof config?.logger === "object") {
|
|
401
|
+
return createLogger({
|
|
402
|
+
log: config.logger?.log || createSyslogMessage,
|
|
403
|
+
level: isValidLogLevel(config.logger?.level) ? config.logger?.level : isValidLogLevel(level) ? level : "error"
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
if (debug || config?.logger === true || level) {
|
|
407
|
+
return createLogger({
|
|
408
|
+
level: isValidLogLevel(level) ? level : "debug",
|
|
409
|
+
log: (options) => {
|
|
410
|
+
const message = createSyslogMessage(options);
|
|
411
|
+
console.log(message);
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
return void 0;
|
|
416
|
+
};
|
|
417
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
418
|
+
0 && (module.exports = {
|
|
419
|
+
createLogEntry,
|
|
420
|
+
createLogger,
|
|
421
|
+
createProxyLogger,
|
|
422
|
+
createSyslogMessage,
|
|
423
|
+
logMessages
|
|
424
|
+
});
|
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { y as createLogEntry, z as createLogger, D as createProxyLogger, x as createSyslogMessage, H as logMessages } from './index-_aXtxb_s.js';
|
|
2
|
+
import 'zod';
|
|
3
|
+
import './schemas.js';
|
|
4
|
+
import 'zod/v4';
|
|
5
|
+
import '@aura-stack/jose';
|
|
6
|
+
import '@aura-stack/jose/jose';
|
|
7
|
+
import '@aura-stack/jose/crypto';
|
|
8
|
+
import '@aura-stack/router/cookie';
|
|
9
|
+
import './@types/utility.js';
|
|
10
|
+
import 'jose';
|
|
11
|
+
import '@aura-stack/router';
|
|
12
|
+
import 'zod/v4/core';
|
package/dist/logger.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createLogEntry,
|
|
3
|
+
createLogger,
|
|
4
|
+
createProxyLogger,
|
|
5
|
+
createSyslogMessage,
|
|
6
|
+
logMessages
|
|
7
|
+
} from "./chunk-U4RK4LKJ.js";
|
|
8
|
+
import "./chunk-LX3TJ2TJ.js";
|
|
9
|
+
import "./chunk-WHNDRO3N.js";
|
|
10
|
+
import "./chunk-U5663F2U.js";
|
|
11
|
+
export {
|
|
12
|
+
createLogEntry,
|
|
13
|
+
createLogger,
|
|
14
|
+
createProxyLogger,
|
|
15
|
+
createSyslogMessage,
|
|
16
|
+
logMessages
|
|
17
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/oauth/atlassian.ts
|
|
21
|
+
var atlassian_exports = {};
|
|
22
|
+
__export(atlassian_exports, {
|
|
23
|
+
atlassian: () => atlassian
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(atlassian_exports);
|
|
26
|
+
var atlassian = (options) => {
|
|
27
|
+
return {
|
|
28
|
+
id: "atlassian",
|
|
29
|
+
name: "Atlassian",
|
|
30
|
+
authorize: {
|
|
31
|
+
url: "https://auth.atlassian.com/authorize",
|
|
32
|
+
params: {
|
|
33
|
+
audience: "api.atlassian.com",
|
|
34
|
+
scope: "read:me read:account",
|
|
35
|
+
prompt: "consent"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
authorizeURL: "https://auth.atlassian.com/authorize",
|
|
39
|
+
accessToken: "https://auth.atlassian.com/oauth/token",
|
|
40
|
+
userInfo: "https://api.atlassian.com/me",
|
|
41
|
+
scope: "read:me read:account",
|
|
42
|
+
responseType: "code",
|
|
43
|
+
profile(profile) {
|
|
44
|
+
return {
|
|
45
|
+
sub: profile.account_id,
|
|
46
|
+
name: profile.name,
|
|
47
|
+
email: profile.email,
|
|
48
|
+
image: profile.picture
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
...options
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
atlassian
|
|
57
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { P as AtlassianProfile, Q as ExtendedProfile, V as atlassian } from '../index-_aXtxb_s.js';
|
|
2
|
+
import '../@types/utility.js';
|
|
3
|
+
import 'zod';
|
|
4
|
+
import '../schemas.js';
|
|
5
|
+
import 'zod/v4';
|
|
6
|
+
import '@aura-stack/jose';
|
|
7
|
+
import '@aura-stack/jose/jose';
|
|
8
|
+
import '@aura-stack/jose/crypto';
|
|
9
|
+
import '@aura-stack/router/cookie';
|
|
10
|
+
import 'jose';
|
|
11
|
+
import '@aura-stack/router';
|
|
12
|
+
import 'zod/v4/core';
|
package/dist/oauth/bitbucket.cjs
CHANGED
|
@@ -23,21 +23,25 @@ __export(bitbucket_exports, {
|
|
|
23
23
|
bitbucket: () => bitbucket
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(bitbucket_exports);
|
|
26
|
-
var bitbucket = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
var bitbucket = (options) => {
|
|
27
|
+
return {
|
|
28
|
+
id: "bitbucket",
|
|
29
|
+
name: "Bitbucket",
|
|
30
|
+
authorizeURL: "https://bitbucket.org/site/oauth2/authorize",
|
|
31
|
+
accessToken: "https://bitbucket.org/site/oauth2/access_token",
|
|
32
|
+
userInfo: "https://api.bitbucket.org/2.0/user",
|
|
33
|
+
scope: "account email",
|
|
34
|
+
responseType: "code",
|
|
35
|
+
profile(profile) {
|
|
36
|
+
return {
|
|
37
|
+
sub: profile.uuid ?? profile.account_id,
|
|
38
|
+
name: profile.display_name ?? profile.nickname,
|
|
39
|
+
image: profile.links.avatar?.href,
|
|
40
|
+
email: void 0
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
...options
|
|
44
|
+
};
|
|
41
45
|
};
|
|
42
46
|
// Annotate the CommonJS export names for ESM import in node:
|
|
43
47
|
0 && (module.exports = {
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { at as BitbucketProfile, au as bitbucket } from '../index-_aXtxb_s.js';
|
|
2
2
|
import '../@types/utility.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import '../schemas.js';
|
|
5
|
-
import '
|
|
5
|
+
import 'zod/v4';
|
|
6
6
|
import '@aura-stack/jose';
|
|
7
7
|
import '@aura-stack/jose/jose';
|
|
8
|
+
import '@aura-stack/jose/crypto';
|
|
9
|
+
import '@aura-stack/router/cookie';
|
|
10
|
+
import 'jose';
|
|
11
|
+
import '@aura-stack/router';
|
|
12
|
+
import 'zod/v4/core';
|
package/dist/oauth/bitbucket.js
CHANGED
package/dist/oauth/discord.cjs
CHANGED
|
@@ -23,30 +23,33 @@ __export(discord_exports, {
|
|
|
23
23
|
discord: () => discord
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(discord_exports);
|
|
26
|
-
var discord = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
26
|
+
var discord = (options) => {
|
|
27
|
+
return {
|
|
28
|
+
id: "discord",
|
|
29
|
+
name: "Discord",
|
|
30
|
+
authorizeURL: "https://discord.com/oauth2/authorize",
|
|
31
|
+
accessToken: "https://discord.com/api/oauth2/token",
|
|
32
|
+
userInfo: "https://discord.com/api/users/@me",
|
|
33
|
+
scope: "identify email",
|
|
34
|
+
responseType: "code",
|
|
35
|
+
profile(profile) {
|
|
36
|
+
let image = "";
|
|
37
|
+
if (profile.avatar === null) {
|
|
38
|
+
const index = profile.discriminator === "0" ? (BigInt(profile.id) >> 22n) % 6n : Number(profile.discriminator) % 5;
|
|
39
|
+
image = `https://cdn.discordapp.com/embed/avatars/${index}.png`;
|
|
40
|
+
} else {
|
|
41
|
+
const format = profile.avatar.startsWith("a_") ? "gif" : "png";
|
|
42
|
+
image = `https://cdn.discordapp.com/avatars/${profile.id}/${profile.avatar}.${format}`;
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
sub: profile.id,
|
|
46
|
+
name: profile.global_name ?? profile.username,
|
|
47
|
+
email: profile.email ?? "",
|
|
48
|
+
image
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
...options
|
|
52
|
+
};
|
|
50
53
|
};
|
|
51
54
|
// Annotate the CommonJS export names for ESM import in node:
|
|
52
55
|
0 && (module.exports = {
|
package/dist/oauth/discord.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ao as DiscordProfile, ap as Nameplate, aq as discord } from '../index-_aXtxb_s.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import '../schemas.js';
|
|
4
|
-
import '
|
|
4
|
+
import 'zod/v4';
|
|
5
5
|
import '@aura-stack/jose';
|
|
6
6
|
import '@aura-stack/jose/jose';
|
|
7
|
+
import '@aura-stack/jose/crypto';
|
|
8
|
+
import '@aura-stack/router/cookie';
|
|
7
9
|
import '../@types/utility.js';
|
|
10
|
+
import 'jose';
|
|
11
|
+
import '@aura-stack/router';
|
|
12
|
+
import 'zod/v4/core';
|