Commit ad249b17 authored by Matija Obreza's avatar Matija Obreza

Merge branch 'oauth-client-editor' into 'master'

Edit and display allowed CORS origins for OAuth clients

See merge request genesys-pgr/genesys-ui!194
parents 3d02490e 9e9ee707
......@@ -2002,6 +2002,8 @@
},
"roleLabel": "User roles",
"oAuth": {
"allowedOrigins": "Allowed CORS origins",
"autoApproveScopes": "Auto-approved scopes",
"clientId": "clientId",
"clientTitle": "Title",
"accessTokenValidity": "Access token validity",
......
......@@ -30,6 +30,7 @@ class OAuthClient {
public refreshTokenValidity: number;
public refreshTokenValiditySeconds: number;
public registeredRedirectUri: string[];
public allowedOrigins: string[];
public resourceIds: string[];
public roles: string[];
public scoped: boolean;
......
......@@ -153,6 +153,8 @@
},
"roleLabel": "User roles",
"oAuth": {
"allowedOrigins": "Allowed CORS origins",
"autoApproveScopes": "Auto-approved scopes",
"clientId": "clientId",
"clientTitle": "Title",
"accessTokenValidity": "Access token validity",
......
......@@ -35,6 +35,9 @@ const OAuthClientCard = ({ compact = false, oAuthClient, removeSecretRequest, in
<div>
{ oAuthClient.description }
</div>
<div>
{ oAuthClient.allowedOrigins && oAuthClient.allowedOrigins.map((uri, i) => <span key={ uri + i } className="pr-5">{ uri }</span>) }
</div>
</CardContent>
</Card>
) : (
......@@ -58,6 +61,7 @@ const OAuthClientCard = ({ compact = false, oAuthClient, removeSecretRequest, in
{ oAuthClient.registeredRedirectUri && oAuthClient.registeredRedirectUri.length > 0 &&
<PropertiesItem title={ t('user.common.oAuth.redirectUris') }>{ oAuthClient.registeredRedirectUri.map((uri, i) => <div key={ uri + i } className="mb-5">{ uri }</div>) }</PropertiesItem>
}
<PropertiesItem title={ t('user.common.oAuth.allowedOrigins') }>{ oAuthClient.allowedOrigins && oAuthClient.allowedOrigins.map((uri, i) => <div key={ uri + i } className="mb-5">{ uri }</div>) }</PropertiesItem>
{ oAuthClient.resourceIds && oAuthClient.resourceIds.length > 0 &&
<PropertiesItem title={ t('user.common.oAuth.resourceIds') }>{ oAuthClient.resourceIds.map((id, i) => <div key={ id + i } className="mb-5">{ id }</div>) }</PropertiesItem>
}
......
......@@ -68,6 +68,7 @@ class UserForm extends React.Component<any, any> {
validate={ [Validators.decimalNumber] }
/>
<ItemsEditor name="registeredRedirectUri" itemLabel={ t('user.common.oAuth.redirectUris') } addItem={ console.log } removeItem={ console.log } component={ stringField }/>
<ItemsEditor name="allowedOrigins" itemLabel={ t('user.common.oAuth.allowedOrigins') } addItem={ console.log } removeItem={ console.log } component={ stringField }/>
<FieldArray
name="authorizedGrantTypes"
options={ OAuthClient.AVAILABLE_GRANT_TYPES }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment