Skip to content

Commit

Permalink
Move server secrets retrieval into secrets.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnaab committed Jul 12, 2024
1 parent 1d34742 commit fef924a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
8 changes: 6 additions & 2 deletions packages/server/auth.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { defineConfig } from 'auth-astro';

import { getServerSecrets } from './src/secrets';

const secrets = getServerSecrets((import.meta as any).env);

export default defineConfig({
secret: (import.meta as any).env.AUTH_SECRET,
secret: secrets.authSecret,
providers: [
/**
* https://dashboard.int.identitysandbox.gov/service_providers/5237
Expand All @@ -21,7 +25,7 @@ export default defineConfig({
issuer: 'https://idp.int.identitysandbox.gov',
clientId:
'urn:gov:gsa:openidconnect.profiles:sp:sso:gsa:tts-10x-atj-dev-server-doj',
clientSecret: (import.meta as any).env.SECRET_LOGIN_GOV_PRIVATE_KEY,
clientSecret: secrets.loginGov.clientSecret,
},
],
});
10 changes: 7 additions & 3 deletions packages/server/src/secrets.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
export type ServerSecrets = {
authSecret: string;
loginGov: {
//clientId: string;
clientSecret: string;
};
};

export const getServerSecrets = (env: ImportMetaEnv) => {
export const getServerSecrets = (env: ImportMetaEnv): ServerSecrets => {
return {
//clientId: 'urn:gov:gsa:openidconnect.profiles:sp:sso:gsa:tts-10x-atj-dev-server-doj',
clientSecret: (import.meta as any).env.SECRET_LOGIN_GOV_PRIVATE_KEY,
loginGov: {
//clientId: 'urn:gov:gsa:openidconnect.profiles:sp:sso:gsa:tts-10x-atj-dev-server-doj',
clientSecret: env.SECRET_LOGIN_GOV_PRIVATE_KEY,
},
authSecret: env.AUTH_SECRET,
};
};

0 comments on commit fef924a

Please sign in to comment.