From cc2610c2cb69da05f9727955310058cc1d23ce53 Mon Sep 17 00:00:00 2001 From: frikky Date: Sat, 29 Jan 2022 18:57:31 +0100 Subject: [PATCH] Added refresh token control in oauth2 registrations --- frontend/src/components/Oauth2Auth.jsx | 76 +++++++++++++++--------- frontend/src/components/ParsedAction.jsx | 2 + 2 files changed, 50 insertions(+), 28 deletions(-) diff --git a/frontend/src/components/Oauth2Auth.jsx b/frontend/src/components/Oauth2Auth.jsx index 627696e7..e63ee93c 100644 --- a/frontend/src/components/Oauth2Auth.jsx +++ b/frontend/src/components/Oauth2Auth.jsx @@ -49,6 +49,8 @@ const MenuProps = { scrollX: "auto", }, }, + variant: "menu", + getContentAnchorEl: null, }; const AuthenticationOauth2 = (props) => { @@ -84,6 +86,7 @@ const AuthenticationOauth2 = (props) => { const [oauthUrl, setOauthUrl] = React.useState(""); const [buttonClicked, setButtonClicked] = React.useState(false); const [selectedScopes, setSelectedScopes] = React.useState([]); + const [offlineAccess, setOfflineAccess] = React.useState(true); const allscopes = authenticationType.scope !== undefined ? authenticationType.scope : []; @@ -113,6 +116,10 @@ const AuthenticationOauth2 = (props) => { var resources = ""; if (scopes !== undefined && (scopes !== null) & (scopes.length > 0)) { + if (offlineAccess === true && !scopes.includes("offline_access")) { + scopes.push("offline_access") + } + resources = scopes.join(" "); //resources = scopes.join(","); } @@ -496,34 +503,47 @@ const AuthenticationOauth2 = (props) => { }} /> {allscopes.length === 0 ? null : ( - - Scopes - } - renderValue={(selected) => selected.join(", ")} - MenuProps={MenuProps} - > - {allscopes.map((data, index) => { - return ( - - -1} /> - - - ); - })} - - +
+ + Scopes + } + renderValue={(selected) => selected.join(", ")} + MenuProps={MenuProps} + > + {allscopes.map((data, index) => { + return ( + + -1} /> + + + ); + })} + + + + + { + setOfflineAccess(!offlineAccess) + }}/> + + +
)} )} diff --git a/frontend/src/components/ParsedAction.jsx b/frontend/src/components/ParsedAction.jsx index 29fa0d65..badf7a6c 100644 --- a/frontend/src/components/ParsedAction.jsx +++ b/frontend/src/components/ParsedAction.jsx @@ -2558,6 +2558,7 @@ const ParsedAction = (props) => { SelectDisplayProps={{ style: { marginLeft: 10, + maxWidth: 250, }, }} fullWidth @@ -2631,6 +2632,7 @@ const ParsedAction = (props) => { > { setAuthenticationModalOpen(true);