/* * Copyright OpenSearch Contributors * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://www.apache.org/licenses/LICENSE-2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ import React, { useState } from 'react'; import { EuiInMemoryTable, EuiSearchBarProps, Query } from '@elastic/eui'; import { keys, map, get } from 'lodash'; import { PanelWithHeader } from '../../utils/panel-with-header'; import { renderExpression } from '../../utils/display-utils'; import { showTableStatusMessage } from '../../utils/loading-spinner-utils'; import { DocLinks } from '../../constants'; const columns = [ { field: 'order', name: 'Execution order', sortable: true, }, { field: 'domain_name', name: 'Domain name', }, { field: 'http_enabled', name: 'HTTP', }, { field: 'transport_enabled', name: 'TRANSPORT', }, { field: 'http_type', name: 'HTTP type', }, { field: 'http_challenge', name: 'HTTP challenge', }, { field: 'http_configuration', name: 'HTTP configuration', render: (config: object) => renderExpression('HTTP configuration', config), }, { field: 'backend_type', name: 'Backend type', }, { field: 'backend_configuration', name: 'Backend configuration', render: (config: object) => renderExpression('Backend configuration', config), }, ]; const ENABLED_STRING = 'Enabled'; const DISABLED_STRING = 'Disabled'; const TRUE_STRING = 'True'; const FALSE_STRING = 'False'; export function AuthenticationSequencePanel(props: { authc: []; loading: boolean }) { const [query, setQuery] = useState(null); const domains = keys(props.authc); const items = map(domains, function (domain: string) { const data = get(props.authc, domain); // @ts-ignore const httpAuthenticator = data.http_authenticator; // @ts-ignore const backend = data.authentication_backend; return { // @ts-ignore order: data.order, domain_name: domain, // @ts-ignore http_enabled: data.http_enabled ? ENABLED_STRING : DISABLED_STRING, // @ts-ignore transport_enabled: data.transport_enabled ? ENABLED_STRING : DISABLED_STRING, http_type: httpAuthenticator.type, http_challenge: httpAuthenticator.challenge ? TRUE_STRING : FALSE_STRING, http_configuration: httpAuthenticator.config, backend_type: backend.type, backend_configuration: backend.config, }; }); const search: EuiSearchBarProps = { box: { placeholder: 'Search authentication domain', }, onChange: (arg) => { setQuery(arg.query); return true; }, }; const headerText = 'Authentication sequences'; return ( ); }