@sso-id/cli 0.0.0-stage → 0.2.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 (51) hide show
  1. package/bin/sso-id.mjs +181 -0
  2. package/package.json +28 -4
  3. package/templates/angular-spa/package.json +19 -0
  4. package/templates/angular-spa/src/app/app.component.ts +63 -0
  5. package/templates/angular-spa/src/app/app.config.ts +16 -0
  6. package/templates/angular-spa/src/environments/environment.ts +7 -0
  7. package/templates/dotnet-api/Program.cs +121 -0
  8. package/templates/dotnet-api/SsoIdStarter.csproj +12 -0
  9. package/templates/dotnet-api/appsettings.json +14 -0
  10. package/templates/express-api/.env.example +12 -0
  11. package/templates/express-api/README.md +8 -0
  12. package/templates/express-api/package.json +18 -0
  13. package/templates/express-api/src/server.mjs +182 -0
  14. package/templates/go-gin/.env.example +7 -0
  15. package/templates/go-gin/go.mod +6 -0
  16. package/templates/go-gin/main.go +112 -0
  17. package/templates/mobile-react-native/.env.example +5 -0
  18. package/templates/mobile-react-native/App.tsx +45 -0
  19. package/templates/mobile-react-native/package.json +11 -0
  20. package/templates/nextjs/.env.example +19 -0
  21. package/templates/nextjs/README.md +18 -0
  22. package/templates/nextjs/next.config.mjs +4 -0
  23. package/templates/nextjs/package.json +27 -0
  24. package/templates/nextjs/src/app/api/auth/[...ssoid]/route.ts +10 -0
  25. package/templates/nextjs/src/app/api/management/[resource]/route.ts +64 -0
  26. package/templates/nextjs/src/app/api/scim/sync/route.ts +60 -0
  27. package/templates/nextjs/src/app/api/scim/v2/Groups/[id]/route.ts +58 -0
  28. package/templates/nextjs/src/app/api/scim/v2/Groups/route.ts +44 -0
  29. package/templates/nextjs/src/app/api/scim/v2/Users/[id]/route.ts +89 -0
  30. package/templates/nextjs/src/app/api/scim/v2/Users/route.ts +44 -0
  31. package/templates/nextjs/src/app/layout.tsx +18 -0
  32. package/templates/nextjs/src/app/page.tsx +164 -0
  33. package/templates/nextjs/src/app/providers.tsx +16 -0
  34. package/templates/nextjs/src/lib/scim-auth.ts +12 -0
  35. package/templates/nextjs/src/lib/sso.ts +39 -0
  36. package/templates/nextjs/tsconfig.json +24 -0
  37. package/templates/php-laravel/.env.example +6 -0
  38. package/templates/php-laravel/composer.json +9 -0
  39. package/templates/php-laravel/public/index.php +34 -0
  40. package/templates/python-fastapi/.env.example +7 -0
  41. package/templates/python-fastapi/main.py +155 -0
  42. package/templates/python-fastapi/requirements.txt +6 -0
  43. package/templates/react-spa/.env.example +5 -0
  44. package/templates/react-spa/package.json +25 -0
  45. package/templates/react-spa/src/App.tsx +67 -0
  46. package/templates/react-spa/src/main.tsx +17 -0
  47. package/templates/vue-spa/.env.example +5 -0
  48. package/templates/vue-spa/package.json +20 -0
  49. package/templates/vue-spa/src/App.vue +57 -0
  50. package/templates/vue-spa/src/main.ts +14 -0
  51. package/README.md +0 -3
@@ -0,0 +1,6 @@
1
+ fastapi>=0.115.0
2
+ uvicorn[standard]>=0.30.0
3
+ httpx>=0.27.0
4
+ python-dotenv>=1.0.1
5
+ sso-id-python>=0.1.0
6
+
@@ -0,0 +1,5 @@
1
+ VITE_SSO_ID_DOMAIN=acme.sso.id
2
+ VITE_SSO_ID_CLIENT_ID=YOUR_SPA_CLIENT_ID
3
+ VITE_SSO_ID_REDIRECT_URI=http://localhost:5173/callback
4
+ VITE_API_BASE_URL=http://localhost:4000
5
+
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "sso-id-react-template",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "tsc && vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "dependencies": {
12
+ "@sso-id/react": "^0.1.0",
13
+ "@sso-id/ui": "^0.1.0",
14
+ "react": "^18.3.1",
15
+ "react-dom": "^18.3.1"
16
+ },
17
+ "devDependencies": {
18
+ "@types/react": "^18.3.0",
19
+ "@types/react-dom": "^18.3.0",
20
+ "@vitejs/plugin-react": "^4.3.0",
21
+ "typescript": "^5.6.0",
22
+ "vite": "^5.4.0"
23
+ }
24
+ }
25
+
@@ -0,0 +1,67 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { useSsoId } from '@sso-id/react';
3
+ import { SignInButton, UserMenu } from '@sso-id/ui';
4
+
5
+ const API = import.meta.env.VITE_API_BASE_URL || 'http://localhost:4000';
6
+
7
+ export default function App() {
8
+ const { isAuthenticated, user, getAccessTokenSilently } = useSsoId();
9
+ const [tab, setTab] = useState<'organizations' | 'organization-units' | 'users' | 'groups' | 'scim'>('organizations');
10
+ const [result, setResult] = useState<unknown>(null);
11
+ const [name, setName] = useState('');
12
+
13
+ async function apiFetch(path: string, init?: RequestInit) {
14
+ const token = await getAccessTokenSilently();
15
+ const res = await fetch(`${API}${path}`, {
16
+ ...init,
17
+ headers: {
18
+ 'Content-Type': 'application/json',
19
+ Authorization: `Bearer ${token}`,
20
+ ...(init?.headers || {}),
21
+ },
22
+ });
23
+ return res.json();
24
+ }
25
+
26
+ useEffect(() => {
27
+ if (!isAuthenticated) return;
28
+ const path = tab === 'scim' ? '/api/scim/events' : `/api/${tab}`;
29
+ apiFetch(path).then(setResult).catch(console.error);
30
+ }, [isAuthenticated, tab]);
31
+
32
+ async function handleCreate(e: React.FormEvent) {
33
+ e.preventDefault();
34
+ const path = tab === 'scim' ? '/api/scim/push-user' : `/api/${tab}`;
35
+ const body = tab === 'users' || tab === 'scim' ? { email: name, userName: name, displayName: name } : { name };
36
+ await apiFetch(path, { method: 'POST', body: JSON.stringify(body) });
37
+ setName('');
38
+ setResult(await apiFetch(tab === 'scim' ? '/api/scim/events' : `/api/${tab}`));
39
+ }
40
+
41
+ return (
42
+ <div style={{ maxWidth: 960, margin: '32px auto', fontFamily: 'system-ui, sans-serif', padding: 16 }}>
43
+ <header style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 24 }}>
44
+ <h1>SSO.ID React Starter (OIDC + Orgs/OUs/Users/Groups + SCIM)</h1>
45
+ {isAuthenticated ? <UserMenu /> : <SignInButton />}
46
+ </header>
47
+ {isAuthenticated && (
48
+ <>
49
+ <p>Signed in as <strong>{String(user?.email || user?.sub)}</strong></p>
50
+ <div style={{ display: 'flex', gap: 8, marginBottom: 16 }}>
51
+ {(['organizations', 'organization-units', 'users', 'groups', 'scim'] as const).map((t) => (
52
+ <button key={t} onClick={() => setTab(t)} style={{ padding: '6px 12px', fontWeight: tab === t ? 700 : 400 }}>
53
+ {t}
54
+ </button>
55
+ ))}
56
+ </div>
57
+ <form onSubmit={handleCreate} style={{ display: 'flex', gap: 8, marginBottom: 16 }}>
58
+ <input value={name} onChange={(e) => setName(e.target.value)} placeholder={tab === 'users' || tab === 'scim' ? 'email@acme.com' : 'Name'} required />
59
+ <button type="submit">Create</button>
60
+ </form>
61
+ <pre style={{ background: '#0f172a', color: '#e2e8f0', padding: 16, borderRadius: 8 }}>{JSON.stringify(result, null, 2)}</pre>
62
+ </>
63
+ )}
64
+ </div>
65
+ );
66
+ }
67
+
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom/client';
3
+ import { SsoIdProvider } from '@sso-id/react';
4
+ import App from './App';
5
+
6
+ ReactDOM.createRoot(document.getElementById('root')!).render(
7
+ <React.StrictMode>
8
+ <SsoIdProvider
9
+ domain={import.meta.env.VITE_SSO_ID_DOMAIN || 'acme.sso.id'}
10
+ clientId={import.meta.env.VITE_SSO_ID_CLIENT_ID || 'YOUR_CLIENT_ID'}
11
+ redirectUri={import.meta.env.VITE_SSO_ID_REDIRECT_URI || `${window.location.origin}/callback`}
12
+ >
13
+ <App />
14
+ </SsoIdProvider>
15
+ </React.StrictMode>,
16
+ );
17
+
@@ -0,0 +1,5 @@
1
+ VITE_SSO_ID_DOMAIN=acme.sso.id
2
+ VITE_SSO_ID_CLIENT_ID=YOUR_SPA_CLIENT_ID
3
+ VITE_SSO_ID_REDIRECT_URI=http://localhost:5173/callback
4
+ VITE_API_BASE_URL=http://localhost:4000
5
+
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "sso-id-vue-template",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vite build"
9
+ },
10
+ "dependencies": {
11
+ "@sso-id/vue": "^0.1.0",
12
+ "vue": "^3.5.0"
13
+ },
14
+ "devDependencies": {
15
+ "@vitejs/plugin-vue": "^5.1.0",
16
+ "typescript": "^5.6.0",
17
+ "vite": "^5.4.0"
18
+ }
19
+ }
20
+
@@ -0,0 +1,57 @@
1
+ <script setup lang="ts">
2
+ import { ref, watch } from 'vue';
3
+ import { useSsoId } from '@sso-id/vue';
4
+
5
+ const API = import.meta.env.VITE_API_BASE_URL || 'http://localhost:4000';
6
+ const { isAuthenticated, user, loginWithRedirect, logout, getAccessTokenSilently } = useSsoId();
7
+ const tab = ref<'organizations' | 'organization-units' | 'users' | 'groups' | 'scim'>('organizations');
8
+ const name = ref('');
9
+ const data = ref<unknown>(null);
10
+
11
+ async function apiFetch(path: string, init?: RequestInit) {
12
+ const token = await getAccessTokenSilently();
13
+ const res = await fetch(`${API}${path}`, {
14
+ ...init,
15
+ headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` },
16
+ });
17
+ return res.json();
18
+ }
19
+
20
+ async function refresh() {
21
+ if (!isAuthenticated.value) return;
22
+ data.value = await apiFetch(tab.value === 'scim' ? '/api/scim/events' : `/api/${tab.value}`);
23
+ }
24
+
25
+ watch([isAuthenticated, tab], refresh, { immediate: true });
26
+
27
+ async function createItem() {
28
+ const path = tab.value === 'scim' ? '/api/scim/push-user' : `/api/${tab.value}`;
29
+ const body = tab.value === 'users' || tab.value === 'scim' ? { email: name.value, userName: name.value, displayName: name.value } : { name: name.value };
30
+ await apiFetch(path, { method: 'POST', body: JSON.stringify(body) });
31
+ name.value = '';
32
+ await refresh();
33
+ }
34
+ </script>
35
+
36
+ <template>
37
+ <main style="max-width:960px;margin:32px auto;font-family:system-ui,sans-serif;padding:16px">
38
+ <header style="display:flex;justify-content:space-between;align-items:center;margin-bottom:24px">
39
+ <h1>SSO.ID Vue 3 Starter</h1>
40
+ <button v-if="!isAuthenticated" @click="loginWithRedirect()">Sign In with SSO.ID</button>
41
+ <button v-else @click="logout()">Sign Out ({{ user?.email || user?.sub }})</button>
42
+ </header>
43
+ <section v-if="isAuthenticated">
44
+ <div style="display:flex;gap:8px;margin-bottom:16px">
45
+ <button v-for="t in ['organizations', 'organization-units', 'users', 'groups', 'scim'] as const" :key="t" @click="tab = t">
46
+ {{ t }}
47
+ </button>
48
+ </div>
49
+ <form @submit.prevent="createItem" style="display:flex;gap:8px;margin-bottom:16px">
50
+ <input v-model="name" placeholder="Name or email" required />
51
+ <button type="submit">Create</button>
52
+ </form>
53
+ <pre style="background:#0f172a;color:#e2e8f0;padding:16px;border-radius:8px">{{ JSON.stringify(data, null, 2) }}</pre>
54
+ </section>
55
+ </main>
56
+ </template>
57
+
@@ -0,0 +1,14 @@
1
+ import { createApp } from 'vue';
2
+ import { createSsoId } from '@sso-id/vue';
3
+ import App from './App.vue';
4
+
5
+ const app = createApp(App);
6
+ app.use(
7
+ createSsoId({
8
+ domain: import.meta.env.VITE_SSO_ID_DOMAIN || 'acme.sso.id',
9
+ clientId: import.meta.env.VITE_SSO_ID_CLIENT_ID || 'YOUR_CLIENT_ID',
10
+ redirectUri: import.meta.env.VITE_SSO_ID_REDIRECT_URI || `${window.location.origin}/callback`,
11
+ }),
12
+ );
13
+ app.mount('#app');
14
+
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.