Fixed oauth2-app mapping

This commit is contained in:
Frikky
2024-03-20 03:42:50 +01:00
parent 2b3675a329
commit 05b80d2f55
7 changed files with 33 additions and 45 deletions
+1 -1
View File
@@ -18,7 +18,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.5.93 github.com/shuffle/shuffle-shared v0.6.0
golang.org/x/crypto v0.16.0 golang.org/x/crypto v0.16.0
google.golang.org/api v0.125.0 google.golang.org/api v0.125.0
google.golang.org/grpc v1.55.0 google.golang.org/grpc v1.55.0
+10 -9
View File
@@ -767,7 +767,7 @@ const AuthenticationOauth2 = (props) => {
</Tooltip> </Tooltip>
} }
</span> </span>
<Typography style={{textAlign: "center", marginTop: 0, marginBottom: 10, }}> <Typography style={{textAlign: "center", marginTop: 0, marginBottom: 0, }}>
OR OR
</Typography> </Typography>
</span> </span>
@@ -805,18 +805,19 @@ const AuthenticationOauth2 = (props) => {
setOauthUrl(data.value); setOauthUrl(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.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 ? "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 (
<div key={index} style={{ marginTop: 10 }}> <div key={index} style={{ marginTop: 0, }}>
<LockOpenIcon style={{ marginRight: 10 }} /> <LockOpenIcon style={{ marginRight: 10 }} />
<b>{fieldname}</b> <b>{fieldname}</b>
{data.schema !== undefined && {data.schema !== undefined &&
data.schema !== null && data.schema !== null &&
data.schema.type === "bool" ? ( data.schema.type === "bool" ?
<Select <Select
SelectDisplayProps={{ SelectDisplayProps={{
style: { style: {
@@ -857,7 +858,7 @@ const AuthenticationOauth2 = (props) => {
true true
</MenuItem> </MenuItem>
</Select> </Select>
) : ( :
<TextField <TextField
style={{ style={{
backgroundColor: theme.palette.inputColor, backgroundColor: theme.palette.inputColor,
@@ -884,9 +885,9 @@ const AuthenticationOauth2 = (props) => {
//const [oauthUrl, setOauthUrl] = React.useState("") //const [oauthUrl, setOauthUrl] = React.useState("")
}} }}
/> />
)} }
</div> </div>
); )
})} })}
<TextField <TextField
style={{ style={{
-12
View File
@@ -1078,18 +1078,6 @@ const ParsedAction = (props) => {
return helperText return helperText
} }
//console.log("AUTH: ", authenticationType)
if (authenticationType !== undefined && authenticationType !== null && authenticationType.type === "oauth2") {
/*
return (
<Typography variant="body1" color="textSecondary" style={{marginTop: 15}}>
You must authenticate before using oauth2 apps.
</Typography>
)
*/
}
//console.log("APP: ", selectedApp)
// FIXME: Issue #40 - selectedActionParameters not reset // FIXME: Issue #40 - selectedActionParameters not reset
if ( if (
+11 -16
View File
@@ -4049,7 +4049,6 @@ const AngularWorkflow = (defaultprops) => {
if (!curapp || curapp === undefined) { if (!curapp || curapp === undefined) {
console.log("APPS - couldn't find it: ", newapps) console.log("APPS - couldn't find it: ", newapps)
//toast(`App ${curaction.app_name}:${curaction.app_version} not found. Is it activated?`);
const tmpapp = { const tmpapp = {
name: curaction.app_name, name: curaction.app_name,
@@ -4057,20 +4056,16 @@ const AngularWorkflow = (defaultprops) => {
app_version: curaction.app_version, app_version: curaction.app_version,
id: curaction.app_id, id: curaction.app_id,
actions: [curaction], actions: [curaction],
}; }
setSelectedApp(tmpapp); setSelectedApp(tmpapp)
setSelectedAction(curaction); setSelectedAction(curaction)
} else { } else {
//if (curapp.id !== curaction.id) {
// curaction.app_id = curapp.id
// //.valueOf()
//}
curaction.app_id = curapp.id curaction.app_id = curapp.id
setAuthenticationType( setAuthenticationType(
curapp.authentication.type === "oauth2" && curapp.authentication.redirect_uri !== undefined && curapp.authentication.redirect_uri !== null ? { curapp.authentication.type === "oauth2-app" || (curapp.authentication.type === "oauth2" && curapp.authentication.redirect_uri !== undefined && curapp.authentication.redirect_uri !== null) ? {
type: "oauth2", type: curapp.authentication.type,
redirect_uri: curapp.authentication.redirect_uri, redirect_uri: curapp.authentication.redirect_uri,
refresh_uri: curapp.authentication.refresh_uri, refresh_uri: curapp.authentication.refresh_uri,
token_uri: curapp.authentication.token_uri, token_uri: curapp.authentication.token_uri,
@@ -8117,7 +8112,7 @@ const AngularWorkflow = (defaultprops) => {
: `${pixelSize} solid ${yellow}`; : `${pixelSize} solid ${yellow}`;
if (app.id == highlightedApp) { if (app.id == highlightedApp) {
console.log("Found correct appid to highlight: ", app.id) //console.log("Found correct appid to highlight: ", app.id)
newAppStyle.border = "3px solid " + green newAppStyle.border = "3px solid " + green
} }
@@ -18258,13 +18253,13 @@ const AngularWorkflow = (defaultprops) => {
style={{ style={{
flex: 2, flex: 2,
padding: 0, padding: 0,
minHeight: isMobile ? "90%" : 650, minHeight: isMobile ? "90%" : 700,
maxHeight: isMobile ? "90%" : 650, maxHeight: isMobile ? "90%" : 700,
overflowY: "auto", overflowY: "auto",
overflowX: isMobile ? "auto" : "hidden", overflowX: isMobile ? "auto" : "hidden",
}} }}
> >
{authenticationType.type === "oauth2" ? ( {authenticationType.type === "oauth2" || authenticationType.type === "oauth2-app" ?
<AuthenticationOauth2 <AuthenticationOauth2
saveWorkflow={saveWorkflow} saveWorkflow={saveWorkflow}
selectedApp={selectedApp} selectedApp={selectedApp}
@@ -18278,9 +18273,9 @@ const AngularWorkflow = (defaultprops) => {
setAuthenticationModalOpen={setAuthenticationModalOpen} setAuthenticationModalOpen={setAuthenticationModalOpen}
isCloud={isCloud} isCloud={isCloud}
/> />
) : ( :
<AuthenticationData app={selectedApp} /> <AuthenticationData app={selectedApp} />
)} }
</div> </div>
<div <div
style={{ style={{
+7 -3
View File
@@ -1749,9 +1749,9 @@ const AppCreator = (defaultprops) => {
optionset = true optionset = true
} else if (value.scheme === "oauth2") { } else if (value.scheme === "oauth2") {
setAuthenticationOption("Oauth2"); setAuthenticationOption("Oauth2");
setAuthenticationRequired(true); setAuthenticationRequired(true);
optionset = true optionset = true
} else if (value.type === "oauth2" || key === "Oauth2" || key === "Oauth2c" || (key !== undefined && key !== null && key.toLowerCase().includes("oauth2"))) { } else if (value.type === "oauth2" || key === "Oauth2" || key === "Oauth2c" || (key !== undefined && key !== null && key.toLowerCase().includes("oauth2"))) {
//toast("Can't handle Oauth2 auth yet.") //toast("Can't handle Oauth2 auth yet.")
@@ -6054,6 +6054,10 @@ const AppCreator = (defaultprops) => {
if (e.target.value === "application" && oauth2GrantType === "") { if (e.target.value === "application" && oauth2GrantType === "") {
setOauth2GrantType("client_credentials") setOauth2GrantType("client_credentials")
}
if (e.target.value === "delegated") {
setOauth2GrantType("")
} }
}} }}
value={oauth2Type} value={oauth2Type}
+3 -3
View File
@@ -305,15 +305,15 @@ const SetAuthentication = (props) => {
variant="h4" variant="h4"
style={{ marginLeft: "auto", marginRight: "auto", marginTop: 50}} style={{ marginLeft: "auto", marginRight: "auto", marginTop: 50}}
> >
Oauth2 setup Oauth2 setup
</Typography> </Typography>
<Typography <Typography
variant="h6" variant="h6"
style={{ marginLeft: "auto", marginRight: "auto", marginTop: 50}} style={{ marginLeft: "auto", marginRight: "auto", marginTop: 50}}
> >
{!finished ? ( {!finished ? (
failed ? failed ?
null : null :
<CircularProgress /> <CircularProgress />
) : ( ) : (
"Done - this window should close within 3 seconds." "Done - this window should close within 3 seconds."
+1 -1
View File
@@ -141,7 +141,7 @@ const SetAuthentication = (props) => {
{app.authentication === undefined || app.authentication === null || app.authentication.length === 0 ? {app.authentication === undefined || app.authentication === null || app.authentication.length === 0 ?
null null
: :
app.authentication.type === "oauth2" ? app.authentication.type === "oauth2" || app.authentication.type === "oauth2-app" ?
<AuthenticationOauth2 <AuthenticationOauth2
selectedApp={app} selectedApp={app}
selectedAction={{ selectedAction={{