diff --git a/portals/devportal/src/main/webapp/source/src/app/components/Apis/Details/AsyncApiConsole/AsyncApiUI.jsx b/portals/devportal/src/main/webapp/source/src/app/components/Apis/Details/AsyncApiConsole/AsyncApiUI.jsx
index 266392e0731..84987cf32ba 100644
--- a/portals/devportal/src/main/webapp/source/src/app/components/Apis/Details/AsyncApiConsole/AsyncApiUI.jsx
+++ b/portals/devportal/src/main/webapp/source/src/app/components/Apis/Details/AsyncApiConsole/AsyncApiUI.jsx
@@ -149,13 +149,13 @@ export default function AsyncApiUI(props) {
function generateWSSubscriptionCommand(topic) {
const token = generateAccessToken();
if (topic.name.includes('*')) {
- let wscat = `wscat -c '${endPoint}' -H 'Authorization: ${token}'`;
+ let wscat = `wscat -c '${endPoint}' -H '${securitySchemeType === 'API-KEY' ? 'apikey' : 'Authorization'}: ${token}'`;
if (isAdvertised && authorizationHeader !== '') {
wscat = `wscat -c '${endPoint}' -H '${authorizationHeader}: ${token}'`;
}
return wscat;
} else {
- let wscat = `wscat -c '${endPoint}/${getTopicName(topic)}' -H 'Authorization: ${token}'`;
+ let wscat = `wscat -c '${endPoint}/${getTopicName(topic)}' -H '${securitySchemeType === 'API-KEY' ? 'apikey': 'Authorization'}: ${token}'`;
if (isAdvertised && authorizationHeader !== '') {
wscat = `wscat -c '${endPoint}/${getTopicName(topic)}' -H '${authorizationHeader}: ${token}'`;
}
diff --git a/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Configuration/RuntimeConfigurationWebSocket.jsx b/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Configuration/RuntimeConfigurationWebSocket.jsx
index a554a150169..f29172bec1d 100644
--- a/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Configuration/RuntimeConfigurationWebSocket.jsx
+++ b/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Configuration/RuntimeConfigurationWebSocket.jsx
@@ -24,6 +24,13 @@ import Paper from '@material-ui/core/Paper';
import { Link, useHistory } from 'react-router-dom';
import Box from '@material-ui/core/Box';
import Button from '@material-ui/core/Button';
+import FormGroup from '@material-ui/core/FormGroup';
+import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails';
+import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
+import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary';
+import WrappedExpansionPanel from 'AppComponents/Shared/WrappedExpansionPanel';
+import Checkbox from '@material-ui/core/Checkbox';
+import FormControlLabel from '@material-ui/core/FormControlLabel';
import { FormattedMessage } from 'react-intl';
import Alert from 'AppComponents/Shared/Alert';
import ArrowForwardIcon from '@material-ui/icons/SettingsEthernet';
@@ -34,6 +41,10 @@ import API from 'AppData/api';
import Endpoints from './components/Endpoints';
import KeyManager from './components/KeyManager';
import APILevelRateLimitingPolicies from './components/APILevelRateLimitingPolicies';
+import {
+ DEFAULT_API_SECURITY_OAUTH2,
+ API_SECURITY_API_KEY
+} from './components/APISecurity/components/apiSecurityConstants';
const useStyles = makeStyles((theme) => ({
root: {
@@ -95,6 +106,9 @@ const useStyles = makeStyles((theme) => ({
display: 'flex',
height: '100%',
},
+ error: {
+ color: theme.palette.error.main,
+ }
}));
/**
@@ -177,6 +191,13 @@ export default function RuntimeConfiguration() {
nextState.keyManagers = ['all'];
}
return nextState;
+ case 'securityScheme':
+ if (value.checked) {
+ nextState.securityScheme = [...nextState.securityScheme, value.value];
+ } else {
+ nextState.securityScheme = nextState.securityScheme.filter((item) => item !== value.value);
+ }
+ return nextState;
default:
return state;
}
@@ -187,6 +208,23 @@ export default function RuntimeConfiguration() {
const [apiConfig, configDispatcher] = useReducer(configReducer, copyAPIConfig(api));
const classes = useStyles();
+ const Validate = () => {
+
+ if (!apiConfig.securityScheme.includes(DEFAULT_API_SECURITY_OAUTH2)
+ && !apiConfig.securityScheme.includes(API_SECURITY_API_KEY)
+ ) {
+ return (
+