mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Pack request interceptor separately and remove X-Platform header
Related to entgra/product-iots#103
This commit is contained in:
parent
9cf570c463
commit
f163722437
@ -273,7 +273,6 @@ public class InvokerHandler extends HttpServlet {
|
|||||||
throws IOException {
|
throws IOException {
|
||||||
serverUrl = req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort();
|
serverUrl = req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort();
|
||||||
apiEndpoint = req.getPathInfo();
|
apiEndpoint = req.getPathInfo();
|
||||||
platform = req.getHeader(HandlerConstants.X_PLATFORM_HEADER);
|
|
||||||
HttpSession session = req.getSession(false);
|
HttpSession session = req.getSession(false);
|
||||||
|
|
||||||
if (session == null) {
|
if (session == null) {
|
||||||
@ -282,15 +281,8 @@ public class InvokerHandler extends HttpServlet {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isEmpty(platform)) {
|
authData = (AuthData) session.getAttribute(HandlerConstants.SESSION_AUTH_DATA_KEY);
|
||||||
log.error("\"X-Platform\" header is empty in the request. Header is required to obtain the auth data from" +
|
platform = (String) session.getAttribute(HandlerConstants.PLATFORM);
|
||||||
" session.");
|
|
||||||
handleError(req, resp, HttpStatus.SC_BAD_REQUEST);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
authData = (AuthData) session.getAttribute(platform);
|
|
||||||
|
|
||||||
if (authData == null) {
|
if (authData == null) {
|
||||||
log.error("Unauthorized, Access token not found in the current session");
|
log.error("Unauthorized, Access token not found in the current session");
|
||||||
handleError(req, resp, HttpStatus.SC_UNAUTHORIZED);
|
handleError(req, resp, HttpStatus.SC_UNAUTHORIZED);
|
||||||
|
|||||||
@ -193,7 +193,7 @@ public class LoginHandler extends HttpServlet {
|
|||||||
authData.setAccessToken(jTokenResultAsJsonObject.get("access_token").getAsString());
|
authData.setAccessToken(jTokenResultAsJsonObject.get("access_token").getAsString());
|
||||||
authData.setRefreshToken(jTokenResultAsJsonObject.get("refresh_token").getAsString());
|
authData.setRefreshToken(jTokenResultAsJsonObject.get("refresh_token").getAsString());
|
||||||
authData.setScope(jTokenResultAsJsonObject.get("scope").getAsString());
|
authData.setScope(jTokenResultAsJsonObject.get("scope").getAsString());
|
||||||
session.setAttribute(platform, authData);
|
session.setAttribute(HandlerConstants.SESSION_AUTH_DATA_KEY, authData);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,7 +28,7 @@ public class HandlerConstants {
|
|||||||
public static final String BEARER = "Bearer ";
|
public static final String BEARER = "Bearer ";
|
||||||
public static final String TAGS_KEY = "tags";
|
public static final String TAGS_KEY = "tags";
|
||||||
public static final String APP_NAME_KEY = "applicationName";
|
public static final String APP_NAME_KEY = "applicationName";
|
||||||
public static final String SESSION_AUTH_DATA_KEY = "application-mgt";
|
public static final String SESSION_AUTH_DATA_KEY = "authInfo";
|
||||||
public static final String UI_CONFIG_KEY = "ui-config";
|
public static final String UI_CONFIG_KEY = "ui-config";
|
||||||
public static final String PLATFORM = "platform";
|
public static final String PLATFORM = "platform";
|
||||||
public static final String DEFAULT_ERROR_CALLBACK = "/pages/error/default";
|
public static final String DEFAULT_ERROR_CALLBACK = "/pages/error/default";
|
||||||
@ -37,7 +37,6 @@ public class HandlerConstants {
|
|||||||
public static final String EXECUTOR_EXCEPTION_PREFIX = "ExecutorException-";
|
public static final String EXECUTOR_EXCEPTION_PREFIX = "ExecutorException-";
|
||||||
public static final String TOKEN_IS_EXPIRED = "ACCESS_TOKEN_IS_EXPIRED";
|
public static final String TOKEN_IS_EXPIRED = "ACCESS_TOKEN_IS_EXPIRED";
|
||||||
|
|
||||||
public static final String X_PLATFORM_HEADER = "X-Platform";
|
|
||||||
public static final String SCHEME_SEPARATOR = "://";
|
public static final String SCHEME_SEPARATOR = "://";
|
||||||
public static final String COLON = ":";
|
public static final String COLON = ":";
|
||||||
public static final String PATH_SEPARATOR = "/";
|
public static final String PATH_SEPARATOR = "/";
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
instructions.configure = \
|
instructions.configure = \
|
||||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps/);\
|
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps/);\
|
||||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/io.entgra.ui.request.interceptor_${feature.version}/webapps/ui-request-handler.war,target:${installFolder}/../../deployment/server/webapps/ui-request-handler.war,overwrite:true);\
|
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/io.entgra.ui.request.interceptor_${feature.version}/webapps/ui-request-handler.war,target:${installFolder}/../../deployment/server/webapps/publisher-ui-request-handler.war,overwrite:true);\
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/io.entgra.ui.request.interceptor_${feature.version}/webapps/ui-request-handler.war,target:${installFolder}/../../deployment/server/webapps/store-ui-request-handler.war,overwrite:true);\
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user