Skip to content

Commit

Permalink
upd whitelist and minor fixes of secrets and res list
Browse files Browse the repository at this point in the history
  • Loading branch information
ikethecoder committed May 27, 2021
1 parent 926d509 commit 1512f25
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 51 deletions.
10 changes: 10 additions & 0 deletions src/authz/whitelist.json
Original file line number Diff line number Diff line change
Expand Up @@ -860,5 +860,15 @@
"referer": "http://localhost:4180/manager/products",
"query": "\n query GET {\n allProductsByNamespace {\n id\n name\n description\n organization {\n id\n title\n }\n organizationUnit {\n id\n title\n }\n dataset {\n name\n title\n notes\n sector\n license_title\n }\n environments {\n id\n name\n active\n flow\n services {\n id\n name\n host\n }\n credentialIssuer {\n name\n }\n }\n }\n }\n",
"added": "2021-05-26T17:29:08.072Z"
},
"e1b6fe1d5e8a6230fbda9f9afdff5c72": {
"referer": "http://localhost:4180/devportal/requests/new/60ae79b7bb408c4fefb33374",
"query": "\n mutation AddAccessRequest(\n $name: String!\n $controls: String\n $requestor: ID!\n $applicationId: ID!\n $productEnvironmentId: ID!\n $additionalDetails: String\n $acceptLegal: Boolean!\n ) {\n acceptLegal(\n productEnvironmentId: $productEnvironmentId\n acceptLegal: $acceptLegal\n ) {\n legalsAgreed\n }\n\n createAccessRequest(\n data: {\n name: $name\n controls: $controls\n additionalDetails: $additionalDetails\n requestor: { connect: { id: $requestor } }\n application: { connect: { id: $applicationId } }\n productEnvironment: { connect: { id: $productEnvironmentId } }\n }\n ) {\n id\n }\n }\n",
"added": "2021-05-27T16:25:46.020Z"
},
"cc8bbd6f18ffbbab95c1a7b0caaa52e6": {
"referer": "http://localhost:4180/devportal/access/609c5bf79b8ceca36d31ce95",
"query": "\n query GetResources($prodEnvId: ID!, $resourceType: String) {\n allResourceSets(prodEnvId: $prodEnvId, type: $resourceType) {\n id\n name\n type\n }\n\n allPermissionTickets(prodEnvId: $prodEnvId) {\n id\n owner\n ownerName\n requester\n requesterName\n resource\n resourceName\n scope\n scopeName\n granted\n }\n }\n",
"added": "2021-05-27T16:31:20.746Z"
}
}
12 changes: 3 additions & 9 deletions src/nextapp/components/resources-list/resources-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const ResourcesComponent: React.FC<ResourcesProps> = ({

return (
<>
{data?.getResourceSet == null && <Progress size="xs" isIndeterminate />}
{data?.allResourceSets == null && <Progress size="xs" isIndeterminate />}
<Table variant="simple">
<Thead>
<Tr>
Expand Down Expand Up @@ -83,14 +83,8 @@ const ResourcesComponent: React.FC<ResourcesProps> = ({
export default ResourcesComponent;

const query = gql`
query GetResources(
$prodEnvId: ID!
$resourceType: String
) {
allResourceSets(
prodEnvId: $prodEnvId
type: $resourceType
) {
query GetResources($prodEnvId: ID!, $resourceType: String) {
allResourceSets(prodEnvId: $prodEnvId, type: $resourceType) {
id
name
type
Expand Down
95 changes: 53 additions & 42 deletions src/nextapp/components/view-secret/view-secret.tsx
Original file line number Diff line number Diff line change
@@ -1,54 +1,65 @@
import * as React from 'react';
import {
Alert,
AlertTitle,
AlertDescription,
AlertIcon,
Box,
CloseButton,
Alert,
AlertTitle,
AlertDescription,
AlertIcon,
Box,
CloseButton,
} from '@chakra-ui/react';

import ReactMarkdownWithHtml from 'react-markdown/with-html';
import gfm from 'remark-gfm';

const { useEffect, useState } = React
const { useEffect, useState } = React;

function ViewSecret({cred, defaultShow, instruction, onClose}) {
const [show, setShow] = React.useState(defaultShow)
const handleClick = () => { setShow(!show); onClose() }

useEffect (() => setShow(true), [cred])
function ViewSecret({ cred, defaultShow, instruction, onClose }) {
const [show, setShow] = React.useState(defaultShow);
const handleClick = () => {
setShow(!show);
onClose();
};

return show ? (
<Alert
status="warning" p={4}
>
<AlertIcon/>
<Box flex="1">
<AlertTitle>
Your new credentials:
</AlertTitle>
<AlertDescription>
Take note of these credentials, you will only see them once.
{ instruction != null && (
<ReactMarkdownWithHtml allowDangerousHtml plugins={[gfm]}>{instruction}</ReactMarkdownWithHtml>
)}
{[
{name:'apiKey', label:'API Key'},
{name:'clientId', label:'Client ID'},
{name:'clientSecret', label:'Client Secret'},
{name:'clientPrivateKey', label:'Signing Private Key'},
{name:'clientPublicKey', label:'Signing Public Certificate'},
{name:'tokenEndpoint', label:'Token Endpoint'}
].filter(c => c.name in cred).map(c => (
<Box><strong>{c.label} :</strong> {cred[c.name]}</Box>
))}
</AlertDescription>
</Box>
<CloseButton position="absolute" right="8px" top="8px" onClick={handleClick}/>
</Alert>
useEffect(() => setShow(true), [cred]);

) : ( <></> )
return show ? (
<Alert status="warning" p={4}>
<AlertIcon />
<Box flex="1">
<AlertTitle>Your new credentials:</AlertTitle>
<AlertDescription>
Take note of these credentials, you will only see them once.
{instruction != null && (
<ReactMarkdownWithHtml allowDangerousHtml plugins={[gfm]}>
{instruction}
</ReactMarkdownWithHtml>
)}
{[
{ name: 'apiKey', label: 'API Key' },
{ name: 'clientId', label: 'Client ID' },
{ name: 'clientSecret', label: 'Client Secret' },
{ name: 'clientPrivateKey', label: 'Signing Private Key' },
{ name: 'clientPublicKey', label: 'Signing Public Certificate' },
{ name: 'tokenEndpoint', label: 'Token Endpoint' },
]
.filter((c) => c.name in cred && cred[c.name] != null)
.map((c) => (
<Box>
<strong>{c.label} :</strong> {cred[c.name]}
</Box>
))}
</AlertDescription>
</Box>
<CloseButton
position="absolute"
right="8px"
top="8px"
onClick={handleClick}
/>
</Alert>
) : (
<></>
);
}

export default ViewSecret
export default ViewSecret;

0 comments on commit 1512f25

Please sign in to comment.