@ibgib/space-gib 0.0.7 → 0.0.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/dist/client/bootstrap.mjs +1 -1
- package/dist/client/chunk-ACIGPCQW.mjs +2407 -0
- package/dist/client/chunk-ACIGPCQW.mjs.map +7 -0
- package/dist/client/chunk-QRMTJE6M.mjs +42 -0
- package/dist/client/chunk-QRMTJE6M.mjs.map +7 -0
- package/dist/client/index.mjs +1 -1
- package/dist/client/script.mjs +1 -1
- package/dist/server/server.mjs +5655 -5268
- package/dist/server/server.mjs.map +4 -4
- package/package.json +4 -4
- package/src/client/AUTO-GENERATED-version.mts +1 -1
- package/src/client/api/space-gib-api-bridge.mts +37 -3
- package/src/client/components/keystone-creator/keystone-creator.mts +5 -5
- package/src/client/components/keystone-details/keystone-details.css +158 -19
- package/src/client/components/keystone-details/keystone-details.html +57 -5
- package/src/client/components/keystone-details/keystone-details.mts +417 -25
- package/src/client/dev-tools/common.mts +4 -4
- package/src/server/serve-gib/handlers/api/keystone/keystone-evolve.handler.mts +45 -3
- package/src/server/serve-gib/handlers/api/keystone/sso-link.handler.mts +25 -4
- package/src/server/serve-gib/handlers/api/keystone/sso-login.handler.mts +4 -3
- package/dist/client/chunk-RXFIBFRK.mjs +0 -42
- package/dist/client/chunk-RXFIBFRK.mjs.map +0 -7
- package/dist/client/chunk-ULFNE26Y.mjs +0 -2216
- package/dist/client/chunk-ULFNE26Y.mjs.map +0 -7
|
@@ -3,6 +3,8 @@ import { getIbGibAddr } from '@ibgib/ts-gib/dist/helper.mjs';
|
|
|
3
3
|
import { loadSsoServerConfig } from '@ibgib/web-gib/dist/identity/sso/sso-config-helper.mjs';
|
|
4
4
|
import { SsoCustodianService } from '@ibgib/web-gib/dist/identity/sso/sso-custodian-service.mjs';
|
|
5
5
|
import { SsoProviderId } from '@ibgib/web-gib/dist/identity/sso/sso-types.mjs';
|
|
6
|
+
import { isSsoProviderLinked } from '@ibgib/web-gib/dist/identity/sso/sso-helpers.mjs';
|
|
7
|
+
import { KeystoneService_V1 } from '@ibgib/core-gib/dist/keystone/keystone-service-v1.mjs';
|
|
6
8
|
|
|
7
9
|
import { GLOBAL_LOG_A_LOT } from '../../../constants.mjs';
|
|
8
10
|
import { ServeGibHandlerWithMetaspaceBase } from '../../handler-base.mjs';
|
|
@@ -91,15 +93,34 @@ export class SsoLinkHandler extends ServeGibHandlerWithMetaspaceBase<LinkParams,
|
|
|
91
93
|
return this.error(500, 'No local user space found in domain metaspace');
|
|
92
94
|
}
|
|
93
95
|
|
|
96
|
+
// 0. Fetch target keystone and verify if already linked
|
|
97
|
+
const keystoneService = new KeystoneService_V1();
|
|
98
|
+
const targetKeystone = await keystoneService.getLatestKeystone({
|
|
99
|
+
addr: parentTjpAddr,
|
|
100
|
+
metaspace: reqCtx.metaspace,
|
|
101
|
+
space
|
|
102
|
+
});
|
|
103
|
+
if (!targetKeystone) {
|
|
104
|
+
return this.error(400, `Keystone not found for address: ${parentTjpAddr}`);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (isSsoProviderLinked({ keystone: targetKeystone, providerId })) {
|
|
108
|
+
return this.error(400, `SSO provider "${providerId}" is already linked to this keystone.`);
|
|
109
|
+
}
|
|
110
|
+
|
|
94
111
|
// 1. Authenticate with provider and retrieve user info
|
|
95
112
|
const service = getCustodian();
|
|
96
113
|
const userInfo = await service.getOAuthUserInfo(providerId, code, redirectUri);
|
|
97
114
|
|
|
98
115
|
// 2. Generate the custodian foreign challenge pool
|
|
99
|
-
const custodianPool = await service.createCustodianChallengePool(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
116
|
+
const custodianPool = await service.createCustodianChallengePool({
|
|
117
|
+
providerId,
|
|
118
|
+
providerKey: userInfo.providerKey,
|
|
119
|
+
userNonce,
|
|
120
|
+
keystoneAddr: parentTjpAddr,
|
|
121
|
+
metaspace: reqCtx.metaspace,
|
|
122
|
+
space
|
|
123
|
+
});
|
|
103
124
|
|
|
104
125
|
console.log(`${lc} created custodian pool for: ${userInfo.providerKey}`);
|
|
105
126
|
|
|
@@ -123,10 +123,11 @@ export class SsoLoginHandler extends ServeGibHandlerWithMetaspaceBase<LoginParam
|
|
|
123
123
|
return this.error(404, `Parent identity keystone not found in space for address: ${latestParentAddr}`);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
// 4. Resolve the
|
|
127
|
-
const
|
|
126
|
+
// 4. Resolve the custodian pool from the parent keystone using dynamic poolId
|
|
127
|
+
const targetPoolId = `custodian-manage-${providerId}`;
|
|
128
|
+
const custodianPool = parentKeystone.data?.challengePools?.find((p: any) => p.id === targetPoolId);
|
|
128
129
|
if (!custodianPool) {
|
|
129
|
-
return this.error(401, `Unauthorized: Custodian pool '${
|
|
130
|
+
return this.error(401, `Unauthorized: Custodian pool '${targetPoolId}' is not registered in the parent identity keystone.`);
|
|
130
131
|
}
|
|
131
132
|
|
|
132
133
|
// 5. Assert allowed verbs contain KEYSTONE_VERB_MANAGE
|