Build backend :)
This commit is contained in:
@@ -19,7 +19,7 @@ require (
|
|||||||
github.com/gorilla/mux v1.8.0
|
github.com/gorilla/mux v1.8.0
|
||||||
github.com/h2non/filetype v1.1.3
|
github.com/h2non/filetype v1.1.3
|
||||||
github.com/satori/go.uuid v1.2.0
|
github.com/satori/go.uuid v1.2.0
|
||||||
github.com/shuffle/shuffle-shared v0.3.98
|
github.com/shuffle/shuffle-shared v0.4.0
|
||||||
golang.org/x/crypto v0.3.0
|
golang.org/x/crypto v0.3.0
|
||||||
google.golang.org/api v0.103.0
|
google.golang.org/api v0.103.0
|
||||||
google.golang.org/appengine v1.6.7
|
google.golang.org/appengine v1.6.7
|
||||||
|
|||||||
+1
-55
@@ -21,7 +21,6 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"math/rand"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
@@ -1226,15 +1225,6 @@ func handleContact(resp http.ResponseWriter, request *http.Request) {
|
|||||||
resp.Write([]byte(fmt.Sprintf(`{"success": true, "message": "Thanks for reaching out. We will contact you soon!"}`)))
|
resp.Write([]byte(fmt.Sprintf(`{"success": true, "message": "Thanks for reaching out. We will contact you soon!"}`)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func verifier() (*shuffle.CodeVerifier, error) {
|
|
||||||
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
||||||
b := make([]byte, 32, 32)
|
|
||||||
for i := 0; i < 32; i++ {
|
|
||||||
b[i] = byte(r.Intn(255))
|
|
||||||
}
|
|
||||||
return shuffle.CreateCodeVerifierFromBytes(b)
|
|
||||||
}
|
|
||||||
|
|
||||||
func checkAdminLogin(resp http.ResponseWriter, request *http.Request) {
|
func checkAdminLogin(resp http.ResponseWriter, request *http.Request) {
|
||||||
cors := shuffle.HandleCors(resp, request)
|
cors := shuffle.HandleCors(resp, request)
|
||||||
if cors {
|
if cors {
|
||||||
@@ -1279,51 +1269,7 @@ func checkAdminLogin(resp http.ResponseWriter, request *http.Request) {
|
|||||||
|
|
||||||
// Should run calculations
|
// Should run calculations
|
||||||
if len(org.SSOConfig.OpenIdAuthorization) > 0 {
|
if len(org.SSOConfig.OpenIdAuthorization) > 0 {
|
||||||
baseSSOUrl = org.SSOConfig.OpenIdAuthorization
|
baseSSOUrl = shuffle.GetOpenIdUrl(org)
|
||||||
|
|
||||||
codeChallenge := uuid.NewV4().String()
|
|
||||||
//h.Write([]byte(v.Value))
|
|
||||||
verifier, verifiererr := verifier()
|
|
||||||
if verifiererr == nil {
|
|
||||||
codeChallenge = verifier.Value
|
|
||||||
}
|
|
||||||
|
|
||||||
//log.Printf("[DEBUG] Got challenge value %s (pre state)", codeChallenge)
|
|
||||||
|
|
||||||
// https://192.168.55.222:3443/api/v1/login_openid
|
|
||||||
//location := strings.Split(request.URL.String(), "/")
|
|
||||||
//redirectUrl := url.QueryEscape("http://localhost:5001/api/v1/login_openid")
|
|
||||||
redirectUrl := url.QueryEscape(fmt.Sprintf("http://%s/api/v1/login_openid", request.Host))
|
|
||||||
if strings.Contains(request.Host, "shuffle-backend") && !strings.Contains(os.Getenv("BASE_URL"), "shuffle-backend") {
|
|
||||||
redirectUrl = url.QueryEscape(fmt.Sprintf("%s/api/v1/login_openid", os.Getenv("BASE_URL")))
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(os.Getenv("SSO_REDIRECT_URL")) > 0 {
|
|
||||||
redirectUrl = url.QueryEscape(fmt.Sprintf("%s/api/v1/login_openid", os.Getenv("SSO_REDIRECT_URL")))
|
|
||||||
}
|
|
||||||
|
|
||||||
state := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("org=%s&challenge=%s&redirect=%s", org.Id, codeChallenge, redirectUrl)))
|
|
||||||
|
|
||||||
// has to happen after initial value is stored
|
|
||||||
if verifiererr == nil {
|
|
||||||
codeChallenge = verifier.CodeChallengeS256()
|
|
||||||
}
|
|
||||||
|
|
||||||
//log.Printf("[DEBUG] Got challenge value %s (POST 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
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9079,47 +9079,48 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleWorkflowSelectionUpdate = (e, isUserinput) => {
|
const handleWorkflowSelectionUpdate = (e, isUserinput) => {
|
||||||
setUpdate(Math.random());
|
setUpdate(Math.random());
|
||||||
|
|
||||||
if (e.target.value === undefined || e.target.value === null || e.target.value.id === undefined) {
|
if (e.target.value === undefined || e.target.value === null || e.target.value.id === undefined) {
|
||||||
return null
|
console.log("Returning as there's no id")
|
||||||
}
|
return null
|
||||||
|
|
||||||
const paramIndex = isUserinput === true ? 5 : 0
|
|
||||||
workflow.triggers[selectedTriggerIndex].parameters[paramIndex].value = e.target.value.id;
|
|
||||||
setSubworkflow(e.target.value);
|
|
||||||
|
|
||||||
// Sets the startnode
|
|
||||||
if (e.target.value.id !== workflow.id) {
|
|
||||||
console.log("WORKFLOW: ", e.target.value);
|
|
||||||
|
|
||||||
const startnode = e.target.value.actions.find((action) => action.id === e.target.value.start);
|
|
||||||
|
|
||||||
|
|
||||||
if (startnode !== undefined && startnode !== null) {
|
|
||||||
setSubworkflowStartnode(startnode);
|
|
||||||
|
|
||||||
if (paramIndex === 0) {
|
|
||||||
try {
|
|
||||||
workflow.triggers[selectedTriggerIndex].parameters[3].value = startnode.id;
|
|
||||||
} catch {
|
|
||||||
workflow.triggers[selectedTriggerIndex].parameters[3] = {
|
|
||||||
name: "startnode",
|
|
||||||
value: startnode.id,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//setWorkflow(workflow);
|
|
||||||
}
|
|
||||||
console.log("STARTNODE: ", startnode);
|
|
||||||
} else {
|
|
||||||
console.log("WORKFLOW: ", workflow);
|
|
||||||
}
|
|
||||||
|
|
||||||
setWorkflow(workflow);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const paramIndex = isUserinput === true ? 5 : 0
|
||||||
|
workflow.triggers[selectedTriggerIndex].parameters[paramIndex].value = e.target.value.id;
|
||||||
|
setSubworkflow(e.target.value);
|
||||||
|
|
||||||
|
// Sets the startnode
|
||||||
|
if (e.target.value.id !== workflow.id) {
|
||||||
|
console.log("WORKFLOW: ", e.target.value);
|
||||||
|
|
||||||
|
const startnode = e.target.value.actions.find((action) => action.id === e.target.value.start);
|
||||||
|
|
||||||
|
|
||||||
|
if (startnode !== undefined && startnode !== null) {
|
||||||
|
setSubworkflowStartnode(startnode);
|
||||||
|
|
||||||
|
if (paramIndex === 0) {
|
||||||
|
try {
|
||||||
|
workflow.triggers[selectedTriggerIndex].parameters[3].value = startnode.id;
|
||||||
|
} catch {
|
||||||
|
workflow.triggers[selectedTriggerIndex].parameters[3] = {
|
||||||
|
name: "startnode",
|
||||||
|
value: startnode.id,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//setWorkflow(workflow);
|
||||||
|
}
|
||||||
|
console.log("STARTNODE: ", startnode);
|
||||||
|
} else {
|
||||||
|
console.log("WORKFLOW: ", workflow);
|
||||||
|
}
|
||||||
|
|
||||||
|
setWorkflow(workflow);
|
||||||
|
}
|
||||||
|
|
||||||
const SubflowSidebar = () => {
|
const SubflowSidebar = () => {
|
||||||
const [menuPosition, setMenuPosition] = useState(null);
|
const [menuPosition, setMenuPosition] = useState(null);
|
||||||
const [showDropdown, setShowDropdown] = React.useState(false);
|
const [showDropdown, setShowDropdown] = React.useState(false);
|
||||||
@@ -9880,7 +9881,7 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
id="subflow_search"
|
id="subflow_search"
|
||||||
autoHighlight
|
autoHighlight
|
||||||
freeSolo
|
freeSolo
|
||||||
autoSelect
|
//autoSelect
|
||||||
value={subworkflow}
|
value={subworkflow}
|
||||||
classes={{ inputRoot: classes.inputRoot }}
|
classes={{ inputRoot: classes.inputRoot }}
|
||||||
ListboxProps={{
|
ListboxProps={{
|
||||||
@@ -9914,7 +9915,24 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
}}
|
}}
|
||||||
onChange={(event, newValue) => {
|
onChange={(event, newValue) => {
|
||||||
console.log("Found value: ", newValue)
|
console.log("Found value: ", newValue)
|
||||||
handleWorkflowSelectionUpdate({ target: { value: newValue } })
|
|
||||||
|
var parsedinput = { target: { value: newValue } }
|
||||||
|
|
||||||
|
// For variables
|
||||||
|
if (typeof newValue === 'string' && newValue.startsWith("$")) {
|
||||||
|
parsedinput = {
|
||||||
|
target: {
|
||||||
|
value: {
|
||||||
|
"name": newValue,
|
||||||
|
"id": newValue,
|
||||||
|
"actions": [],
|
||||||
|
"triggers": [],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
handleWorkflowSelectionUpdate(parsedinput)
|
||||||
}}
|
}}
|
||||||
renderOption={(data, index) => {
|
renderOption={(data, index) => {
|
||||||
if (data.id === workflow.id) {
|
if (data.id === workflow.id) {
|
||||||
|
|||||||
@@ -88,10 +88,8 @@ const LoginDialog = (props) => {
|
|||||||
if (responseJson["success"] === false) {
|
if (responseJson["success"] === false) {
|
||||||
setLoginInfo(responseJson["reason"]);
|
setLoginInfo(responseJson["reason"]);
|
||||||
} else {
|
} else {
|
||||||
if (
|
|
||||||
responseJson.sso_url !== undefined &&
|
if (responseJson.sso_url !== undefined && responseJson.sso_url !== null) {
|
||||||
responseJson.sso_url !== null
|
|
||||||
) {
|
|
||||||
setSSOUrl(responseJson.sso_url);
|
setSSOUrl(responseJson.sso_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user