@eduwork/dsh-oidc 0.1.0-alpha.11
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/CHANGELOG.en.md +120 -0
- package/CHANGELOG.md +120 -0
- package/LICENSE +21 -0
- package/README.en.md +184 -0
- package/README.md +143 -0
- package/THIRD_PARTY_NOTICES.en.md +51 -0
- package/THIRD_PARTY_NOTICES.md +53 -0
- package/cordis.patch.yml +8 -0
- package/docs/EDUWORK-MIGRATION.en.md +23 -0
- package/docs/EDUWORK-MIGRATION.md +23 -0
- package/docs/architecture.en.md +125 -0
- package/docs/architecture.md +125 -0
- package/docs/compatibility.en.md +61 -0
- package/docs/compatibility.md +61 -0
- package/docs/decisions/0001-one-plugin-composition-boundary.en.md +34 -0
- package/docs/decisions/0001-one-plugin-composition-boundary.md +34 -0
- package/docs/dsh-integration.en.md +171 -0
- package/docs/dsh-integration.md +171 -0
- package/docs/ecnu-reference.en.md +66 -0
- package/docs/ecnu-reference.md +66 -0
- package/docs/enterprise-profile.en.md +159 -0
- package/docs/enterprise-profile.md +159 -0
- package/docs/getting-started.en.md +137 -0
- package/docs/getting-started.md +239 -0
- package/docs/key-binding-protocol.en.md +227 -0
- package/docs/key-binding-protocol.md +227 -0
- package/docs/oidc-interoperability.en.md +100 -0
- package/docs/oidc-interoperability.md +100 -0
- package/docs/release-checklist.en.md +60 -0
- package/docs/release-checklist.md +60 -0
- package/docs/security-model.en.md +138 -0
- package/docs/security-model.md +138 -0
- package/docs/server-integration-contract.en.md +706 -0
- package/docs/server-integration-contract.md +706 -0
- package/examples/ecnu.enterprise-profile.example.json +81 -0
- package/examples/enterprise-profile.example.json +77 -0
- package/lib/client.js +5855 -0
- package/lib/index.js +59 -0
- package/lib/oidc.js +649 -0
- package/lib/profile.js +371 -0
- package/lib/provider/core.js +138 -0
- package/lib/provider/index.js +156 -0
- package/lib/provider/transform-adapter.js +65 -0
- package/lib/provider/transforms.js +59 -0
- package/lib/typert-schemas.js +84 -0
- package/lib/typert.host.js +38 -0
- package/lib/typert.remote-client.js +37 -0
- package/package.json +120 -0
- package/protocol/openapi.yaml +257 -0
- package/schema/enterprise-profile.v1alpha1.schema.json +174 -0
package/lib/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Remote, TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol'
|
|
2
|
+
import { apply as applyEnterpriseProvider } from './provider/index.js'
|
|
3
|
+
import { NativeOidcBackend, WebOidcBackend } from './oidc.js'
|
|
4
|
+
import { enterpriseProviderConfig, loadEnterpriseProfiles, publicProfile } from './profile.js'
|
|
5
|
+
|
|
6
|
+
export const name = 'dsh-oidc'
|
|
7
|
+
const remoteInitializers = []
|
|
8
|
+
|
|
9
|
+
export class OidcAccountService extends TypertRemoteService {
|
|
10
|
+
static inject = ['credentials', 'llm', 'webServer']
|
|
11
|
+
|
|
12
|
+
constructor(ctx, config = {}) {
|
|
13
|
+
super(ctx, 'oidcAccounts')
|
|
14
|
+
for (const initialize of remoteInitializers) initialize.call(this)
|
|
15
|
+
this.profiles = loadEnterpriseProfiles(config)
|
|
16
|
+
if (this.profiles.size === 0 && config.allowEmptyProfiles !== true) throw new Error('dsh-oidc requires at least one Enterprise Profile')
|
|
17
|
+
this.uiMode = ['external', 'models-only'].includes(config.uiMode) ? config.uiMode : 'standard'
|
|
18
|
+
applyEnterpriseProvider(ctx, enterpriseProviderConfig(this.profiles))
|
|
19
|
+
this.backend = config.backend === 'native'
|
|
20
|
+
? new NativeOidcBackend(ctx, this.profiles)
|
|
21
|
+
: new WebOidcBackend(ctx, this.profiles, config.web ?? {})
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
configuration() {
|
|
25
|
+
return Promise.resolve({
|
|
26
|
+
schemaVersion: 'dsh-oidc/v1alpha1',
|
|
27
|
+
uiMode: this.uiMode,
|
|
28
|
+
profiles: [...this.profiles.values()].map(publicProfile),
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
status(profileID) { return this.backend.status(profileID) }
|
|
33
|
+
begin(profileID) { return this.backend.begin(profileID) }
|
|
34
|
+
reconcile(profileID, options) { return this.backend.reconcile(profileID, options) }
|
|
35
|
+
logout(profileID) { return this.backend.logout(profileID) }
|
|
36
|
+
management() { return this.backend.management() }
|
|
37
|
+
activate(profileID) { return this.backend.activate(profileID) }
|
|
38
|
+
configure(profileID) { return this.backend.configure(profileID) }
|
|
39
|
+
addCustom(baseURL) { return this.backend.addCustom(baseURL) }
|
|
40
|
+
updateCustom(profileID, baseURL) { return this.backend.updateCustom(profileID, baseURL) }
|
|
41
|
+
removeProfile(profileID) { return this.backend.removeProfile(profileID) }
|
|
42
|
+
configureModels(profileID, modelMode, models) { return this.backend.configureModels(profileID, modelMode, models) }
|
|
43
|
+
restart() { return this.backend.restart() }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
for (const method of [
|
|
47
|
+
'configuration', 'status', 'begin', 'reconcile', 'logout', 'management',
|
|
48
|
+
'activate', 'configure', 'addCustom', 'updateCustom', 'removeProfile', 'configureModels', 'restart',
|
|
49
|
+
]) {
|
|
50
|
+
Remote(method)(OidcAccountService.prototype[method], {
|
|
51
|
+
kind: 'method', name: method, static: false, private: false,
|
|
52
|
+
addInitializer(initializer) { remoteInitializers.push(initializer) },
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export default OidcAccountService
|
|
57
|
+
export { enterpriseProviderConfig, loadEnterpriseProfiles, normalizeEnterpriseProfile, publicProfile } from './profile.js'
|
|
58
|
+
export { NativeOidcBackend, WebOidcBackend } from './oidc.js'
|
|
59
|
+
export { EnterpriseModelTransforms } from './provider/transforms.js'
|