Fix APPM login issue

4.x.x
lasanthaDLPDS 5 years ago
parent caf7cd133b
commit 4d3c7e1c79

@ -118,9 +118,12 @@ public class LoginHandler extends HttpServlet {
apiRegEndpoint.setEntity(constructAppRegPayload(tags)); apiRegEndpoint.setEntity(constructAppRegPayload(tags));
ProxyResponse clientAppResponse = HandlerUtil.execute(apiRegEndpoint); ProxyResponse clientAppResponse = HandlerUtil.execute(apiRegEndpoint);
String clientAppResult = clientAppResponse.getData();
if (!StringUtils.isEmpty(clientAppResult) && getTokenAndPersistInSession(req, resp, if (clientAppResponse.getCode() == HttpStatus.SC_UNAUTHORIZED){
HandlerUtil.handleError(req, resp, serverUrl, platform, clientAppResponse);
return;
}
if (clientAppResponse.getCode() == HttpStatus.SC_CREATED && getTokenAndPersistInSession(req, resp,
clientAppResponse.getData(), scopes)) { clientAppResponse.getData(), scopes)) {
ProxyResponse proxyResponse = new ProxyResponse(); ProxyResponse proxyResponse = new ProxyResponse();
proxyResponse.setCode(HttpStatus.SC_OK); proxyResponse.setCode(HttpStatus.SC_OK);
@ -253,6 +256,8 @@ public class LoginHandler extends HttpServlet {
private StringEntity constructAppRegPayload(JsonArray tags) { private StringEntity constructAppRegPayload(JsonArray tags) {
JsonObject jsonObject = new JsonObject(); JsonObject jsonObject = new JsonObject();
jsonObject.addProperty(HandlerConstants.APP_NAME_KEY, HandlerConstants.PUBLISHER_APPLICATION_NAME); jsonObject.addProperty(HandlerConstants.APP_NAME_KEY, HandlerConstants.PUBLISHER_APPLICATION_NAME);
jsonObject.addProperty(HandlerConstants.USERNAME, username);
jsonObject.addProperty(HandlerConstants.PASSWORD, password);
jsonObject.addProperty("isAllowedToAllDomains", "false"); jsonObject.addProperty("isAllowedToAllDomains", "false");
jsonObject.add(HandlerConstants.TAGS_KEY, tags); jsonObject.add(HandlerConstants.TAGS_KEY, tags);
String payload = jsonObject.toString(); String payload = jsonObject.toString();

@ -31,6 +31,8 @@ public class HandlerConstants {
public static final String SESSION_AUTH_DATA_KEY = "authInfo"; 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 USERNAME = "username";
public static final String PASSWORD = "password";
public static final String DEFAULT_ERROR_CALLBACK = "/pages/error/default"; public static final String DEFAULT_ERROR_CALLBACK = "/pages/error/default";
public static final String ERROR_CALLBACK_KEY = "errorCallback"; public static final String ERROR_CALLBACK_KEY = "errorCallback";
public static final String API_COMMON_CONTEXT = "/api"; public static final String API_COMMON_CONTEXT = "/api";

Loading…
Cancel
Save