diff --git a/backend/go-app/go.mod b/backend/go-app/go.mod
index 083567a1..a5425e4d 100644
--- a/backend/go-app/go.mod
+++ b/backend/go-app/go.mod
@@ -2,7 +2,7 @@ module main
go 1.16
-replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared
+//replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared
//replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi
//replace github.com/frikky/go-elasticsearch => ../../../../git/go-elasticsearch
@@ -24,7 +24,7 @@ require (
github.com/h2non/filetype v1.1.3
github.com/nirasan/go-oauth-pkce-code-verifier v0.0.0-20170819232839-0fbfe93532da // indirect
github.com/satori/go.uuid v1.2.0
- github.com/shuffle/shuffle-shared v0.2.44
+ github.com/shuffle/shuffle-shared v0.2.46
go4.org v0.0.0-20201209231011-d4a079459e60 // indirect
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce
google.golang.org/api v0.65.0
diff --git a/backend/go-app/main.go b/backend/go-app/main.go
index 433ce6b2..3e3d3630 100644
--- a/backend/go-app/main.go
+++ b/backend/go-app/main.go
@@ -1041,7 +1041,7 @@ func handleInfo(resp http.ResponseWriter, request *http.Request) {
orgPriorities := org.Priorities
if len(org.Priorities) < 5 {
log.Printf("[WARNING] Should find and add priorities as length is less than 5 for org %s", userInfo.ActiveOrg.Id)
- newPriorities, err := shuffle.GetPriorities(ctx, org)
+ newPriorities, err := shuffle.GetPriorities(ctx, userInfo, org)
if err != nil {
log.Printf("[WARNING] Failed getting new priorities for org %s: %s", org.Id, err)
//orgPriorities = []shuffle.Priority{}
@@ -1247,7 +1247,6 @@ func checkAdminLogin(resp http.ResponseWriter, request *http.Request) {
// Should run calculations
if len(org.SSOConfig.OpenIdAuthorization) > 0 {
- log.Printf("[DEBUG] Found OpenID url (PKCE!!). Extra redirect check: %s", request.URL.String())
baseSSOUrl = org.SSOConfig.OpenIdAuthorization
codeChallenge := uuid.NewV4().String()
@@ -1276,7 +1275,20 @@ func checkAdminLogin(resp http.ResponseWriter, request *http.Request) {
//log.Printf("[DEBUG] Got challenge value %s (POST state)", codeChallenge)
- baseSSOUrl += fmt.Sprintf("?client_id=%s&response_type=code&scope=openid&redirect_uri=%s&state=%s&code_challenge_method=S256&code_challenge=%s", org.SSOConfig.OpenIdClientId, redirectUrl, state, codeChallenge)
+ if len(org.SSOConfig.OpenIdClientSecret) > 0 {
+
+ //baseSSOUrl += fmt.Sprintf("?client_id=%s&response_type=code&scope=openid&redirect_uri=%s&state=%s&client_secret=%s", org.SSOConfig.OpenIdClientId, redirectUrl, state, org.SSOConfig.OpenIdClientSecret)
+ state := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("org=%s&redirect=%s&challenge=%s", org.Id, redirectUrl, org.SSOConfig.OpenIdClientSecret)))
+ log.Printf("URL: %s", redirectUrl)
+
+ baseSSOUrl += fmt.Sprintf("?client_id=%s&response_type=id_token&scope=openid&redirect_uri=%s&state=%s&response_mode=form_post&nonce=%s", org.SSOConfig.OpenIdClientId, redirectUrl, state, state)
+ //baseSSOUrl += fmt.Sprintf("&client_secret=%s", org.SSOConfig.OpenIdClientSecret)
+ log.Printf("[DEBUG] Found OpenID url (client secret). Extra redirect check: %s - %s", request.URL.String(), baseSSOUrl)
+ } else {
+ log.Printf("[DEBUG] Found OpenID url (PKCE!!). Extra redirect check: %s", request.URL.String())
+ baseSSOUrl += fmt.Sprintf("?client_id=%s&response_type=code&scope=openid&redirect_uri=%s&state=%s&code_challenge_method=S256&code_challenge=%s", org.SSOConfig.OpenIdClientId, redirectUrl, state, codeChallenge)
+ }
+
break
}
@@ -6065,7 +6077,7 @@ func initHandlers() {
r.HandleFunc("/api/v1/get_docker_image", getDockerImage).Methods("POST", "OPTIONS")
r.HandleFunc("/api/v1/migrate_database", migrateDatabase).Methods("POST", "OPTIONS")
r.HandleFunc("/api/v1/login_sso", shuffle.HandleSSO).Methods("GET", "POST", "OPTIONS")
- r.HandleFunc("/api/v1/login_openid", shuffle.HandleOpenId).Methods("GET", "OPTIONS")
+ r.HandleFunc("/api/v1/login_openid", shuffle.HandleOpenId).Methods("GET", "POST", "OPTIONS")
// Important for email, IDS etc. Create this by:
// PS: For cloud, this has to use cloud storage.
diff --git a/docker-compose.yml b/docker-compose.yml
index 27d8e095..157d6d03 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,7 +1,7 @@
version: '3'
services:
frontend:
- #build: ./frontend
+ build: ./frontend
image: ghcr.io/frikky/shuffle-frontend:nightly
container_name: shuffle-frontend
hostname: shuffle-frontend
@@ -16,7 +16,7 @@ services:
depends_on:
- backend
backend:
- #build: ./backend
+ build: ./backend
image: ghcr.io/frikky/shuffle-backend:nightly
container_name: shuffle-backend
hostname: ${BACKEND_HOSTNAME}
diff --git a/frontend/src/components/DetectionFramework.jsx b/frontend/src/components/DetectionFramework.jsx
index 4cbb0e7e..94ae0a80 100644
--- a/frontend/src/components/DetectionFramework.jsx
+++ b/frontend/src/components/DetectionFramework.jsx
@@ -1607,7 +1607,7 @@ const Framework = (props) => {
/>
:
: null}
diff --git a/frontend/src/components/OrgHeader.jsx b/frontend/src/components/OrgHeader.jsx
index 922c4118..448bf5b1 100644
--- a/frontend/src/components/OrgHeader.jsx
+++ b/frontend/src/components/OrgHeader.jsx
@@ -105,6 +105,14 @@ const OrgHeader = (props) => {
? ""
: selectedOrganization.sso_config.client_id
);
+ const [openidClientSecret, setOpenidClientSecret] = React.useState(
+ selectedOrganization.sso_config === undefined
+ ? ""
+ : selectedOrganization.sso_config.client_secret === undefined ||
+ selectedOrganization.sso_config.client_secret.length === 0
+ ? ""
+ : selectedOrganization.sso_config.client_secret
+ );
const [openidAuthorization, setOpenidAuthorization] = React.useState(
selectedOrganization.sso_config === undefined
? ""
@@ -242,6 +250,7 @@ const OrgHeader = (props) => {
sso_entrypoint: ssoEntrypoint,
sso_certificate: ssoCertificate,
client_id: openidClientId,
+ client_secret: openidClientSecret,
openid_authorization: openidAuthorization,
openid_token: openidToken,
}
@@ -439,8 +448,242 @@ const OrgHeader = (props) => {
}}
/>
-
- {isCloud ? null : (
+
+ {isCloud ? null :
+
+ OpenID connect
+
+
+
+ Client ID
+ 0
+ }
+ id="outlined-with-placeholder"
+ margin="normal"
+ variant="outlined"
+ placeholder="The OpenID client ID from the identity provider"
+ value={openidClientId}
+ onChange={(e) => {
+ setOpenidClientId(e.target.value);
+ }}
+ InputProps={{
+ classes: {
+ notchedOutline: classes.notchedOutline,
+ },
+ style: {
+ color: "white",
+ },
+ }}
+ />
+
+
+
+
+ Client Secret (optional)
+ 0
+ }
+ id="outlined-with-placeholder"
+ margin="normal"
+ variant="outlined"
+ placeholder="The OpenID client secret - DONT use this if dealing with implicit auth / PKCE"
+ value={openidClientSecret}
+ onChange={(e) => {
+ setOpenidClientSecret(e.target.value);
+ }}
+ InputProps={{
+ classes: {
+ notchedOutline: classes.notchedOutline,
+ },
+ style: {
+ color: "white",
+ },
+ }}
+ />
+
+
+
+
+
+
+ Authorization URL
+ {
+ setOpenidAuthorization(e.target.value)
+ }}
+ InputProps={{
+ classes: {
+ notchedOutline: classes.notchedOutline,
+ },
+ style: {
+ color: "white",
+ },
+ }}
+ />
+
+
+
+
+ Token URL
+ {
+ setOpenidToken(e.target.value)
+ }}
+ InputProps={{
+ classes: {
+ notchedOutline: classes.notchedOutline,
+ },
+ style: {
+ color: "white",
+ },
+ }}
+ />
+
+
+
+
+ }
+ {/*isCloud ? null : */}
+
+ SAML SSO (v1.1)
+
+
+
+ SSO Entrypoint (IdP)
+ 0
+ }
+ id="outlined-with-placeholder"
+ margin="normal"
+ variant="outlined"
+ placeholder="The entrypoint URL from your provider"
+ value={ssoEntrypoint}
+ onChange={(e) => {
+ setSsoEntrypoint(e.target.value);
+ }}
+ InputProps={{
+ classes: {
+ notchedOutline: classes.notchedOutline,
+ },
+ style: {
+ color: "white",
+ },
+ }}
+ />
+
+
+
+
+ SSO Certificate (X509)
+ {
+ setSsoCertificate(e.target.value);
+ }}
+ InputProps={{
+ classes: {
+ notchedOutline: classes.notchedOutline,
+ },
+ style: {
+ color: "white",
+ },
+ }}
+ />
+
+
+
+
+ {isCloud ? null : (
App Download URL
@@ -576,199 +819,10 @@ const OrgHeader = (props) => {
)}
- {isCloud ? null :
-
- OpenID connect
-
-
-
- Client ID
- 0
- }
- id="outlined-with-placeholder"
- margin="normal"
- variant="outlined"
- placeholder="The OpenID client ID from the identity provider"
- value={openidClientId}
- onChange={(e) => {
- setOpenidClientId(e.target.value);
- }}
- InputProps={{
- classes: {
- notchedOutline: classes.notchedOutline,
- },
- style: {
- color: "white",
- },
- }}
- />
-
-
-
-
- Authorization URL
- {
- setOpenidAuthorization(e.target.value)
- }}
- InputProps={{
- classes: {
- notchedOutline: classes.notchedOutline,
- },
- style: {
- color: "white",
- },
- }}
- />
-
-
-
-
- Token URL
- {
- setOpenidToken(e.target.value)
- }}
- InputProps={{
- classes: {
- notchedOutline: classes.notchedOutline,
- },
- style: {
- color: "white",
- },
- }}
- />
-
-
-
-
- }
- {/*isCloud ? null : */}
-
- SAML SSO (v1.1)
-
-
-
- SSO Entrypoint (IdP)
- 0
- }
- id="outlined-with-placeholder"
- margin="normal"
- variant="outlined"
- placeholder="The entrypoint URL from your provider"
- value={ssoEntrypoint}
- onChange={(e) => {
- setSsoEntrypoint(e.target.value);
- }}
- InputProps={{
- classes: {
- notchedOutline: classes.notchedOutline,
- },
- style: {
- color: "white",
- },
- }}
- />
-
-
-
-
- SSO Certificate (X509)
- {
- setSsoCertificate(e.target.value);
- }}
- InputProps={{
- classes: {
- notchedOutline: classes.notchedOutline,
- },
- style: {
- color: "white",
- },
- }}
- />
-
-
-
-
+
+
+ {orgSaveButton}
+
{/*
{expanded ?
diff --git a/frontend/src/components/ParsedAction.jsx b/frontend/src/components/ParsedAction.jsx
index 345a790f..218f2b68 100644
--- a/frontend/src/components/ParsedAction.jsx
+++ b/frontend/src/components/ParsedAction.jsx
@@ -2488,9 +2488,6 @@ const ParsedAction = (props) => {
onChange={selectedNameChange}
onBlur={(e) => {
const name = e.target.value;
- console.log("CHANGED FROM2: ", baselabel);
- console.log("CHANGED TO: ", name);
-
const parsedBaseLabel = "$"+baselabel.toLowerCase().replaceAll(" ", "_")
const newname = "$"+name.toLowerCase().replaceAll(" ", "_")
@@ -2508,12 +2505,9 @@ const ParsedAction = (props) => {
continue
}
- console.log("PARAM: ", param)
-
// Should have a smarter way of discovering node names
// Do regex?
// Finding index(es) and replacing at the location
-
try {
var cnt = -1
@@ -2536,20 +2530,17 @@ const ParsedAction = (props) => {
// Check location:
// If it's a-zA-Z_ then don't replace
if (param.value.length > foundindex+parsedBaseLabel.length) {
- console.log("Validate length if valid key if it's valid - don't replace if it is: ", param.value[foundindex+parsedBaseLabel.length])
const regex = /[a-zA-Z0-9_]/g;
const match = param.value[foundindex+parsedBaseLabel.length].match(regex);
if (match !== null) {
continue
}
-
- console.log("Matching: ", match)
}
- console.log("Found: ", foundindex)
console.log("Old found: ", workflow.actions[key].parameters[subkey].value)
const extralength = newname.length-parsedBaseLabel.length
param.value = param.value.substring(0, foundindex) + newname + param.value.substring(foundindex-extralength+newname.length, param.value.length)
+
console.log("New: ", workflow.actions[key].parameters[subkey].value)
} else {
break
diff --git a/frontend/src/views/Dashboard.jsx b/frontend/src/views/Dashboard.jsx
index 87493107..5a3a8de8 100644
--- a/frontend/src/views/Dashboard.jsx
+++ b/frontend/src/views/Dashboard.jsx
@@ -1151,6 +1151,7 @@ const Dashboard = (props) => {
return response.json();
})
.then((responseJson) => {
+ // Matching workflows with usecases
if (responseJson.success !== false) {
if (workflows !== undefined && workflows !== null && workflows.length > 0) {
var categorydata = responseJson