feat: add role mappings for SAML configuration (#1210)

This commit is contained in:
Ömer Faruk Aydın
2023-08-11 19:07:39 +02:00
committed by GitHub
parent c7e1d30553
commit a6a124d2e6
8 changed files with 190 additions and 25 deletions

View File

@@ -3,6 +3,7 @@ import type { SamlConfig } from '@node-saml/passport-saml';
import appConfig from '../config/app';
import Base from './base';
import Identity from './identity.ee';
import SamlAuthProvidersRoleMapping from './saml-auth-providers-role-mapping.ee';
class SamlAuthProvider extends Base {
id!: string;
@@ -17,6 +18,7 @@ class SamlAuthProvider extends Base {
roleAttributeName: string;
defaultRoleId: string;
active: boolean;
samlAuthProvidersRoleMappings?: SamlAuthProvidersRoleMapping[];
static tableName = 'saml_auth_providers';
@@ -63,6 +65,14 @@ class SamlAuthProvider extends Base {
to: 'saml_auth_providers.id',
},
},
samlAuthProvidersRoleMappings: {
relation: Base.HasManyRelation,
modelClass: SamlAuthProvidersRoleMapping,
join: {
from: 'saml_auth_providers.id',
to: 'saml_auth_providers_role_mappings.saml_auth_provider_id',
},
},
});
get config(): SamlConfig {