Skip to content

Commit

Permalink
remove useless keycloak params
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeBu committed Dec 11, 2024
1 parent d0bbca1 commit e414259
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 44 deletions.
4 changes: 1 addition & 3 deletions api/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ const zConfiguration = z.object({
.object({
"url": z.string().nonempty(), //Example: https://auth.code.gouv.fr/auth (with the /auth at the end)
"realm": z.string().nonempty(),
"clientId": z.string().nonempty(),
"adminPassword": z.string().nonempty(),
"organizationUserProfileAttributeName": z.string().nonempty()
"clientId": z.string().nonempty()
})
.optional(),
"termsOfServiceUrl": zLocalizedString,
Expand Down
17 changes: 1 addition & 16 deletions api/src/rpc/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@ import type { User } from "./user";
export function createRouter(params: {
dbApi: DbApiV2;
useCases: UseCases;
keycloakParams:
| (KeycloakParams & {
organizationUserProfileAttributeName: string;
})
| undefined;
keycloakParams: KeycloakParams | undefined;
jwtClaimByUserKey: Record<keyof User, string>;
termsOfServiceUrl: LocalizedString;
readmeUrl: LocalizedString;
Expand Down Expand Up @@ -108,17 +104,6 @@ export function createRouter(params: {
return () => out;
})()
),
"getOrganizationUserProfileAttributeName": loggedProcedure.query(
(() => {
const { organizationUserProfileAttributeName } = keycloakParams ?? {};
if (organizationUserProfileAttributeName === undefined) {
return () => {
throw new TRPCError({ "code": "METHOD_NOT_SUPPORTED" });
};
}
return () => organizationUserProfileAttributeName;
})()
),
"getSoftwares": loggedProcedure.query(() => dbApi.software.getAll()),
"getInstances": loggedProcedure.query(() => dbApi.instance.getAll()),
"getExternalSoftwareOptions": loggedProcedure
Expand Down
5 changes: 1 addition & 4 deletions api/src/rpc/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ export async function startRpcService(params: {
url: string;
realm: string;
clientId: string;
adminPassword: string;
organizationUserProfileAttributeName: string;
};
termsOfServiceUrl: LocalizedString;
readmeUrl: LocalizedString;
Expand Down Expand Up @@ -112,8 +110,7 @@ export async function startRpcService(params: {
: {
"url": keycloakParams.url,
"realm": keycloakParams.realm,
"clientId": keycloakParams.clientId,
"organizationUserProfileAttributeName": keycloakParams.organizationUserProfileAttributeName
"clientId": keycloakParams.clientId
},
termsOfServiceUrl,
readmeUrl,
Expand Down
2 changes: 0 additions & 2 deletions deployments/docker-compose-example/.env.sample
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
SILL_KEYCLOAK_URL=http://localhost:8081/auth
SILL_KEYCLOAK_REALM=codegouv
SILL_KEYCLOAK_CLIENT_ID=sill
SILL_KEYCLOAK_ADMIN_PASSWORD=xxx
SILL_KEYCLOAK_ORGANIZATION_USER_PROFILE_ATTRIBUTE_NAME=agencyName
SILL_README_URL=https://raw.githubusercontent.com/codegouvfr/sill/refs/heads/main/README.md
SILL_TERMS_OF_SERVICE_URL=https://code.gouv.fr/sill/tos_fr.md
SILL_JWT_ID=sub
Expand Down
6 changes: 0 additions & 6 deletions web/src/core/adapter/sillApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ export function createSillApi(params: {
"getOidcParams": memoize(() => trpcClient.getOidcParams.query(), {
"promise": true
}),
"getOrganizationUserProfileAttributeName": memoize(
() => trpcClient.getOrganizationUserProfileAttributeName.query(),
{
"promise": true
}
),
"getSoftwares": memoize(() => trpcClient.getSoftwares.query(), {
"promise": true
}),
Expand Down
6 changes: 0 additions & 6 deletions web/src/core/adapter/sillApiMock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ export const sillApi: SillApi = {
}),
{ "promise": true }
),
"getOrganizationUserProfileAttributeName": memoize(
async () => {
throw new Error("not implemented");
},
{ "promise": true }
),
"getSoftwares": memoize(() => Promise.resolve([...softwares]), { "promise": true }),
"getInstances": memoize(
async () => {
Expand Down
6 changes: 0 additions & 6 deletions web/src/core/ports/SillApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ export type SillApi = {
>;
clear: () => void;
};
getOrganizationUserProfileAttributeName: {
(params: TrpcRouterInput["getOrganizationUserProfileAttributeName"]): Promise<
TrpcRouterOutput["getOrganizationUserProfileAttributeName"]
>;
clear: () => void;
};
getSoftwares: {
(params: TrpcRouterInput["getSoftwares"]): Promise<
TrpcRouterOutput["getSoftwares"]
Expand Down
1 change: 0 additions & 1 deletion web/src/core/usecases/userAuthentication/thunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export const thunks = {

const [, , { oidc }] = args;

console.log("asesrting user not logged : ", oidc.isUserLoggedIn);
assert(!oidc.isUserLoggedIn);

return oidc.login({ doesCurrentHrefRequiresAuth });
Expand Down

0 comments on commit e414259

Please sign in to comment.