#26: Fixed app authentication issues
This commit is contained in:
+42
-19
@@ -21,6 +21,7 @@ import DialogTitle from '@material-ui/core/DialogTitle';
|
||||
import DialogActions from '@material-ui/core/DialogActions';
|
||||
import DialogContent from '@material-ui/core/DialogContent';
|
||||
|
||||
import CachedIcon from '@material-ui/icons/Cached';
|
||||
|
||||
const surfaceColor = "#27292D"
|
||||
const inputColor = "#383B40"
|
||||
@@ -305,6 +306,7 @@ const Admin = (props) => {
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success) {
|
||||
console.log(responseJson.data)
|
||||
setAuthentication(responseJson.data)
|
||||
} else {
|
||||
alert.error("Failed getting authentications")
|
||||
@@ -333,6 +335,7 @@ const Admin = (props) => {
|
||||
return response.json()
|
||||
})
|
||||
.then((responseJson) => {
|
||||
console.log(responseJson)
|
||||
setEnvironments(responseJson)
|
||||
})
|
||||
.catch(error => {
|
||||
@@ -536,7 +539,7 @@ const Admin = (props) => {
|
||||
<DialogContent>
|
||||
<div style={{display: "flex"}}>
|
||||
<TextField
|
||||
style={{backgroundColor: inputColor, flex: 3}}
|
||||
style={{marginTop: 0, backgroundColor: inputColor, flex: 3}}
|
||||
InputProps={{
|
||||
style:{
|
||||
height: 50,
|
||||
@@ -689,9 +692,10 @@ const Admin = (props) => {
|
||||
|
||||
const usersView = curTab === 0 ?
|
||||
<div>
|
||||
<h2>
|
||||
User management
|
||||
</h2>
|
||||
<div style={{marginTop: 20, marginBottom: 20,}}>
|
||||
<h2 style={{display: "inline",}}>User management</h2>
|
||||
<span style={{marginLeft: 25}}>Add, edit, block or change passwords</span>
|
||||
</div>
|
||||
<div/>
|
||||
<Button
|
||||
style={{}}
|
||||
@@ -791,9 +795,10 @@ const Admin = (props) => {
|
||||
|
||||
const schedulesView = curTab === 3 ?
|
||||
<div>
|
||||
<h2>
|
||||
Schedules
|
||||
</h2>
|
||||
<div style={{marginTop: 20, marginBottom: 20,}}>
|
||||
<h2 style={{display: "inline",}}>Schedules</h2>
|
||||
<span style={{marginLeft: 25}}>Schedules used in Workflows. Makes locating and control easier.</span>
|
||||
</div>
|
||||
<Divider style={{marginTop: 20, marginBottom: 20, backgroundColor: inputColor}}/>
|
||||
<List>
|
||||
<ListItem>
|
||||
@@ -839,9 +844,10 @@ const Admin = (props) => {
|
||||
|
||||
const authenticationView = curTab === 1 ?
|
||||
<div>
|
||||
<h2>
|
||||
App Authentication
|
||||
</h2>
|
||||
<div style={{marginTop: 20, marginBottom: 20,}}>
|
||||
<h2 style={{display: "inline",}}>App Authentication</h2>
|
||||
<span style={{marginLeft: 25}}>Control the authentication options for individual apps. <b>Actions can be destructive!</b></span>
|
||||
</div>
|
||||
<Divider style={{marginTop: 20, marginBottom: 20, backgroundColor: inputColor}}/>
|
||||
<List>
|
||||
<ListItem>
|
||||
@@ -851,7 +857,7 @@ const Admin = (props) => {
|
||||
/>
|
||||
<ListItemText
|
||||
primary="Label"
|
||||
style={{minWidth: 150, maxWidth: 150}}
|
||||
style={{minWidth: 250, maxWidth: 250}}
|
||||
/>
|
||||
<ListItemText
|
||||
primary="App Name"
|
||||
@@ -867,7 +873,7 @@ const Admin = (props) => {
|
||||
/>
|
||||
<ListItemText
|
||||
primary="Fields"
|
||||
style={{minWidth: 320, maxWidth: 320, overflow: "hidden"}}
|
||||
style={{minWidth: 200, maxWidth: 200, overflow: "hidden"}}
|
||||
/>
|
||||
<ListItemText
|
||||
primary="Actions"
|
||||
@@ -882,7 +888,7 @@ const Admin = (props) => {
|
||||
/>
|
||||
<ListItemText
|
||||
primary={data.label}
|
||||
style={{minWidth: 150, maxWidth: 150}}
|
||||
style={{minWidth: 250, maxWidth: 250}}
|
||||
/>
|
||||
<ListItemText
|
||||
primary={data.app.name}
|
||||
@@ -900,7 +906,7 @@ const Admin = (props) => {
|
||||
primary={data.fields.map(data => {
|
||||
return data.key
|
||||
}).join(", ")}
|
||||
style={{minWidth: 320, maxWidth: 320, overflow: "hidden"}}
|
||||
style={{minWidth: 200, maxWidth: 200, overflow: "hidden"}}
|
||||
/>
|
||||
<ListItemText>
|
||||
<Button
|
||||
@@ -923,9 +929,10 @@ const Admin = (props) => {
|
||||
|
||||
const environmentView = curTab === 2 ?
|
||||
<div>
|
||||
<h2>
|
||||
Environments
|
||||
</h2>
|
||||
<div style={{marginTop: 20, marginBottom: 20,}}>
|
||||
<h2 style={{display: "inline",}}>Environments</h2>
|
||||
<span style={{marginLeft: 25}}>Decides what Orborus environment to execute an action in a workflow in.</span>
|
||||
</div>
|
||||
<Button
|
||||
style={{}}
|
||||
variant="contained"
|
||||
@@ -934,6 +941,14 @@ const Admin = (props) => {
|
||||
>
|
||||
Add environment
|
||||
</Button>
|
||||
<Button
|
||||
style={{marginLeft: 5, }}
|
||||
variant="contained"
|
||||
color="primary"
|
||||
onClick={() => getEnvironments()}
|
||||
>
|
||||
<CachedIcon />
|
||||
</Button>
|
||||
<Divider style={{marginTop: 20, marginBottom: 20, backgroundColor: inputColor}}/>
|
||||
<List>
|
||||
<ListItem>
|
||||
@@ -941,6 +956,10 @@ const Admin = (props) => {
|
||||
primary="Name"
|
||||
style={{minWidth: 150, maxWidth: 150}}
|
||||
/>
|
||||
<ListItemText
|
||||
primary="Orborus running (TBD)"
|
||||
style={{minWidth: 200, maxWidth: 200}}
|
||||
/>
|
||||
<ListItemText
|
||||
primary="Actions"
|
||||
style={{minWidth: 150, maxWidth: 150}}
|
||||
@@ -953,6 +972,10 @@ const Admin = (props) => {
|
||||
primary={environment.Name}
|
||||
style={{minWidth: 150, maxWidth: 150, overflow: "hidden"}}
|
||||
/>
|
||||
<ListItemText
|
||||
primary={"TBD"}
|
||||
style={{minWidth: 200, maxWidth: 200, overflow: "hidden"}}
|
||||
/>
|
||||
<ListItemText>
|
||||
<Button type="outlined" style={{borderRadius: "0px"}} onClick={() => deleteEnvironment(environment.Name)} color="primary">Delete</Button>
|
||||
</ListItemText>
|
||||
@@ -960,11 +983,11 @@ const Admin = (props) => {
|
||||
)
|
||||
})}
|
||||
</List>
|
||||
|
||||
|
||||
</div>
|
||||
: null
|
||||
|
||||
// primary={environment.Registered ? "true" : "false"}
|
||||
|
||||
const setConfig = (event, newValue) => {
|
||||
if (newValue === 1) {
|
||||
getAppAuthentication()
|
||||
|
||||
@@ -54,6 +54,7 @@ import KeyboardArrowLeftIcon from '@material-ui/icons/KeyboardArrowLeft';
|
||||
import KeyboardArrowRightIcon from '@material-ui/icons/KeyboardArrowRight';
|
||||
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
||||
import SettingsIcon from '@material-ui/icons/Settings';
|
||||
import LockOpenIcon from '@material-ui/icons/LockOpen';
|
||||
|
||||
import * as cytoscape from 'cytoscape';
|
||||
import * as edgehandles from 'cytoscape-edgehandles';
|
||||
@@ -926,7 +927,9 @@ const AngularWorkflow = (props) => {
|
||||
|
||||
const newfields = {}
|
||||
for (var filterkey in item.fields) {
|
||||
newfields[item.fields[filterkey].key] = item.fields[filterkey].value
|
||||
if (item.fields[filterkey] !== undefined) {
|
||||
newfields[item.fields[filterkey].key] = item.fields[filterkey].value
|
||||
}
|
||||
}
|
||||
|
||||
item.fields = newfields
|
||||
@@ -2585,9 +2588,10 @@ const AngularWorkflow = (props) => {
|
||||
if (!selectedAction.auth_not_required && selectedAction.selectedAuthentication !== undefined && selectedAction.selectedAuthentication.fields !== undefined) {
|
||||
if (selectedAction.selectedAuthentication.fields[data.name] !== undefined) {
|
||||
// FIXME - this should be skipped in the frontend
|
||||
selectedActionParameters[count].value = selectedAction.selectedAuthentication.fields[data.name]
|
||||
selectedAction.parameters[count].value = selectedAction.selectedAuthentication.fields[data.name]
|
||||
setSelectedAction(selectedAction)
|
||||
//selectedActionParameters[count].value = selectedAction.selectedAuthentication.fields[data.name]
|
||||
//selectedAction.parameters[count].value = selectedAction.selectedAuthentication.fields[data.name]
|
||||
//setSelectedAction(selectedAction)
|
||||
|
||||
return null
|
||||
}
|
||||
}
|
||||
@@ -2757,8 +2761,16 @@ const AngularWorkflow = (props) => {
|
||||
}
|
||||
return (
|
||||
<div key={data.name}>
|
||||
<div style={{marginTop: "20px", marginBottom: "7px", display: "flex"}}>
|
||||
<div style={{width: "17px", height: "17px", borderRadius: 17 / 2, backgroundColor: itemColor, marginRight: "10px"}}/>
|
||||
<div style={{marginTop: 20, marginBottom: 7, display: "flex"}}>
|
||||
{data.configuration === true ?
|
||||
<Tooltip color="primary" title={`Authenticate ${selectedApp.name}`} placement="top">
|
||||
<LockOpenIcon style={{cursor: "pointer", width: 24, height: 24, marginRight: 10, }} onClick={() => {
|
||||
setAuthenticationModalOpen(true)
|
||||
}}/>
|
||||
</Tooltip>
|
||||
:
|
||||
<div style={{width: 17, height: 17, borderRadius: 17 / 2, backgroundColor: itemColor, marginRight: 10}}/>
|
||||
}
|
||||
<div style={{flex: "10"}}>
|
||||
<b>{data.name} </b>
|
||||
</div>
|
||||
@@ -3036,7 +3048,7 @@ const AngularWorkflow = (props) => {
|
||||
/>
|
||||
{selectedAction.authentication.length === 0 && requiresAuthentication ?
|
||||
<div style={{marginTop: 15}}>
|
||||
Authentication (reusable):
|
||||
Authenticate {selectedApp.name}:
|
||||
<Tooltip color="primary" title={"Add authentication option"} placement="top">
|
||||
<Button color="primary" style={{}} variant="text" onClick={() => {
|
||||
setAuthenticationModalOpen(true)
|
||||
@@ -5440,25 +5452,27 @@ const AngularWorkflow = (props) => {
|
||||
selectedAction.selectedAuthentication = authenticationOption
|
||||
selectedAction.authentication.push(authenticationOption)
|
||||
setSelectedAction(selectedAction)
|
||||
setUpdate(authenticationOption.id)
|
||||
|
||||
var newAuthOption = JSON.parse(JSON.stringify(authenticationOption))
|
||||
var newFields = []
|
||||
for (const key in authenticationOption.fields) {
|
||||
const value = authenticationOption.fields[key]
|
||||
for (const key in newAuthOption.fields) {
|
||||
const value = newAuthOption.fields[key]
|
||||
newFields.push({
|
||||
key: key,
|
||||
value: value,
|
||||
})
|
||||
}
|
||||
|
||||
authenticationOption.fields = newFields
|
||||
setNewAppAuth(authenticationOption)
|
||||
newAuthOption.fields = newFields
|
||||
setNewAppAuth(newAuthOption)
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<DialogContent>
|
||||
<a href="https://shuffler.io/docs/apps#authentication" style={{textDecoration: "none", color: "#f85a3e"}}>What is this?</a>
|
||||
These are required fields for authenticating with TheHive
|
||||
These are required fields for authenticating with {selectedApp.name}
|
||||
<div style={{marginTop: 15}}/>
|
||||
{selectedApp.link.length > 0 ? <EndpointData /> : null}
|
||||
Label (to remember it)
|
||||
|
||||
Reference in New Issue
Block a user