Skip to content

Commit

Permalink
Merge pull request #510 from SavinduDimal/mtls-http-ui
Browse files Browse the repository at this point in the history
Uncheck and disable http checkbox when Mutual SSL is enabled
  • Loading branch information
SavinduDimal authored Dec 5, 2023
2 parents 51d6b39 + 2121317 commit 3cb113f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,20 @@ function TransportLevel(props) {
});
};

const handleMutualSSLChange = (event) => {
const { checked } = event.target;
if (checked) {
configDispatcher({
action: 'transport',
event: { checked: false, value: 'http' },
});
}
configDispatcher({
action: 'securityScheme',
event: { checked, value: API_SECURITY_MUTUAL_SSL },
});
};

// Get the client certificates from backend.
useEffect(() => {
API.getAllClientCertificates(id).then((resp) => {
Expand Down Expand Up @@ -192,11 +206,7 @@ function TransportLevel(props) {
<Checkbox
disabled={isRestricted(['apim:api_create'], apiFromContext)}
checked={isMutualSSLEnabled}
onChange={({ target: { checked, value } }) => configDispatcher({
action: 'securityScheme',
event: { checked, value },
})}
value={API_SECURITY_MUTUAL_SSL}
onChange={handleMutualSSLChange}
color='primary'
id='mutual-ssl-checkbox'
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ export default function Transports(props) {
<FormControlLabel
control={(
<Checkbox
disabled={isRestricted(['apim:api_create'], apiFromContext)}
disabled={isRestricted(['apim:api_create'], apiFromContext) || isMutualSSLEnabled}
checked={api.transport
? api.transport.includes('http') : null}
? api.transport.includes('http') && !isMutualSSLEnabled : null}
onChange={({ target: { checked } }) => configDispatcher({
action: 'transport',
event: { checked, value: 'http' },
Expand Down

0 comments on commit 3cb113f

Please sign in to comment.