@owlmeans/server-auth-otp 0.1.18-rc.12 → 0.1.18-rc.13
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/agent-meta/manifest.json +2 -2
- package/build/plugin.d.ts.map +1 -1
- package/build/plugin.js +7 -4
- package/build/plugin.js.map +1 -1
- package/package.json +9 -9
- package/src/plugin.ts +7 -4
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/server-auth-otp",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-08-
|
|
4
|
+
"version": "0.1.18-rc.12",
|
|
5
|
+
"generatedAt": "2026-08-27T16:32:18.500Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
package/build/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAsEvD,sGAAsG;AACtG,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,KAAG,CAG1F,CAAA"}
|
package/build/plugin.js
CHANGED
|
@@ -35,13 +35,16 @@ const otpPlugin = (context) => ({
|
|
|
35
35
|
await otp.verifyChallenge(email, code);
|
|
36
36
|
const identityAlias = context.cfg.otp?.identityAlias ?? AUTH_IDENTITY_LINKING;
|
|
37
37
|
const identity = context.service(identityAlias);
|
|
38
|
-
|
|
38
|
+
// What arrives on the credential is the organization SLUG the user is logging into — it is
|
|
39
|
+
// what a person can be asked to type. The linked profile below answers with the canonical
|
|
40
|
+
// slug, which is what the token ends up carrying.
|
|
41
|
+
const entitySlug = credential.entitySlug;
|
|
39
42
|
const details = {
|
|
40
43
|
type: OTP_AUTH_TYPE,
|
|
41
44
|
service: 'email',
|
|
42
|
-
clientId:
|
|
45
|
+
clientId: entitySlug ?? 'default',
|
|
43
46
|
userId: email,
|
|
44
|
-
entityId,
|
|
47
|
+
entityId: entitySlug,
|
|
45
48
|
};
|
|
46
49
|
let payload = await identity.getLinkedProfile(details);
|
|
47
50
|
if (payload == null) {
|
|
@@ -51,7 +54,7 @@ const otpPlugin = (context) => ({
|
|
|
51
54
|
credential.type = AuthenticationType.OneTimeToken;
|
|
52
55
|
credential.userId = payload.userId;
|
|
53
56
|
credential.profileId = payload.profileId;
|
|
54
|
-
credential.
|
|
57
|
+
credential.entitySlug = payload.entitySlug;
|
|
55
58
|
credential.role = payload.role ?? AuthRole.User;
|
|
56
59
|
credential.scopes = payload.scopes ?? [ALL_SCOPES];
|
|
57
60
|
return { token: '' };
|
package/build/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAEvF,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AAEtE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAE/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAG/D,0FAA0F;AAC1F,MAAM,mBAAmB,GAAG,IAAI,C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AQ,EAAE,UAAU;SACrB,CAAA;QAED,IAAI,OAAO,GAAG,MAAM,QAAQ,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAA;QACtD,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;YACpB,OAAO,GAAG,MAAM,QAAQ,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAA;QACpE,CAAC;QAED,wDAAwD;QACxD,UAAU,CAAC,IAAI,GAAG,kBAAkB,CAAC,YAAY,CAAA;QACjD,UAAU,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;QAClC,UAAU,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;QACxC,UAAU,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;QAC1C,UAAU,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAA;QAC/C,UAAU,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,CAAA;QAElD,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;IACtB,CAAC;CACF,CAAC,CAAA;AAEF,sGAAsG;AACtG,MAAM,CAAC,MAAM,eAAe,GAAG,CAA+C,OAAU,EAAK,EAAE;IAC7F,cAAc,CAAC,aAAa,EAAE,SAAiD,CAAC,CAAA;IAChF,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/server-auth-otp",
|
|
3
|
-
"version": "0.1.18-rc.
|
|
3
|
+
"version": "0.1.18-rc.13",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -22,21 +22,21 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@owlmeans/auth": "^0.1.18-rc.
|
|
25
|
+
"@owlmeans/auth": "^0.1.18-rc.7",
|
|
26
26
|
"@owlmeans/auth-otp": "^0.1.18-rc.6",
|
|
27
|
-
"@owlmeans/basic-ids": "^0.1.18-rc.
|
|
27
|
+
"@owlmeans/basic-ids": "^0.1.18-rc.7",
|
|
28
28
|
"@owlmeans/context": "^0.1.18-rc.6",
|
|
29
29
|
"@owlmeans/mailer": "^0.1.18-rc.6",
|
|
30
|
-
"@owlmeans/oidc": "^0.1.18-rc.
|
|
31
|
-
"@owlmeans/redis-resource": "^0.1.18-rc.
|
|
30
|
+
"@owlmeans/oidc": "^0.1.18-rc.9",
|
|
31
|
+
"@owlmeans/redis-resource": "^0.1.18-rc.8",
|
|
32
32
|
"@owlmeans/resource": "^0.1.18-rc.7",
|
|
33
|
-
"@owlmeans/server-auth": "^0.1.18-rc.
|
|
34
|
-
"@owlmeans/server-auth-identity": "^0.1.18-rc.
|
|
35
|
-
"@owlmeans/server-context": "^0.1.18-rc.
|
|
33
|
+
"@owlmeans/server-auth": "^0.1.18-rc.13",
|
|
34
|
+
"@owlmeans/server-auth-identity": "^0.1.18-rc.9",
|
|
35
|
+
"@owlmeans/server-context": "^0.1.18-rc.8"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@owlmeans/dep-config": "workspace:*",
|
|
39
|
-
"@types/bun": "^1.
|
|
39
|
+
"@types/bun": "^1.4.0",
|
|
40
40
|
"nodemon": "^3.1.14",
|
|
41
41
|
"typescript": "^7.0.2"
|
|
42
42
|
},
|
package/src/plugin.ts
CHANGED
|
@@ -47,13 +47,16 @@ const otpPlugin = <C extends OtpConfig, T extends OtpContext<C>>(context: T): Au
|
|
|
47
47
|
const identityAlias = (context.cfg as any).otp?.identityAlias ?? AUTH_IDENTITY_LINKING
|
|
48
48
|
const identity = context.service<IdentityLinkingService>(identityAlias)
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
// What arrives on the credential is the organization SLUG the user is logging into — it is
|
|
51
|
+
// what a person can be asked to type. The linked profile below answers with the canonical
|
|
52
|
+
// slug, which is what the token ends up carrying.
|
|
53
|
+
const entitySlug = credential.entitySlug
|
|
51
54
|
const details = {
|
|
52
55
|
type: OTP_AUTH_TYPE,
|
|
53
56
|
service: 'email',
|
|
54
|
-
clientId:
|
|
57
|
+
clientId: entitySlug ?? 'default',
|
|
55
58
|
userId: email,
|
|
56
|
-
entityId,
|
|
59
|
+
entityId: entitySlug,
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
let payload = await identity.getLinkedProfile(details)
|
|
@@ -65,7 +68,7 @@ const otpPlugin = <C extends OtpConfig, T extends OtpContext<C>>(context: T): Au
|
|
|
65
68
|
credential.type = AuthenticationType.OneTimeToken
|
|
66
69
|
credential.userId = payload.userId
|
|
67
70
|
credential.profileId = payload.profileId
|
|
68
|
-
credential.
|
|
71
|
+
credential.entitySlug = payload.entitySlug
|
|
69
72
|
credential.role = payload.role ?? AuthRole.User
|
|
70
73
|
credential.scopes = payload.scopes ?? [ALL_SCOPES]
|
|
71
74
|
|