feat(sso): introduce authentication with SAML
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { Knex } from 'knex';
|
||||
|
||||
export async function up(knex: Knex): Promise<void> {
|
||||
return knex.schema.createTable('saml_auth_providers', (table) => {
|
||||
table.uuid('id').primary().defaultTo(knex.raw('gen_random_uuid()'));
|
||||
table.string('name').notNullable();
|
||||
table.text('certificate').notNullable();
|
||||
table.string('signature_algorithm').notNullable();
|
||||
table.string('issuer').notNullable();
|
||||
table.text('entry_point').notNullable();
|
||||
table.text('firstname_attribute_name').notNullable();
|
||||
table.text('surname_attribute_name').notNullable();
|
||||
table.text('email_attribute_name').notNullable();
|
||||
table.text('role_attribute_name').notNullable();
|
||||
table.uuid('default_role_id').references('id').inTable('roles');
|
||||
|
||||
table.timestamps(true, true);
|
||||
});
|
||||
}
|
||||
|
||||
export async function down(knex: Knex): Promise<void> {
|
||||
return knex.schema.dropTable('saml_auth_providers');
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
import { Knex } from 'knex';
|
||||
|
||||
export async function up(knex: Knex): Promise<void> {
|
||||
return knex.schema.createTable('identities', (table) => {
|
||||
table.uuid('id').primary().defaultTo(knex.raw('gen_random_uuid()'));
|
||||
table.uuid('user_id').references('id').inTable('users');
|
||||
table.string('remote_id').notNullable();
|
||||
table.string('provider_id').notNullable();
|
||||
table.string('provider_type').notNullable();
|
||||
|
||||
table.timestamps(true, true);
|
||||
});
|
||||
}
|
||||
|
||||
export async function down(knex: Knex): Promise<void> {
|
||||
return knex.schema.dropTable('identities');
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
import { Knex } from 'knex';
|
||||
|
||||
export async function up(knex: Knex): Promise<void> {
|
||||
return await knex.schema.alterTable('users', (table) => {
|
||||
table.string('password').nullable().alter();
|
||||
});
|
||||
}
|
||||
|
||||
export async function down(knex: Knex): Promise<void> {
|
||||
return await knex.schema.alterTable('users', table => {
|
||||
// what do we do? passwords cannot be left empty
|
||||
// table.string('password').notNullable().alter();
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user