Skip to content

Commit 92377fe

Browse files
committed
fix: stub ally config and prompt for ids
1 parent 6015100 commit 92377fe

File tree

3 files changed

+47
-5
lines changed

3 files changed

+47
-5
lines changed

.keycloakify/realm-kc-26.json

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,32 @@
597597
},
598598
"notBefore": 0,
599599
"groups": []
600+
},
601+
{
602+
"id": "2b6758d3-c4a0-4da4-8a79-3e03f0c14aa0",
603+
"username": "[email protected]",
604+
"email": "[email protected]",
605+
"emailVerified": true,
606+
"attributes": {
607+
"terms_and_conditions": ["1739720205"]
608+
},
609+
"createdTimestamp": 1739720199905,
610+
"enabled": true,
611+
"totp": false,
612+
"credentials": [
613+
{
614+
"id": "f0b1c6d2-d960-4efc-8cb3-45b043c092a7",
615+
"type": "password",
616+
"createdDate": 1739720199935,
617+
"secretData": "{\"value\":\"epLZZXTwNFWmKbz0sTLsBfaMPrvO1y5WNWrNWZbQVPA=\",\"salt\":\"/AWEEtdRbBcAYZQsBQJurA==\",\"additionalParameters\":{}}",
618+
"credentialData": "{\"hashIterations\":5,\"algorithm\":\"argon2\",\"additionalParameters\":{\"hashLength\":[\"32\"],\"memory\":[\"7168\"],\"type\":[\"id\"],\"version\":[\"1.3\"],\"parallelism\":[\"1\"]}}"
619+
}
620+
],
621+
"disableableCredentialTypes": [],
622+
"requiredActions": [],
623+
"realmRoles": ["default-roles-myrealm"],
624+
"notBefore": 0,
625+
"groups": []
600626
}
601627
],
602628
"scopeMappings": [
@@ -834,7 +860,7 @@
834860
"implicitFlowEnabled": false,
835861
"directAccessGrantsEnabled": true,
836862
"serviceAccountsEnabled": false,
837-
"publicClient": true,
863+
"publicClient": false,
838864
"frontchannelLogout": true,
839865
"protocol": "openid-connect",
840866
"attributes": {
@@ -884,7 +910,8 @@
884910
"phone",
885911
"offline_access",
886912
"microprofile-jwt"
887-
]
913+
],
914+
"secret": "a17c54tH8AmWC0yq7FSQbNpPp8wELqeN"
888915
},
889916
{
890917
"id": "e05cc68c-5e53-4796-ae3a-a1bfbf5c51bb",

packages/ally-solvro-auth/configure.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,36 @@ import { stubsRoot } from "./stubs/main.js";
1111
export async function configure(command: Configure) {
1212
const codemods = await command.createCodemods();
1313

14+
command.logger.info("Konfiguracja @solvro/auth");
15+
command.logger.info(
16+
"Żeby dostać CLIENT_ID i CLIENT_SECRET, zapytaj na #main i zpinguj @Bartosz Gotowski",
17+
);
18+
19+
const clientId = await command.prompt.ask("Jaki masz CLIENT_ID? ", {
20+
hint: "web-planer",
21+
});
22+
const clientSecret = await command.prompt.ask("Jaki masz CLIENT_SECRET? ", {
23+
hint: "a17c54tH8AmWC0yq7FSQbNpPp8wELqeN",
24+
});
25+
1426
await codemods.makeUsingStub(
1527
stubsRoot,
1628
"controllers/auth_controller.stub",
1729
{},
1830
);
19-
// env variables: APP_DOMAIN, SOLVRO_AUTH_CLIENT_ID
20-
// Add environment variables
31+
await codemods.makeUsingStub(stubsRoot, "config/ally.stub", {});
32+
2133
await codemods.defineEnvVariables({
2234
APP_DOMAIN: "http://localhost:3333",
23-
SOLVRO_AUTH_CLIENT_ID: "MY_CLIENT_ID",
35+
SOLVRO_AUTH_CLIENT_ID: clientId,
36+
SOLVRO_AUTH_CLIENT_SECRET: clientSecret,
2437
});
2538

2639
await codemods.defineEnvValidations({
2740
variables: {
2841
APP_DOMAIN: `Env.schema.string()`,
2942
SOLVRO_AUTH_CLIENT_ID: "Env.schema.string()",
43+
SOLVRO_AUTH_CLIENT_SECRET: "Env.schema.string.optional()",
3044
},
3145
leadingComment: "Variables for @solvro/auth",
3246
});

packages/ally-solvro-auth/stubs/config/ally.stub

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const allyConfig = defineConfig({
1111
solvroAuth: SolvroAuthDriverService({
1212
callbackUrl: `${env.get("APP_DOMAIN")}/auth/callback`,
1313
clientId: env.get("SOLVRO_AUTH_CLIENT_ID"),
14+
clientSecret: env.get("SOLVRO_AUTH_CLIENT_SECRET"),
1415
}),
1516
});
1617

0 commit comments

Comments
 (0)