Added refresh token control in oauth2 registrations

This commit is contained in:
frikky
2022-01-29 18:57:31 +01:00
parent 3dda16cfe7
commit cc2610c2cb
2 changed files with 50 additions and 28 deletions
+22 -2
View File
@@ -49,6 +49,8 @@ const MenuProps = {
scrollX: "auto", scrollX: "auto",
}, },
}, },
variant: "menu",
getContentAnchorEl: null,
}; };
const AuthenticationOauth2 = (props) => { const AuthenticationOauth2 = (props) => {
@@ -84,6 +86,7 @@ const AuthenticationOauth2 = (props) => {
const [oauthUrl, setOauthUrl] = React.useState(""); const [oauthUrl, setOauthUrl] = React.useState("");
const [buttonClicked, setButtonClicked] = React.useState(false); const [buttonClicked, setButtonClicked] = React.useState(false);
const [selectedScopes, setSelectedScopes] = React.useState([]); const [selectedScopes, setSelectedScopes] = React.useState([]);
const [offlineAccess, setOfflineAccess] = React.useState(true);
const allscopes = const allscopes =
authenticationType.scope !== undefined ? authenticationType.scope : []; authenticationType.scope !== undefined ? authenticationType.scope : [];
@@ -113,6 +116,10 @@ const AuthenticationOauth2 = (props) => {
var resources = ""; var resources = "";
if (scopes !== undefined && (scopes !== null) & (scopes.length > 0)) { 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(" ");
//resources = scopes.join(","); //resources = scopes.join(",");
} }
@@ -496,7 +503,8 @@ const AuthenticationOauth2 = (props) => {
}} }}
/> />
{allscopes.length === 0 ? null : ( {allscopes.length === 0 ? null : (
<span style={{marginTop: 10}}> <div style={{width: "100%", marginTop: 10, display: "flex"}}>
<span>
Scopes Scopes
<Select <Select
multiple multiple
@@ -507,7 +515,7 @@ const AuthenticationOauth2 = (props) => {
padding: 5, padding: 5,
}} }}
onChange={(e) => { onChange={(e) => {
handleScopeChange(e); handleScopeChange(e)
}} }}
fullWidth fullWidth
input={<Input id="select-multiple-native" />} input={<Input id="select-multiple-native" />}
@@ -524,6 +532,18 @@ const AuthenticationOauth2 = (props) => {
})} })}
</Select> </Select>
</span> </span>
<span>
<Tooltip
color="primary"
title={"Automatic Refresh (default: true)"}
placement="top"
>
<Checkbox style={{paddingTop: 10}} color="secondary" checked={offlineAccess} onClick={() => {
setOfflineAccess(!offlineAccess)
}}/>
</Tooltip>
</span>
</div>
)} )}
</span> </span>
)} )}
+2
View File
@@ -2558,6 +2558,7 @@ const ParsedAction = (props) => {
SelectDisplayProps={{ SelectDisplayProps={{
style: { style: {
marginLeft: 10, marginLeft: 10,
maxWidth: 250,
}, },
}} }}
fullWidth fullWidth
@@ -2631,6 +2632,7 @@ const ParsedAction = (props) => {
> >
<IconButton <IconButton
color="primary" color="primary"
variant="outlined"
style={{}} style={{}}
onClick={() => { onClick={() => {
setAuthenticationModalOpen(true); setAuthenticationModalOpen(true);