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/h2non/filetype v1.1.3
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
google.golang.org/api v0.125.0
google.golang.org/grpc v1.55.0
+10 -9
View File
@@ -767,7 +767,7 @@ const AuthenticationOauth2 = (props) => {
</Tooltip>
}
</span>
<Typography style={{textAlign: "center", marginTop: 0, marginBottom: 10, }}>
<Typography style={{textAlign: "center", marginTop: 0, marginBottom: 0, }}>
OR
</Typography>
</span>
@@ -805,18 +805,19 @@ const AuthenticationOauth2 = (props) => {
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 fieldname = data.name === "url" && authenticationType.grant_type !== undefined && authenticationType.grant_type !== null && authenticationType.grant_type.length > 0 ? "Token URL" : data.name
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
return (
<div key={index} style={{ marginTop: 10 }}>
<div key={index} style={{ marginTop: 0, }}>
<LockOpenIcon style={{ marginRight: 10 }} />
<b>{fieldname}</b>
{data.schema !== undefined &&
data.schema !== null &&
data.schema.type === "bool" ? (
data.schema !== null &&
data.schema.type === "bool" ?
<Select
SelectDisplayProps={{
style: {
@@ -857,7 +858,7 @@ const AuthenticationOauth2 = (props) => {
true
</MenuItem>
</Select>
) : (
:
<TextField
style={{
backgroundColor: theme.palette.inputColor,
@@ -884,9 +885,9 @@ const AuthenticationOauth2 = (props) => {
//const [oauthUrl, setOauthUrl] = React.useState("")
}}
/>
)}
}
</div>
);
)
})}
<TextField
style={{
-12
View File
@@ -1078,18 +1078,6 @@ const ParsedAction = (props) => {
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
if (
+11 -16
View File
@@ -4049,7 +4049,6 @@ const AngularWorkflow = (defaultprops) => {
if (!curapp || curapp === undefined) {
console.log("APPS - couldn't find it: ", newapps)
//toast(`App ${curaction.app_name}:${curaction.app_version} not found. Is it activated?`);
const tmpapp = {
name: curaction.app_name,
@@ -4057,20 +4056,16 @@ const AngularWorkflow = (defaultprops) => {
app_version: curaction.app_version,
id: curaction.app_id,
actions: [curaction],
};
}
setSelectedApp(tmpapp);
setSelectedAction(curaction);
setSelectedApp(tmpapp)
setSelectedAction(curaction)
} else {
//if (curapp.id !== curaction.id) {
// curaction.app_id = curapp.id
// //.valueOf()
//}
curaction.app_id = curapp.id
setAuthenticationType(
curapp.authentication.type === "oauth2" && curapp.authentication.redirect_uri !== undefined && curapp.authentication.redirect_uri !== null ? {
type: "oauth2",
curapp.authentication.type === "oauth2-app" || (curapp.authentication.type === "oauth2" && curapp.authentication.redirect_uri !== undefined && curapp.authentication.redirect_uri !== null) ? {
type: curapp.authentication.type,
redirect_uri: curapp.authentication.redirect_uri,
refresh_uri: curapp.authentication.refresh_uri,
token_uri: curapp.authentication.token_uri,
@@ -8117,7 +8112,7 @@ const AngularWorkflow = (defaultprops) => {
: `${pixelSize} solid ${yellow}`;
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
}
@@ -18258,13 +18253,13 @@ const AngularWorkflow = (defaultprops) => {
style={{
flex: 2,
padding: 0,
minHeight: isMobile ? "90%" : 650,
maxHeight: isMobile ? "90%" : 650,
minHeight: isMobile ? "90%" : 700,
maxHeight: isMobile ? "90%" : 700,
overflowY: "auto",
overflowX: isMobile ? "auto" : "hidden",
}}
>
{authenticationType.type === "oauth2" ? (
{authenticationType.type === "oauth2" || authenticationType.type === "oauth2-app" ?
<AuthenticationOauth2
saveWorkflow={saveWorkflow}
selectedApp={selectedApp}
@@ -18278,9 +18273,9 @@ const AngularWorkflow = (defaultprops) => {
setAuthenticationModalOpen={setAuthenticationModalOpen}
isCloud={isCloud}
/>
) : (
:
<AuthenticationData app={selectedApp} />
)}
}
</div>
<div
style={{
+7 -3
View File
@@ -1749,9 +1749,9 @@ const AppCreator = (defaultprops) => {
optionset = true
} else if (value.scheme === "oauth2") {
setAuthenticationOption("Oauth2");
setAuthenticationRequired(true);
optionset = true
setAuthenticationOption("Oauth2");
setAuthenticationRequired(true);
optionset = true
} else if (value.type === "oauth2" || key === "Oauth2" || key === "Oauth2c" || (key !== undefined && key !== null && key.toLowerCase().includes("oauth2"))) {
//toast("Can't handle Oauth2 auth yet.")
@@ -6054,6 +6054,10 @@ const AppCreator = (defaultprops) => {
if (e.target.value === "application" && oauth2GrantType === "") {
setOauth2GrantType("client_credentials")
}
if (e.target.value === "delegated") {
setOauth2GrantType("")
}
}}
value={oauth2Type}
+3 -3
View File
@@ -305,15 +305,15 @@ const SetAuthentication = (props) => {
variant="h4"
style={{ marginLeft: "auto", marginRight: "auto", marginTop: 50}}
>
Oauth2 setup
Oauth2 setup
</Typography>
<Typography
variant="h6"
style={{ marginLeft: "auto", marginRight: "auto", marginTop: 50}}
>
{!finished ? (
failed ?
null :
failed ?
null :
<CircularProgress />
) : (
"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 ?
null
:
app.authentication.type === "oauth2" ?
app.authentication.type === "oauth2" || app.authentication.type === "oauth2-app" ?
<AuthenticationOauth2
selectedApp={app}
selectedAction={{