@backstage/plugin-auth-backend 0.18.3-next.1 → 0.18.3-next.2
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.
- package/CHANGELOG.md +8 -0
- package/dist/index.cjs.js +85 -24
- package/dist/index.cjs.js.map +1 -1
- package/migrations/20230428155633_sessions.js +52 -0
- package/package.json +2 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 The Backstage Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// @ts-check
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {import('knex').Knex} knex
|
|
21
|
+
*/
|
|
22
|
+
exports.up = async function up(knex) {
|
|
23
|
+
// See https://github.com/gx0r/connect-session-knex
|
|
24
|
+
// Modeled loosely after https://github.com/gx0r/connect-session-knex/blob/4e0e36a9afbb13c3000a89f5e341f2d2d4339a02/lib/index.js#L114
|
|
25
|
+
// For simplicity we always make the session a string
|
|
26
|
+
// Do NOT change around this table or column names; the connect-session-knex library makes assumptions about them
|
|
27
|
+
await knex.schema.createTable('sessions', table => {
|
|
28
|
+
table.comment('Session data');
|
|
29
|
+
table.string('sid').primary().notNullable().comment('ID of the session');
|
|
30
|
+
table
|
|
31
|
+
.text('sess', 'longtext')
|
|
32
|
+
.notNullable()
|
|
33
|
+
.comment('Session data, JSON serialized');
|
|
34
|
+
table
|
|
35
|
+
.timestamp('expired')
|
|
36
|
+
.notNullable()
|
|
37
|
+
.comment('The point in time when the session expires');
|
|
38
|
+
table.index('sid', 'sessions_sid_idx');
|
|
39
|
+
table.index('expired', 'sessions_expired_idx');
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @param {import('knex').Knex} knex
|
|
45
|
+
*/
|
|
46
|
+
exports.down = async function down(knex) {
|
|
47
|
+
await knex.schema.alterTable('sessions', table => {
|
|
48
|
+
table.dropIndex([], 'sessions_sid_idx');
|
|
49
|
+
table.dropIndex([], 'sessions_expired_idx');
|
|
50
|
+
});
|
|
51
|
+
await knex.schema.dropTable('sessions');
|
|
52
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-auth-backend",
|
|
3
3
|
"description": "A Backstage backend plugin that handles authentication",
|
|
4
|
-
"version": "0.18.3-next.
|
|
4
|
+
"version": "0.18.3-next.2",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"@types/express": "^4.17.6",
|
|
45
45
|
"@types/passport": "^1.0.3",
|
|
46
46
|
"compression": "^1.7.4",
|
|
47
|
+
"connect-session-knex": "^3.0.1",
|
|
47
48
|
"cookie-parser": "^1.4.5",
|
|
48
49
|
"cors": "^2.8.5",
|
|
49
50
|
"express": "^4.17.1",
|