mirror of
https://github.com/OpenCTI-Platform/opencti.git
synced 2025-12-22 08:17:08 +00:00
strategy attributes
This commit is contained in:
@@ -19,8 +19,6 @@ import { ABSTRACT_INTERNAL_OBJECT } from '../../schema/general';
|
||||
import type { StrategyType } from '../../config/providers-configuration';
|
||||
const isSingleSignOnEnabled = isFeatureEnabled('SINGLE_SIGN_ON_ENABLED');
|
||||
|
||||
export const getConfigurationKeyList = (strategy: StrategyType) => CONFIGURATION_MANDATORY_KEY_LIST[strategy];
|
||||
|
||||
// Create a function to check all mandatory fields before creation
|
||||
|
||||
export const getStrategyAttributes = (strategy: StrategyType) => {
|
||||
@@ -30,11 +28,29 @@ export const getStrategyAttributes = (strategy: StrategyType) => {
|
||||
// If this solution is used, maybe we will not have to keep the value on resolver : mandatoryFields
|
||||
// something like :
|
||||
/*
|
||||
const STRATEGY_ATTRIBUTES = {
|
||||
export enum AttributeType {
|
||||
STRING = 'string',
|
||||
NUMBER = 'number',
|
||||
BOOLEAN = 'boolean',
|
||||
STRATEGY_LDAP = 'LdapStrategy',
|
||||
}
|
||||
|
||||
type StrategyAttributesType = {
|
||||
["string"]: {
|
||||
key: string;
|
||||
displayName: string;
|
||||
type: AttributeType;
|
||||
mandatory: boolean;
|
||||
tooltip?: string;
|
||||
}
|
||||
}
|
||||
|
||||
const STRATEGY_ATTRIBUTES: StrategyAttributesType = {
|
||||
[StrategyType.STRATEGY_SAML]: [
|
||||
{ key: 'name', type: 'string', mandatory: true, order: 1 },
|
||||
{ key: 'description', type: 'string', mandatory: false, order: 2 },
|
||||
{ key: 'issuer', type: 'string', mandatory: true,; order: 3 },
|
||||
{ key: 'name', displayName: 'name', type: AttributeType.STRING , mandatory: true, order: 1 },
|
||||
{ key: 'description', displayName: 'description', type: AttributeType.BOOLEAN, mandatory: false, order: 2 },
|
||||
{ key: 'issuer', displayName: 'issuer', type: AttributeType.STRING, mandatory: true, order: 3 },
|
||||
{ key: 'cert', displayName: 'certificat', type: AttributeType.STRING, mandatory: true, order: 4, tooltip: 'Here is a tooltip' },
|
||||
{....}
|
||||
],
|
||||
[StrategyType.STRATEGY_LDAP]: [{....}],
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
import type { Resolvers } from '../../generated/graphql';
|
||||
import { findSingleSignOnById, findSingleSignOnPaginated, addSingleSignOn, fieldPatchSingleSignOn, deleteSingleSignOn, getConfigurationKeyList, getStrategyAttributes } from './SingleSignOn-domain';
|
||||
import { findSingleSignOnById, findSingleSignOnPaginated, addSingleSignOn, fieldPatchSingleSignOn, deleteSingleSignOn } from './SingleSignOn-domain';
|
||||
|
||||
const singleSignOnResolver: Resolvers = {
|
||||
Query: {
|
||||
singleSignOn: (_, { id }, context) => findSingleSignOnById(context, context.user, id),
|
||||
singleSignOns: (_, args, context) => findSingleSignOnPaginated(context, context.user, args),
|
||||
// singleSignOnAttributes: (_, { strategy }, context) => getStrategyAttributes(strategy),
|
||||
},
|
||||
SingleSignOn: {
|
||||
// used to have all mandatory fields for strategy
|
||||
mandatoryFields: (singleSignOn) => getConfigurationKeyList(singleSignOn.strategy),
|
||||
// to be fetched when strategy is selected in front
|
||||
// strategyAttributes: (_, { strategy }, context) => getStrategyAttributes(strategy),
|
||||
},
|
||||
Mutation: {
|
||||
singleSignOnAdd: (_, { input }, context) => {
|
||||
|
||||
@@ -22,17 +22,6 @@ interface GroupsManagement {
|
||||
read_userinfo: boolean;
|
||||
}
|
||||
|
||||
// # Examples : declare here specific keys for each type of SSO
|
||||
// SAML keys from notion :
|
||||
// Page : SSO in GUI - Overall task => resources => "List of fields to be included in each Auth Type"
|
||||
export const SAML_CONFIGURATION_MANDATORY_KEY_LIST = ['name', 'label', 'issuer', 'cert', 'saml_callback_url', 'entry_point'];
|
||||
// export const LDAP_CONFIGURATION_KEY_LIST = [];
|
||||
export const CONFIGURATION_MANDATORY_KEY_LIST = {
|
||||
[StrategyType.STRATEGY_SAML]: SAML_CONFIGURATION_MANDATORY_KEY_LIST,
|
||||
// [StrategyType.STRATEGY_LDAP]: LDAP_CONFIGURATION_KEY_LIST,
|
||||
// [...]
|
||||
}
|
||||
|
||||
export interface BasicStoreEntitySingleSignOn extends BasicStoreEntity {
|
||||
name: string;
|
||||
description: string;
|
||||
|
||||
Reference in New Issue
Block a user