Added a auth.session.secret config value for setting the express session secret

This commit is contained in:
Brian Leathem
2020-11-19 09:11:13 -08:00
parent 52e79a0032
commit 5c485ff60f
3 changed files with 27 additions and 2 deletions
+2
View File
@@ -191,6 +191,8 @@ scaffolder:
$env: AZURE_TOKEN
auth:
session:
secret: yaml session secret
providers:
google:
development:
+22 -1
View File
@@ -71,5 +71,26 @@
"files": [
"dist",
"migrations"
]
],
"configSchema": {
"$schema": "https://backstage.io/schema/config-v1",
"title": "@backstage/auth-backend",
"type": "object",
"properties": {
"auth": {
"type": "object",
"properties": {
"session": {
"type": "object",
"properties": {
"secret": {
"type": "string",
"visibility": "secret"
}
}
}
}
}
}
}
}
+3 -1
View File
@@ -60,7 +60,9 @@ export async function createRouter({
});
const catalogApi = new CatalogClient({ discoveryApi: discovery });
const secret = 'backstage secret'; // TODO: Allow an override here
const secret =
config.getOptionalString('auth.session.secret') ?? 'backstage secret';
console.log('using secret', secret);
router.use(cookieParser(secret));
router.use(session({ secret, saveUninitialized: false, resave: false }));
router.use(express.urlencoded({ extended: false }));