Fixed oauth2 loading problems
This commit is contained in:
@@ -471,8 +471,6 @@ const AuthenticationOauth2 = (props) => {
|
|||||||
url = `${authenticationType.redirect_uri}?client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&prompt=admin_consent&scope=${resources}&state=${state}&access_type=offline`;
|
url = `${authenticationType.redirect_uri}?client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&prompt=admin_consent&scope=${resources}&state=${state}&access_type=offline`;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("URL: ", url)
|
|
||||||
|
|
||||||
// Force new consent
|
// Force new consent
|
||||||
//const url = `${authenticationType.redirect_uri}?client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&scope=${resources}&prompt=consent&state=${state}&access_type=offline`;
|
//const url = `${authenticationType.redirect_uri}?client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&scope=${resources}&prompt=consent&state=${state}&access_type=offline`;
|
||||||
|
|
||||||
@@ -525,9 +523,8 @@ const AuthenticationOauth2 = (props) => {
|
|||||||
//}
|
//}
|
||||||
//while(open === true)
|
//while(open === true)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
toast(
|
toast("Failed authentication - probably bad credentials. Try again")
|
||||||
"Failed authentication - probably bad credentials. Try again"
|
|
||||||
);
|
|
||||||
setButtonClicked(false);
|
setButtonClicked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -807,6 +804,7 @@ const AuthenticationOauth2 = (props) => {
|
|||||||
|
|
||||||
const defaultValue = data.name === "url" && authenticationType.token_uri !== undefined && authenticationType.token_uri !== null && authenticationType.token_uri.length > 0 && (authenticationType.authorizationUrl === undefined || authenticationType.authorizationUrl === null || authenticationType.authorizationUrl.length === 0) && authenticationType.type === "oauth2-app" ? authenticationType.token_uri : data.value === undefined || data.value === null ? "" : data.value
|
const defaultValue = data.name === "url" && authenticationType.token_uri !== undefined && authenticationType.token_uri !== null && authenticationType.token_uri.length > 0 && (authenticationType.authorizationUrl === undefined || authenticationType.authorizationUrl === null || authenticationType.authorizationUrl.length === 0) && authenticationType.type === "oauth2-app" ? authenticationType.token_uri : data.value === undefined || data.value === null ? "" : data.value
|
||||||
|
|
||||||
|
|
||||||
const fieldname = data.name === "url" && authenticationType.grant_type !== undefined && authenticationType.grant_type !== null && authenticationType.grant_type.length > 0 && authenticationType.type === "oauth2-app" ? "Token URL" : data.name
|
const fieldname = data.name === "url" && authenticationType.grant_type !== undefined && authenticationType.grant_type !== null && authenticationType.grant_type.length > 0 && authenticationType.type === "oauth2-app" ? "Token URL" : data.name
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -1034,6 +1032,10 @@ const AuthenticationOauth2 = (props) => {
|
|||||||
variant="contained"
|
variant="contained"
|
||||||
fullWidth
|
fullWidth
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
toast.info("Starting authentication process", {
|
||||||
|
"autoClose": 1500,
|
||||||
|
})
|
||||||
|
|
||||||
handleOauth2Request(clientId, clientSecret, oauthUrl, selectedScopes);
|
handleOauth2Request(clientId, clientSecret, oauthUrl, selectedScopes);
|
||||||
}}
|
}}
|
||||||
color="primary"
|
color="primary"
|
||||||
|
|||||||
@@ -1080,16 +1080,19 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
})
|
})
|
||||||
.then((responseJson) => {
|
.then((responseJson) => {
|
||||||
if (!responseJson.success) {
|
if (!responseJson.success) {
|
||||||
toast("Error: " + responseJson.reason);
|
// Remove the timeout. Has to be clicked
|
||||||
|
toast.error("Error: " + responseJson.reason, {
|
||||||
|
"autoClose": false,
|
||||||
|
})
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (refresh === true) {
|
if (refresh === true) {
|
||||||
getAppAuthentication(true, true, true);
|
getAppAuthentication(true, true, true)
|
||||||
} else {
|
} else {
|
||||||
getAppAuthentication(true, false);
|
getAppAuthentication(true, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
setAuthenticationModalOpen(false);
|
setAuthenticationModalOpen(false)
|
||||||
|
|
||||||
// Needs a refresh with the new authentication..
|
// Needs a refresh with the new authentication..
|
||||||
//toast("Successfully saved new app auth")
|
//toast("Successfully saved new app auth")
|
||||||
}
|
}
|
||||||
@@ -7203,73 +7206,47 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
toast("Error: name can't be empty");
|
toast("Error: name can't be empty");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var mappedStartnode = "";
|
var mappedStartnode = ""
|
||||||
const alledges = cy.edges().jsons();
|
const alledges = cy.edges().jsons()
|
||||||
if (alledges !== undefined && alledges !== null && alledges.length > 0) {
|
if (alledges !== undefined && alledges !== null && alledges.length > 0) {
|
||||||
for (let edgekey in alledges) {
|
for (let edgekey in alledges) {
|
||||||
const tmp = alledges[edgekey];
|
const tmp = alledges[edgekey]
|
||||||
console.log("TMP: ", tmp, tmp.data.source);
|
console.log("TMP: ", tmp, tmp.data.source)
|
||||||
if (tmp.data.source === trigger.id) {
|
if (tmp.data.source === trigger.id) {
|
||||||
mappedStartnode = tmp.data.target;
|
mappedStartnode = tmp.data.target
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const data = usecase;
|
|
||||||
if (data.type === "create") toast("Creating pipeline");
|
toast("Creating pipeline")
|
||||||
else toast("stopping pipeline");
|
const data = usecase
|
||||||
const url = `${globalUrl}/api/v1/triggers/pipeline`;
|
const url = `${globalUrl}/api/v1/triggers/pipeline`
|
||||||
fetch(url, {
|
fetch(url, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
},
|
},
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
})
|
}
|
||||||
|
)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.status !== 200) {
|
if (response.status !== 200) {
|
||||||
console.log("Status not 200 for stream results :O!");
|
console.log("Status not 200 for stream results :O!");
|
||||||
}
|
}
|
||||||
|
|
||||||
return response.json();
|
return response.json();
|
||||||
})
|
})
|
||||||
.then((responseJson) => {
|
.then((responseJson) => {
|
||||||
if (!responseJson.success) {
|
if (!responseJson.success) {
|
||||||
toast("Failed to set pipeline: " + responseJson.reason);
|
toast("Failed to set pipeline: " + responseJson.reason);
|
||||||
} else {
|
} else {
|
||||||
if (data.type === "create") toast("Pipeline will be created!");
|
toast("Successfully created pipeline");
|
||||||
else toast("Pipeline will be stopped!");
|
workflow.triggers[triggerindex].status = "running";
|
||||||
if (!workflow.triggers[triggerindex].parameters) {
|
trigger.status = "running";
|
||||||
workflow.triggers[triggerindex].parameters = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (workflow.triggers[triggerindex].parameters.length > 0) {
|
|
||||||
workflow.triggers[triggerindex].parameters[0].name = data.name;
|
|
||||||
workflow.triggers[triggerindex].parameters[0].value = data.command;
|
|
||||||
|
|
||||||
trigger.parameters[0].name = data.name;
|
|
||||||
trigger.parameters[0].value = data.command;
|
|
||||||
if (data.type === "stop") {
|
|
||||||
trigger.status = "stopped";
|
|
||||||
workflow.triggers[triggerindex].status = "stopped";
|
|
||||||
} else {
|
|
||||||
trigger.status = "running";
|
|
||||||
workflow.triggers[triggerindex].status = "running";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const newParameter = {
|
|
||||||
name: data.name,
|
|
||||||
value: data.command,
|
|
||||||
};
|
|
||||||
trigger.parameters.push(newParameter);
|
|
||||||
if (data.type === "stop") trigger.status = "stopped";
|
|
||||||
else trigger.status = "running";
|
|
||||||
workflow.triggers[triggerindex] = trigger;
|
|
||||||
}
|
|
||||||
|
|
||||||
setSelectedTrigger(trigger);
|
setSelectedTrigger(trigger);
|
||||||
setWorkflow(workflow);
|
setWorkflow(workflow);
|
||||||
console.log("Should set the status to running and save");
|
console.log("Should set the status to running and save");
|
||||||
@@ -7278,9 +7255,9 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
//toast(error.toString());
|
//toast(error.toString());
|
||||||
console.log("Get pipeline error: ", error.toString());
|
console.log("Get schedule error: ", error.toString());
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
const submitSchedule = (trigger, triggerindex) => {
|
const submitSchedule = (trigger, triggerindex) => {
|
||||||
if (trigger.name.length <= 0) {
|
if (trigger.name.length <= 0) {
|
||||||
@@ -13679,6 +13656,7 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
if (data.Name.toLowerCase() === "cloud") {
|
if (data.Name.toLowerCase() === "cloud") {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
key={data.id}
|
key={data.id}
|
||||||
@@ -13726,115 +13704,75 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
Run HTTP Request
|
Run HTTP Request
|
||||||
</div>
|
</div>
|
||||||
*/}
|
*/}
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
border: "1px solid rgba(255,255,255,0.3)",
|
|
||||||
borderRadius: theme.palette.borderRadius,
|
|
||||||
padding: 10,
|
|
||||||
cursor: selectedTrigger.status == "running" ? "not-allowed" : "pointer",
|
|
||||||
background:
|
|
||||||
selectedTrigger.status == "running"
|
|
||||||
? "rgba(255, 255, 255, 0.1)"
|
|
||||||
: "transparent",
|
|
||||||
opacity: selectedTrigger.status == "running" ? 0.5 : 1,
|
|
||||||
color:
|
|
||||||
selectedTrigger.status == "running"
|
|
||||||
? "rgba(255, 255, 255, 0.5)"
|
|
||||||
: "inherit",
|
|
||||||
marginTop: 5,
|
|
||||||
}}
|
|
||||||
onClick={() => {
|
|
||||||
if (selectedTrigger.status == "running") {
|
|
||||||
return; // Do nothing if cursor is "not-allowed"
|
|
||||||
}
|
|
||||||
const pipelineConfig = {
|
|
||||||
name: selectedTrigger.label,
|
|
||||||
type: "create",
|
|
||||||
command: "load tcp://0.0.0.0:514 | read syslog | export",
|
|
||||||
environment: selectedTrigger.environment,
|
|
||||||
workflow_id: workflow.id,
|
|
||||||
trigger_id: selectedTrigger.id,
|
|
||||||
};
|
|
||||||
|
|
||||||
submitPipeline(selectedTrigger, selectedTriggerIndex, pipelineConfig);
|
<div
|
||||||
}}
|
style={{
|
||||||
>
|
border: "1px solid rgba(255,255,255,0.3)",
|
||||||
Start Syslog listener
|
borderRadius: theme.palette.borderRadius,
|
||||||
</div>
|
padding: 10,
|
||||||
|
cursor: "pointer",
|
||||||
|
marginTop: 5,
|
||||||
|
|
||||||
<div
|
}}
|
||||||
style={{
|
onClick={() => {
|
||||||
border: "1px solid rgba(255,255,255,0.3)",
|
const pipelineConfig = {
|
||||||
borderRadius: theme.palette.borderRadius,
|
"name": selectedTrigger.label,
|
||||||
padding: 10,
|
"type": "create",
|
||||||
cursor: selectedTrigger.status == "running" ? "not-allowed" : "pointer",
|
"command": "load tcp://0.0.0.0:514 | read syslog | export",
|
||||||
background:
|
"environment": selectedTrigger.environment,
|
||||||
selectedTrigger.status == "running"
|
}
|
||||||
? "rgba(255, 255, 255, 0.1)"
|
|
||||||
: "transparent",
|
|
||||||
opacity: selectedTrigger.status == "running" ? 0.5 : 1,
|
|
||||||
color:
|
|
||||||
selectedTrigger.status == "running"
|
|
||||||
? "rgba(255, 255, 255, 0.5)"
|
|
||||||
: "inherit",
|
|
||||||
marginTop: 5,
|
|
||||||
}}
|
|
||||||
onClick={() => {
|
|
||||||
if (selectedTrigger.status == "running") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const pipelineConfig = {
|
|
||||||
name: selectedTrigger.label,
|
|
||||||
type: "create",
|
|
||||||
command:
|
|
||||||
"export --live | sigma /path/to/rules | to http://192.168.86.44:5002/api/v1/hooks/webhook_665ace5f-f27b-496a-a365-6e07eb61078c write lines",
|
|
||||||
environment: selectedTrigger.environment,
|
|
||||||
workflow_id: workflow.id,
|
|
||||||
trigger_id: selectedTrigger.id,
|
|
||||||
};
|
|
||||||
|
|
||||||
submitPipeline(selectedTrigger, selectedTriggerIndex, pipelineConfig);
|
submitPipeline(selectedTrigger, selectedTriggerIndex, pipelineConfig)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Run Sigma Rulesearch
|
Start Syslog listener
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
border: "1px solid rgba(255,255,255,0.3)",
|
border: "1px solid rgba(255,255,255,0.3)",
|
||||||
borderRadius: theme.palette.borderRadius,
|
borderRadius: theme.palette.borderRadius,
|
||||||
padding: 10,
|
padding: 10,
|
||||||
cursor: selectedTrigger.status == "running" ? "not-allowed" : "pointer",
|
cursor: "pointer",
|
||||||
background:
|
marginTop: 5,
|
||||||
selectedTrigger.status == "running"
|
|
||||||
? "rgba(255, 255, 255, 0.1)"
|
|
||||||
: "transparent",
|
|
||||||
opacity: selectedTrigger.status == "running" ? 0.5 : 1,
|
|
||||||
color:
|
|
||||||
selectedTrigger.status == "running"
|
|
||||||
? "rgba(255, 255, 255, 0.5)"
|
|
||||||
: "inherit",
|
|
||||||
marginTop: 5,
|
|
||||||
}}
|
|
||||||
onClick={() => {
|
|
||||||
if (selectedTrigger.status == "running") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const pipelineConfig = {
|
|
||||||
name: selectedTrigger.label,
|
|
||||||
type: "create",
|
|
||||||
command:
|
|
||||||
"from kafka://1.2.3.4 --topic foo | to http://api.com X-Token:Secret",
|
|
||||||
environment: selectedTrigger.environment,
|
|
||||||
workflow_id: workflow.id,
|
|
||||||
trigger_id: selectedTrigger.id,
|
|
||||||
};
|
|
||||||
|
|
||||||
submitPipeline(selectedTrigger, selectedTriggerIndex, pipelineConfig);
|
}}
|
||||||
}}
|
onClick={() => {
|
||||||
>
|
const pipelineConfig = {
|
||||||
Follow Kafka Queue
|
"name": selectedTrigger.label,
|
||||||
</div>
|
"type": "create",
|
||||||
|
"command": "export --live | sigma /path/to/rules | to http://192.168.86.44:5002/api/v1/hooks/webhook_665ace5f-f27b-496a-a365-6e07eb61078c write lines",
|
||||||
|
"environment": selectedTrigger.environment,
|
||||||
|
}
|
||||||
|
|
||||||
|
submitPipeline(selectedTrigger, selectedTriggerIndex, pipelineConfig)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Run Sigma Rulesearch
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
border: "1px solid rgba(255,255,255,0.3)",
|
||||||
|
borderRadius: theme.palette.borderRadius,
|
||||||
|
padding: 10,
|
||||||
|
cursor: "pointer",
|
||||||
|
marginTop: 5,
|
||||||
|
|
||||||
|
}}
|
||||||
|
onClick={() => {
|
||||||
|
const pipelineConfig = {
|
||||||
|
"name": selectedTrigger.label,
|
||||||
|
"type": "create",
|
||||||
|
"command": "from kafka://1.2.3.4 --topic foo | to http://api.com X-Token:Secret",
|
||||||
|
"environment": selectedTrigger.environment,
|
||||||
|
}
|
||||||
|
|
||||||
|
submitPipeline(selectedTrigger, selectedTriggerIndex, pipelineConfig)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Follow Kafka Queue
|
||||||
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
@@ -13848,26 +13786,18 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
variant="contained"
|
variant="contained"
|
||||||
disabled={selectedTrigger.status === "running"}
|
disabled={selectedTrigger.status === "running"}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
toast("Select anyone of the parameters to start")
|
toast("Should start. But it doesn't")
|
||||||
}}
|
}}
|
||||||
color="primary"
|
color="primary"
|
||||||
>
|
>
|
||||||
Start
|
Start
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
style={{ flex: "1" }}
|
style={{ flex: "1" }}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
disabled={selectedTrigger.status !== "running"}
|
disabled={selectedTrigger.status !== "running"}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const pipelineConfig = {
|
toast("Should stop triggert")
|
||||||
name: selectedTrigger.label,
|
|
||||||
type: "stop",
|
|
||||||
environment: selectedTrigger.environment,
|
|
||||||
workflow_id: workflow.id,
|
|
||||||
trigger_id: selectedTrigger.id,
|
|
||||||
};
|
|
||||||
submitPipeline(selectedTrigger, selectedTriggerIndex, pipelineConfig);
|
|
||||||
}}
|
}}
|
||||||
color="primary"
|
color="primary"
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user