Add modifications

remotes/1729253769841084517/master
Thashmi-nil 2 years ago
parent 2d1879d1b6
commit 798e851922

@ -0,0 +1,54 @@
package org.wso2.carbon.device.mgt.core.config.ui;
import javax.xml.bind.annotation.XmlElement;
public class HubspotChat {
private boolean isEnableHubspot;
private String trackingUrl;
private String accessToken;
private String senderActorId;
private long channelAccountId;
@XmlElement(name = "EnableHubspot")
public boolean isEnableHubspot() {
return isEnableHubspot;
}
public void setEnableHubspot(boolean enableHubspot) {
isEnableHubspot = enableHubspot;
}
@XmlElement(name = "TrackingUrl")
public String getTrackingUrl() {
return trackingUrl;
}
public void setTrackingUrl(String trackingUrl) {
this.trackingUrl = trackingUrl;
}
@XmlElement(name = "AccessToken")
public String getAccessToken() {
return accessToken;
}
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
@XmlElement(name = "SenderActorId")
public String getSenderActorId() {
return senderActorId;
}
public void setSenderActorId(String senderActorId) {
this.senderActorId = senderActorId;
}
@XmlElement(name = "ChannelAccountId")
public long getChannelAccountId() {
return channelAccountId;
}
public void setChannelAccountId(long channelAccountId) {
this.channelAccountId = channelAccountId;
}
}

@ -34,7 +34,7 @@ public class UIConfiguration {
private int sessionTimeOut;
private int loginCacheCapacity;
private Billing billing;
private String chatConfig;
private HubspotChat hubspotChat;
@XmlElement(name = "AppRegistration", required=true)
public AppRegistration getAppRegistration() {
@ -64,15 +64,14 @@ public class UIConfiguration {
isSsoEnable = ssoEnable;
}
@XmlElement(name = "ChatConfig", required = true)
public String getChatConfig() {
return chatConfig;
@XmlElement(name = "HubspotChat", required = true)
public HubspotChat getHubspotChat() {
return hubspotChat;
}
public void setChatConfig(String chatConfig) {
this.chatConfig = chatConfig;
public void setHubspotChat(HubspotChat hubspotChat) {
this.hubspotChat = hubspotChat;
}
@XmlElement(name = "Billing", required=true)
public Billing getBilling() {
return billing;

@ -96,6 +96,7 @@ public class HubspotHandler extends HttpServlet {
*/
private boolean validateRequest(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
httpSession = req.getSession(false);
if (httpSession == null) {
log.error("Unauthorized, You are not logged in. Please log in to the portal");
HandlerUtil.handleError(resp, HttpStatus.SC_UNAUTHORIZED);
@ -106,14 +107,13 @@ public class HubspotHandler extends HttpServlet {
HandlerUtil.handleError(resp, HttpStatus.SC_BAD_REQUEST);
return false;
}
httpSession = req.getSession(false);
gatewayUrl = req.getScheme() + HandlerConstants.SCHEME_SEPARATOR + System.getProperty(HandlerConstants.IOT_GW_HOST_ENV_VAR)
+ HandlerConstants.COLON + HandlerUtil.getGatewayPort(req.getScheme());
iotsCoreUrl = req.getScheme() + HandlerConstants.SCHEME_SEPARATOR + System.getProperty(HandlerConstants.IOT_CORE_HOST_ENV_VAR)
+ HandlerConstants.COLON + HandlerUtil.getCorePort(req.getScheme());
String uiConfigUrl = iotsCoreUrl + HandlerConstants.UI_CONFIG_ENDPOINT;
uiConfigJsonObject = HandlerUtil.getUIConfigAndPersistInSession(uiConfigUrl, gatewayUrl, httpSession, resp);
chatConfig = uiConfigJsonObject.get("chatConfig").getAsString();
chatConfig = uiConfigJsonObject.get("hubspotChat").getAsJsonObject().get("accessToken").getAsString();
hubspotEndpoint = HandlerConstants.HTTPS_PROTOCOL + HandlerConstants.SCHEME_SEPARATOR + HandlerConstants.HUBSPOT_CHAT_URL;
return true;
}

@ -24,8 +24,15 @@
<SessionTimeOut>3600</SessionTimeOut>
<!-- maximum number of login cache entries -->
<LoginCacheCapacity>10000</LoginCacheCapacity>
<!-- access token for hubspot live chat feature - whenever the access token will be rotated, needs to be changed this with the new token -->
<ChatConfig>pat-na1-33bc59e0-3526-45b0-b9cf-f353d0ae0ced</ChatConfig>
<!-- hubspot account info for live chat -->
<HubspotChat>
<EnableHubspot>false</EnableHubspot>
<TrackingUrl>tracking_url</TrackingUrl>
<!-- access token - whenever the access token will be rotated, needs to be changed this with the new token -->
<AccessToken>access_token</AccessToken>
<SenderActorId>sender_actorId</SenderActorId>
<ChannelAccountId>channel_AccountId</ChannelAccountId>
</HubspotChat>
<Billing>
<HideBillGenerationInSuperTenant>false</HideBillGenerationInSuperTenant>
<HideBillGenerationInSubTenant>true</HideBillGenerationInSubTenant>

Loading…
Cancel
Save