#26: Fixed app authentication issues
This commit is contained in:
+85
-29
@@ -122,16 +122,17 @@ type WorkflowApp struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type WorkflowAppActionParameter struct {
|
type WorkflowAppActionParameter struct {
|
||||||
Description string `json:"description" datastore:"description" yaml:"description"`
|
Description string `json:"description" datastore:"description" yaml:"description"`
|
||||||
ID string `json:"id" datastore:"id" yaml:"id,omitempty"`
|
ID string `json:"id" datastore:"id" yaml:"id,omitempty"`
|
||||||
Name string `json:"name" datastore:"name" yaml:"name"`
|
Name string `json:"name" datastore:"name" yaml:"name"`
|
||||||
Example string `json:"example" datastore:"example" yaml:"example"`
|
Example string `json:"example" datastore:"example" yaml:"example"`
|
||||||
Value string `json:"value" datastore:"value" yaml:"value,omitempty"`
|
Value string `json:"value" datastore:"value" yaml:"value,omitempty"`
|
||||||
Multiline bool `json:"multiline" datastore:"multiline" yaml:"multiline"`
|
Multiline bool `json:"multiline" datastore:"multiline" yaml:"multiline"`
|
||||||
ActionField string `json:"action_field" datastore:"action_field" yaml:"actionfield,omitempty"`
|
ActionField string `json:"action_field" datastore:"action_field" yaml:"actionfield,omitempty"`
|
||||||
Variant string `json:"variant" datastore:"variant" yaml:"variant,omitempty"`
|
Variant string `json:"variant" datastore:"variant" yaml:"variant,omitempty"`
|
||||||
Required bool `json:"required" datastore:"required" yaml:"required"`
|
Required bool `json:"required" datastore:"required" yaml:"required"`
|
||||||
Schema SchemaDefinition `json:"schema" datastore:"schema" yaml:"schema"`
|
Configuration bool `json:"configuration" datastore:"configuration" yaml:"configuration"`
|
||||||
|
Schema SchemaDefinition `json:"schema" datastore:"schema" yaml:"schema"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SchemaDefinition struct {
|
type SchemaDefinition struct {
|
||||||
@@ -621,6 +622,7 @@ func handleGetWorkflowqueueConfirm(resp http.ResponseWriter, request *http.Reque
|
|||||||
resp.Write([]byte("OK"))
|
resp.Write([]byte("OK"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: Authenticate this one (especially since we have a default: shuffle)
|
||||||
func handleGetWorkflowqueue(resp http.ResponseWriter, request *http.Request) {
|
func handleGetWorkflowqueue(resp http.ResponseWriter, request *http.Request) {
|
||||||
cors := handleCors(resp, request)
|
cors := handleCors(resp, request)
|
||||||
if cors {
|
if cors {
|
||||||
@@ -1410,7 +1412,6 @@ func updateAppAuth(auth AppAuthenticationStorage, workflowId, nodeId string, add
|
|||||||
// Check if node exists
|
// Check if node exists
|
||||||
workflowFound = true
|
workflowFound = true
|
||||||
workflowIndex = index
|
workflowIndex = index
|
||||||
log.Printf("Found workflow: %#v", workflow)
|
|
||||||
for _, actionId := range workflow.Nodes {
|
for _, actionId := range workflow.Nodes {
|
||||||
if actionId == nodeId {
|
if actionId == nodeId {
|
||||||
nodeFound = true
|
nodeFound = true
|
||||||
@@ -1721,19 +1722,18 @@ func saveWorkflow(resp http.ResponseWriter, request *http.Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Check auth
|
// Check auth
|
||||||
|
// 1. Find the auth in question
|
||||||
|
// 2. Update the node and workflow info in the auth
|
||||||
|
// 3. Get the values in the auth and add them to the action values
|
||||||
if len(action.AuthenticationId) > 0 {
|
if len(action.AuthenticationId) > 0 {
|
||||||
authFound := false
|
authFound := false
|
||||||
|
|
||||||
for _, auth := range allAuths {
|
for _, auth := range allAuths {
|
||||||
if auth.Id == action.AuthenticationId {
|
if auth.Id == action.AuthenticationId {
|
||||||
authFound = true
|
authFound = true
|
||||||
|
|
||||||
// Fix stuff here
|
// Updates the auth item itself IF necessary
|
||||||
err := updateAppAuth(auth, workflow.ID, action.ID, true)
|
go updateAppAuth(auth, workflow.ID, action.ID, true)
|
||||||
if err != nil {
|
|
||||||
log.Printf("Failed updating the app auth reference: %s (not critical)", err)
|
|
||||||
}
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1796,9 +1796,6 @@ func saveWorkflow(resp http.ResponseWriter, request *http.Request) {
|
|||||||
for _, param := range curappaction.Parameters {
|
for _, param := range curappaction.Parameters {
|
||||||
found := false
|
found := false
|
||||||
|
|
||||||
// FIXME: Check if the name exists in authentication.parameters and doesn't use the auth required field
|
|
||||||
// If it does, the auth should be saved somehow.
|
|
||||||
|
|
||||||
// Handles check for parameter exists + value not empty in used fields
|
// Handles check for parameter exists + value not empty in used fields
|
||||||
for _, actionParam := range action.Parameters {
|
for _, actionParam := range action.Parameters {
|
||||||
if actionParam.Name == param.Name {
|
if actionParam.Name == param.Name {
|
||||||
@@ -1817,6 +1814,7 @@ func saveWorkflow(resp http.ResponseWriter, request *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
newParams = append(newParams, actionParam)
|
newParams = append(newParams, actionParam)
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2308,6 +2306,8 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf
|
|||||||
// FIXME - remove this?
|
// FIXME - remove this?
|
||||||
newActions := []Action{}
|
newActions := []Action{}
|
||||||
defaultResults := []ActionResult{}
|
defaultResults := []ActionResult{}
|
||||||
|
|
||||||
|
allAuths := []AppAuthenticationStorage{}
|
||||||
for _, action := range workflowExecution.Workflow.Actions {
|
for _, action := range workflowExecution.Workflow.Actions {
|
||||||
action.LargeImage = ""
|
action.LargeImage = ""
|
||||||
if action.ID == workflowExecution.Start {
|
if action.ID == workflowExecution.Start {
|
||||||
@@ -2319,6 +2319,47 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf
|
|||||||
return WorkflowExecution{}, fmt.Sprintf("Environment is not defined for %s", action.Name), errors.New("Environment not defined!")
|
return WorkflowExecution{}, fmt.Sprintf("Environment is not defined for %s", action.Name), errors.New("Environment not defined!")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: Authentication parameters
|
||||||
|
if len(action.AuthenticationId) > 0 {
|
||||||
|
if len(allAuths) == 0 {
|
||||||
|
allAuths, err = getAllWorkflowAppAuth(ctx)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Api authentication failed in get all app auth: %s", err)
|
||||||
|
return WorkflowExecution{}, fmt.Sprintf("Api authentication failed in get all app auth: %s", err), err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
curAuth := AppAuthenticationStorage{Id: ""}
|
||||||
|
for _, auth := range allAuths {
|
||||||
|
if auth.Id == action.AuthenticationId {
|
||||||
|
curAuth = auth
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(curAuth.Id) == 0 {
|
||||||
|
return WorkflowExecution{}, fmt.Sprintf("Auth ID %s doesn't exist", action.AuthenticationId), errors.New(fmt.Sprintf("Auth ID %s doesn't exist", action.AuthenticationId))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rebuild params with the right data. This is to prevent issues on the frontend
|
||||||
|
newParams := []WorkflowAppActionParameter{}
|
||||||
|
for _, param := range action.Parameters {
|
||||||
|
|
||||||
|
for _, authparam := range curAuth.Fields {
|
||||||
|
if param.Name == authparam.Key {
|
||||||
|
log.Printf("Name: %s - value: %s", param.Name, param.Value)
|
||||||
|
param.Value = authparam.Value
|
||||||
|
log.Printf("Name: %s - value: %s\n", param.Name, param.Value)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
newParams = append(newParams, param)
|
||||||
|
}
|
||||||
|
|
||||||
|
action.Parameters = newParams
|
||||||
|
}
|
||||||
|
|
||||||
newActions = append(newActions, action)
|
newActions = append(newActions, action)
|
||||||
|
|
||||||
// If the node is NOT found, it's supposed to be set to SKIPPED,
|
// If the node is NOT found, it's supposed to be set to SKIPPED,
|
||||||
@@ -3471,8 +3512,8 @@ func getAppAuthentication(resp http.ResponseWriter, request *http.Request) {
|
|||||||
//}
|
//}
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
allAuths, err := getAllWorkflowAppAuth(ctx)
|
allAuths, err := getAllWorkflowAppAuth(ctx)
|
||||||
if userErr != nil {
|
if err != nil {
|
||||||
log.Printf("Api authentication failed in get all app auth: %s", userErr)
|
log.Printf("Api authentication failed in get all app auth: %s", err)
|
||||||
resp.WriteHeader(401)
|
resp.WriteHeader(401)
|
||||||
resp.Write([]byte(`{"success": false}`))
|
resp.Write([]byte(`{"success": false}`))
|
||||||
return
|
return
|
||||||
@@ -3484,6 +3525,17 @@ func getAppAuthentication(resp http.ResponseWriter, request *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cleanup for frontend
|
||||||
|
newAuth := []AppAuthenticationStorage{}
|
||||||
|
for _, auth := range allAuths {
|
||||||
|
newAuthField := auth
|
||||||
|
for index, _ := range auth.Fields {
|
||||||
|
newAuthField.Fields[index].Value = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
newAuth = append(newAuth, newAuthField)
|
||||||
|
}
|
||||||
|
|
||||||
newbody, err := json.Marshal(allAuths)
|
newbody, err := json.Marshal(allAuths)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed unmarshalling all app auths: %s", err)
|
log.Printf("Failed unmarshalling all app auths: %s", err)
|
||||||
@@ -4586,20 +4638,24 @@ func iterateAppGithubFolders(fs billy.Filesystem, dir []os.FileInfo, extra strin
|
|||||||
appendParams := []WorkflowAppActionParameter{}
|
appendParams := []WorkflowAppActionParameter{}
|
||||||
for _, fieldname := range workflowapp.Authentication.Parameters {
|
for _, fieldname := range workflowapp.Authentication.Parameters {
|
||||||
found := false
|
found := false
|
||||||
for _, param := range action.Parameters {
|
for index, param := range action.Parameters {
|
||||||
if param.Name == fieldname.Name {
|
if param.Name == fieldname.Name {
|
||||||
found = true
|
found = true
|
||||||
|
|
||||||
|
action.Parameters[index].Configuration = true
|
||||||
|
log.Printf("Set config to true for field %s!", param.Name)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !found {
|
if !found {
|
||||||
appendParams = append(appendParams, WorkflowAppActionParameter{
|
appendParams = append(appendParams, WorkflowAppActionParameter{
|
||||||
Name: fieldname.Name,
|
Name: fieldname.Name,
|
||||||
Description: fieldname.Description,
|
Description: fieldname.Description,
|
||||||
Example: fieldname.Example,
|
Example: fieldname.Example,
|
||||||
Required: fieldname.Required,
|
Required: fieldname.Required,
|
||||||
Schema: fieldname.Schema,
|
Configuration: true,
|
||||||
|
Schema: fieldname.Schema,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+42
-19
@@ -21,6 +21,7 @@ import DialogTitle from '@material-ui/core/DialogTitle';
|
|||||||
import DialogActions from '@material-ui/core/DialogActions';
|
import DialogActions from '@material-ui/core/DialogActions';
|
||||||
import DialogContent from '@material-ui/core/DialogContent';
|
import DialogContent from '@material-ui/core/DialogContent';
|
||||||
|
|
||||||
|
import CachedIcon from '@material-ui/icons/Cached';
|
||||||
|
|
||||||
const surfaceColor = "#27292D"
|
const surfaceColor = "#27292D"
|
||||||
const inputColor = "#383B40"
|
const inputColor = "#383B40"
|
||||||
@@ -305,6 +306,7 @@ const Admin = (props) => {
|
|||||||
})
|
})
|
||||||
.then((responseJson) => {
|
.then((responseJson) => {
|
||||||
if (responseJson.success) {
|
if (responseJson.success) {
|
||||||
|
console.log(responseJson.data)
|
||||||
setAuthentication(responseJson.data)
|
setAuthentication(responseJson.data)
|
||||||
} else {
|
} else {
|
||||||
alert.error("Failed getting authentications")
|
alert.error("Failed getting authentications")
|
||||||
@@ -333,6 +335,7 @@ const Admin = (props) => {
|
|||||||
return response.json()
|
return response.json()
|
||||||
})
|
})
|
||||||
.then((responseJson) => {
|
.then((responseJson) => {
|
||||||
|
console.log(responseJson)
|
||||||
setEnvironments(responseJson)
|
setEnvironments(responseJson)
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
@@ -536,7 +539,7 @@ const Admin = (props) => {
|
|||||||
<DialogContent>
|
<DialogContent>
|
||||||
<div style={{display: "flex"}}>
|
<div style={{display: "flex"}}>
|
||||||
<TextField
|
<TextField
|
||||||
style={{backgroundColor: inputColor, flex: 3}}
|
style={{marginTop: 0, backgroundColor: inputColor, flex: 3}}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
style:{
|
style:{
|
||||||
height: 50,
|
height: 50,
|
||||||
@@ -689,9 +692,10 @@ const Admin = (props) => {
|
|||||||
|
|
||||||
const usersView = curTab === 0 ?
|
const usersView = curTab === 0 ?
|
||||||
<div>
|
<div>
|
||||||
<h2>
|
<div style={{marginTop: 20, marginBottom: 20,}}>
|
||||||
User management
|
<h2 style={{display: "inline",}}>User management</h2>
|
||||||
</h2>
|
<span style={{marginLeft: 25}}>Add, edit, block or change passwords</span>
|
||||||
|
</div>
|
||||||
<div/>
|
<div/>
|
||||||
<Button
|
<Button
|
||||||
style={{}}
|
style={{}}
|
||||||
@@ -791,9 +795,10 @@ const Admin = (props) => {
|
|||||||
|
|
||||||
const schedulesView = curTab === 3 ?
|
const schedulesView = curTab === 3 ?
|
||||||
<div>
|
<div>
|
||||||
<h2>
|
<div style={{marginTop: 20, marginBottom: 20,}}>
|
||||||
Schedules
|
<h2 style={{display: "inline",}}>Schedules</h2>
|
||||||
</h2>
|
<span style={{marginLeft: 25}}>Schedules used in Workflows. Makes locating and control easier.</span>
|
||||||
|
</div>
|
||||||
<Divider style={{marginTop: 20, marginBottom: 20, backgroundColor: inputColor}}/>
|
<Divider style={{marginTop: 20, marginBottom: 20, backgroundColor: inputColor}}/>
|
||||||
<List>
|
<List>
|
||||||
<ListItem>
|
<ListItem>
|
||||||
@@ -839,9 +844,10 @@ const Admin = (props) => {
|
|||||||
|
|
||||||
const authenticationView = curTab === 1 ?
|
const authenticationView = curTab === 1 ?
|
||||||
<div>
|
<div>
|
||||||
<h2>
|
<div style={{marginTop: 20, marginBottom: 20,}}>
|
||||||
App Authentication
|
<h2 style={{display: "inline",}}>App Authentication</h2>
|
||||||
</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}}/>
|
<Divider style={{marginTop: 20, marginBottom: 20, backgroundColor: inputColor}}/>
|
||||||
<List>
|
<List>
|
||||||
<ListItem>
|
<ListItem>
|
||||||
@@ -851,7 +857,7 @@ const Admin = (props) => {
|
|||||||
/>
|
/>
|
||||||
<ListItemText
|
<ListItemText
|
||||||
primary="Label"
|
primary="Label"
|
||||||
style={{minWidth: 150, maxWidth: 150}}
|
style={{minWidth: 250, maxWidth: 250}}
|
||||||
/>
|
/>
|
||||||
<ListItemText
|
<ListItemText
|
||||||
primary="App Name"
|
primary="App Name"
|
||||||
@@ -867,7 +873,7 @@ const Admin = (props) => {
|
|||||||
/>
|
/>
|
||||||
<ListItemText
|
<ListItemText
|
||||||
primary="Fields"
|
primary="Fields"
|
||||||
style={{minWidth: 320, maxWidth: 320, overflow: "hidden"}}
|
style={{minWidth: 200, maxWidth: 200, overflow: "hidden"}}
|
||||||
/>
|
/>
|
||||||
<ListItemText
|
<ListItemText
|
||||||
primary="Actions"
|
primary="Actions"
|
||||||
@@ -882,7 +888,7 @@ const Admin = (props) => {
|
|||||||
/>
|
/>
|
||||||
<ListItemText
|
<ListItemText
|
||||||
primary={data.label}
|
primary={data.label}
|
||||||
style={{minWidth: 150, maxWidth: 150}}
|
style={{minWidth: 250, maxWidth: 250}}
|
||||||
/>
|
/>
|
||||||
<ListItemText
|
<ListItemText
|
||||||
primary={data.app.name}
|
primary={data.app.name}
|
||||||
@@ -900,7 +906,7 @@ const Admin = (props) => {
|
|||||||
primary={data.fields.map(data => {
|
primary={data.fields.map(data => {
|
||||||
return data.key
|
return data.key
|
||||||
}).join(", ")}
|
}).join(", ")}
|
||||||
style={{minWidth: 320, maxWidth: 320, overflow: "hidden"}}
|
style={{minWidth: 200, maxWidth: 200, overflow: "hidden"}}
|
||||||
/>
|
/>
|
||||||
<ListItemText>
|
<ListItemText>
|
||||||
<Button
|
<Button
|
||||||
@@ -923,9 +929,10 @@ const Admin = (props) => {
|
|||||||
|
|
||||||
const environmentView = curTab === 2 ?
|
const environmentView = curTab === 2 ?
|
||||||
<div>
|
<div>
|
||||||
<h2>
|
<div style={{marginTop: 20, marginBottom: 20,}}>
|
||||||
Environments
|
<h2 style={{display: "inline",}}>Environments</h2>
|
||||||
</h2>
|
<span style={{marginLeft: 25}}>Decides what Orborus environment to execute an action in a workflow in.</span>
|
||||||
|
</div>
|
||||||
<Button
|
<Button
|
||||||
style={{}}
|
style={{}}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
@@ -934,6 +941,14 @@ const Admin = (props) => {
|
|||||||
>
|
>
|
||||||
Add environment
|
Add environment
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button
|
||||||
|
style={{marginLeft: 5, }}
|
||||||
|
variant="contained"
|
||||||
|
color="primary"
|
||||||
|
onClick={() => getEnvironments()}
|
||||||
|
>
|
||||||
|
<CachedIcon />
|
||||||
|
</Button>
|
||||||
<Divider style={{marginTop: 20, marginBottom: 20, backgroundColor: inputColor}}/>
|
<Divider style={{marginTop: 20, marginBottom: 20, backgroundColor: inputColor}}/>
|
||||||
<List>
|
<List>
|
||||||
<ListItem>
|
<ListItem>
|
||||||
@@ -941,6 +956,10 @@ const Admin = (props) => {
|
|||||||
primary="Name"
|
primary="Name"
|
||||||
style={{minWidth: 150, maxWidth: 150}}
|
style={{minWidth: 150, maxWidth: 150}}
|
||||||
/>
|
/>
|
||||||
|
<ListItemText
|
||||||
|
primary="Orborus running (TBD)"
|
||||||
|
style={{minWidth: 200, maxWidth: 200}}
|
||||||
|
/>
|
||||||
<ListItemText
|
<ListItemText
|
||||||
primary="Actions"
|
primary="Actions"
|
||||||
style={{minWidth: 150, maxWidth: 150}}
|
style={{minWidth: 150, maxWidth: 150}}
|
||||||
@@ -953,6 +972,10 @@ const Admin = (props) => {
|
|||||||
primary={environment.Name}
|
primary={environment.Name}
|
||||||
style={{minWidth: 150, maxWidth: 150, overflow: "hidden"}}
|
style={{minWidth: 150, maxWidth: 150, overflow: "hidden"}}
|
||||||
/>
|
/>
|
||||||
|
<ListItemText
|
||||||
|
primary={"TBD"}
|
||||||
|
style={{minWidth: 200, maxWidth: 200, overflow: "hidden"}}
|
||||||
|
/>
|
||||||
<ListItemText>
|
<ListItemText>
|
||||||
<Button type="outlined" style={{borderRadius: "0px"}} onClick={() => deleteEnvironment(environment.Name)} color="primary">Delete</Button>
|
<Button type="outlined" style={{borderRadius: "0px"}} onClick={() => deleteEnvironment(environment.Name)} color="primary">Delete</Button>
|
||||||
</ListItemText>
|
</ListItemText>
|
||||||
@@ -960,11 +983,11 @@ const Admin = (props) => {
|
|||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</List>
|
</List>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
: null
|
: null
|
||||||
|
|
||||||
|
// primary={environment.Registered ? "true" : "false"}
|
||||||
|
|
||||||
const setConfig = (event, newValue) => {
|
const setConfig = (event, newValue) => {
|
||||||
if (newValue === 1) {
|
if (newValue === 1) {
|
||||||
getAppAuthentication()
|
getAppAuthentication()
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ import KeyboardArrowLeftIcon from '@material-ui/icons/KeyboardArrowLeft';
|
|||||||
import KeyboardArrowRightIcon from '@material-ui/icons/KeyboardArrowRight';
|
import KeyboardArrowRightIcon from '@material-ui/icons/KeyboardArrowRight';
|
||||||
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
||||||
import SettingsIcon from '@material-ui/icons/Settings';
|
import SettingsIcon from '@material-ui/icons/Settings';
|
||||||
|
import LockOpenIcon from '@material-ui/icons/LockOpen';
|
||||||
|
|
||||||
import * as cytoscape from 'cytoscape';
|
import * as cytoscape from 'cytoscape';
|
||||||
import * as edgehandles from 'cytoscape-edgehandles';
|
import * as edgehandles from 'cytoscape-edgehandles';
|
||||||
@@ -926,7 +927,9 @@ const AngularWorkflow = (props) => {
|
|||||||
|
|
||||||
const newfields = {}
|
const newfields = {}
|
||||||
for (var filterkey in item.fields) {
|
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
|
item.fields = newfields
|
||||||
@@ -2585,9 +2588,10 @@ const AngularWorkflow = (props) => {
|
|||||||
if (!selectedAction.auth_not_required && selectedAction.selectedAuthentication !== undefined && selectedAction.selectedAuthentication.fields !== undefined) {
|
if (!selectedAction.auth_not_required && selectedAction.selectedAuthentication !== undefined && selectedAction.selectedAuthentication.fields !== undefined) {
|
||||||
if (selectedAction.selectedAuthentication.fields[data.name] !== undefined) {
|
if (selectedAction.selectedAuthentication.fields[data.name] !== undefined) {
|
||||||
// FIXME - this should be skipped in the frontend
|
// FIXME - this should be skipped in the frontend
|
||||||
selectedActionParameters[count].value = selectedAction.selectedAuthentication.fields[data.name]
|
//selectedActionParameters[count].value = selectedAction.selectedAuthentication.fields[data.name]
|
||||||
selectedAction.parameters[count].value = selectedAction.selectedAuthentication.fields[data.name]
|
//selectedAction.parameters[count].value = selectedAction.selectedAuthentication.fields[data.name]
|
||||||
setSelectedAction(selectedAction)
|
//setSelectedAction(selectedAction)
|
||||||
|
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2757,8 +2761,16 @@ const AngularWorkflow = (props) => {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div key={data.name}>
|
<div key={data.name}>
|
||||||
<div style={{marginTop: "20px", marginBottom: "7px", display: "flex"}}>
|
<div style={{marginTop: 20, marginBottom: 7, display: "flex"}}>
|
||||||
<div style={{width: "17px", height: "17px", borderRadius: 17 / 2, backgroundColor: itemColor, marginRight: "10px"}}/>
|
{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"}}>
|
<div style={{flex: "10"}}>
|
||||||
<b>{data.name} </b>
|
<b>{data.name} </b>
|
||||||
</div>
|
</div>
|
||||||
@@ -3036,7 +3048,7 @@ const AngularWorkflow = (props) => {
|
|||||||
/>
|
/>
|
||||||
{selectedAction.authentication.length === 0 && requiresAuthentication ?
|
{selectedAction.authentication.length === 0 && requiresAuthentication ?
|
||||||
<div style={{marginTop: 15}}>
|
<div style={{marginTop: 15}}>
|
||||||
Authentication (reusable):
|
Authenticate {selectedApp.name}:
|
||||||
<Tooltip color="primary" title={"Add authentication option"} placement="top">
|
<Tooltip color="primary" title={"Add authentication option"} placement="top">
|
||||||
<Button color="primary" style={{}} variant="text" onClick={() => {
|
<Button color="primary" style={{}} variant="text" onClick={() => {
|
||||||
setAuthenticationModalOpen(true)
|
setAuthenticationModalOpen(true)
|
||||||
@@ -5440,25 +5452,27 @@ const AngularWorkflow = (props) => {
|
|||||||
selectedAction.selectedAuthentication = authenticationOption
|
selectedAction.selectedAuthentication = authenticationOption
|
||||||
selectedAction.authentication.push(authenticationOption)
|
selectedAction.authentication.push(authenticationOption)
|
||||||
setSelectedAction(selectedAction)
|
setSelectedAction(selectedAction)
|
||||||
|
setUpdate(authenticationOption.id)
|
||||||
|
|
||||||
|
var newAuthOption = JSON.parse(JSON.stringify(authenticationOption))
|
||||||
var newFields = []
|
var newFields = []
|
||||||
for (const key in authenticationOption.fields) {
|
for (const key in newAuthOption.fields) {
|
||||||
const value = authenticationOption.fields[key]
|
const value = newAuthOption.fields[key]
|
||||||
newFields.push({
|
newFields.push({
|
||||||
key: key,
|
key: key,
|
||||||
value: value,
|
value: value,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
authenticationOption.fields = newFields
|
newAuthOption.fields = newFields
|
||||||
setNewAppAuth(authenticationOption)
|
setNewAppAuth(newAuthOption)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<a href="https://shuffler.io/docs/apps#authentication" style={{textDecoration: "none", color: "#f85a3e"}}>What is this?</a>
|
<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}}/>
|
<div style={{marginTop: 15}}/>
|
||||||
{selectedApp.link.length > 0 ? <EndpointData /> : null}
|
{selectedApp.link.length > 0 ? <EndpointData /> : null}
|
||||||
Label (to remember it)
|
Label (to remember it)
|
||||||
|
|||||||
Reference in New Issue
Block a user