Skip to content

Commit

Permalink
Merge pull request KelvinTegelaar#2618 from BNWEIN/dev
Browse files Browse the repository at this point in the history
Added Authentication Methods
  • Loading branch information
KelvinTegelaar authored Jul 3, 2024
2 parents 11901fa + fabdeff commit ab83f44
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/_nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ const _nav = [
name: 'App Consent Requests',
to: '/tenant/administration/app-consent-requests',
},
{
component: CNavItem,
name: 'Authentication Methods',
to: '/tenant/administration/authentication-methods',
},
{
component: CNavItem,
name: 'Tenant Onboarding',
Expand Down
7 changes: 6 additions & 1 deletion src/data/alerts.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,10 @@
"name": "DepTokenExpiry",
"label": "Alert on expiring DEP tokens",
"recommendedRunInterval": "1d"
},
{
"name": "SoftDeletedMailboxes",
"label": "Alert on soft deleted mailboxes",
"recommendedRunInterval": "1d"
}
]
]
1 change: 1 addition & 0 deletions src/importsMap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import React from 'react'
"/tenant/conditional/deploy-named-location": React.lazy(() => import('./views/tenant/conditional/DeployNamedLocation')),
"/tenant/conditional/list-template": React.lazy(() => import('./views/tenant/conditional/ListCATemplates')),
"/tenant/conditional/add-template": React.lazy(() => import('./views/tenant/conditional/AddCATemplate')),
"/tenant/administration/authentication-methods": React.lazy(() => import('./views/tenant/administration/AuthMethods')),
"/tenant/administration/list-licenses": React.lazy(() => import('./views/tenant/administration/ListLicences')),
"/tenant/administration/application-consent": React.lazy(() => import('./views/tenant/administration/ListOauthApps')),
"/tenant/standards/list-applied-standards": React.lazy(() => import('./views/tenant/standards/ListAppliedStandards')),
Expand Down
6 changes: 6 additions & 0 deletions src/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,12 @@
"component": "views/tenant/conditional/ConditionalAccess",
"allowedRoles": ["admin", "editor", "readonly"]
},
{
"path": "/tenant/administration/authentication-methods",
"name": "Authentication Methods",
"component": "views/tenant/administration/AuthMethods",
"allowedRoles": ["admin", "editor", "readonly"]
},
{
"path": "/tenant/conditional/deploy-vacation",
"name": "Deploy Vacation Mode",
Expand Down
141 changes: 141 additions & 0 deletions src/views/tenant/administration/AuthMethods.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
import React, { useState } from 'react'
import { CButton, CCardBody, CSpinner, CCard, CCardHeader, CCardTitle } from '@coreui/react'
import { useSelector } from 'react-redux'
import { faEllipsisV } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { CippPageList, CippPage } from 'src/components/layout'
import { TitleButton } from 'src/components/buttons'
import { CippActionsOffcanvas } from 'src/components/utilities'
import { useGenericGetRequestQuery } from 'src/store/api/app'
import { CippTable, cellBooleanFormatter } from 'src/components/tables'
import { CellTip, cellGenericFormatter } from 'src/components/tables/CellGenericFormat'

const Offcanvas = (row, rowIndex, formatExtraData) => {
const tenant = useSelector((state) => state.app.currentTenant)
const [ocVisible, setOCVisible] = useState(false)
const formatTargets = (targets) => {
if (Array.isArray(targets)) {
return targets.map((target) => JSON.stringify(target)).join(', ')
}
return targets
}

return (
<>
<CButton size="sm" color="link" onClick={() => setOCVisible(true)}>
<FontAwesomeIcon icon={faEllipsisV} />
</CButton>
<CippActionsOffcanvas
title="Extended Information"
extendedInfo={[
{ label: 'id', value: `${row.id}` },
{ label: 'state', value: `${row.state}` },
{ label: 'includeTargets', value: formatTargets(row.includeTargets) },
{ label: 'excludeTargets', value: formatTargets(row.excludeTargets) },
]}
actions={[
{
label: 'Enable Policy',
color: 'info',
modal: true,
modalType: 'POST',
modalBody: {
id: row.id,
state: 'enabled',
TenantFilter: tenant.defaultDomainName,
},
modalUrl: `/api/SetAuthMethod`,
modalMessage: 'Are you sure you want to enable this policy?',
},
{
label: 'Disable Policy',
color: 'info',
modal: true,
modalType: 'POST',
modalBody: {
id: row.id,
state: 'disabled',
TenantFilter: tenant.defaultDomainName,
},
modalUrl: `/api/SetAuthMethod`,
modalMessage: 'Are you sure you want to enable this policy?',
},
]}
placement="end"
visible={ocVisible}
id={row.id}
hideFunction={() => setOCVisible(false)}
/>
</>
)
}

const columns = [
{
name: 'id',
selector: (row) => row['id'],
sortable: true,
exportSelector: 'id',
},
{
name: 'state',
selector: (row) => row['state'],
cell: cellBooleanFormatter({ colourless: false }),
sortable: true,
exportSelector: 'state',
minWidth: '100px',
},
{
name: 'includeTargets',
selector: (row) => row['includeTargets'],
sortable: true,
cell: cellGenericFormatter(),
exportSelector: 'includeTargets',
},
{
name: 'excludeTargets',
selector: (row) => row['excludeTargets'],
sortable: true,
cell: cellGenericFormatter(),
exportSelector: 'excludeTargets',
},
{
name: 'Actions',
cell: Offcanvas,
},
]

const AuthenticationMethods = () => {
const tenant = useSelector((state) => state.app.currentTenant)
const { data, isFetching, error, isSuccess, refetch } = useGenericGetRequestQuery({
path: 'api/ListGraphRequest',
params: {
Endpoint: 'authenticationMethodsPolicy',
TenantFilter: tenant?.defaultDomainName,
},
})
return (
<>
<CippPage title="Auth Methods" tenantSelector={true}>
<CCard className="content-card">
<CCardHeader className="d-flex justify-content-between align-items-center">
<CCardTitle>Auth Methods</CCardTitle>
</CCardHeader>
<CCardBody>
{isFetching && <CSpinner />}
{isSuccess && (
<CippTable
reportName={`Auth Methods`}
data={data?.Results[0]?.authenticationMethodConfigurations}
columns={columns}
refreshFunction={() => refetch()}
/>
)}
</CCardBody>
</CCard>
</CippPage>
</>
)
}

export default AuthenticationMethods

0 comments on commit ab83f44

Please sign in to comment.