mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge branch 'application-mgt-new' of https://gitlab.com/tcdlpds/carbon-device-mgt into application-mgt-new
This commit is contained in:
commit
281511d93e
@ -57,7 +57,7 @@ import javax.ws.rs.core.Response;
|
|||||||
public interface ArtifactDownloadAPI {
|
public interface ArtifactDownloadAPI {
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/download-artifact/{md5sum}/{fileName}")
|
@Path("/download-artifact/{uuid}/{fileName}")
|
||||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
@ApiOperation(
|
@ApiOperation(
|
||||||
produces = MediaType.APPLICATION_OCTET_STREAM,
|
produces = MediaType.APPLICATION_OCTET_STREAM,
|
||||||
@ -82,10 +82,10 @@ public interface ArtifactDownloadAPI {
|
|||||||
})
|
})
|
||||||
Response getArtifact(
|
Response getArtifact(
|
||||||
@ApiParam(
|
@ApiParam(
|
||||||
name = "md5sum",
|
name = "uuid",
|
||||||
value = "md5sum of the application release installer",
|
value = "UUID of the application release.",
|
||||||
required = true)
|
required = true)
|
||||||
@PathParam("md5sum") String md5sum,
|
@PathParam("uuid") String uuid,
|
||||||
@ApiParam(
|
@ApiParam(
|
||||||
name = "fileName",
|
name = "fileName",
|
||||||
value = "Name of the artifact",
|
value = "Name of the artifact",
|
||||||
|
|||||||
@ -44,9 +44,9 @@ public class ArtifactDownloadAPIImpl implements ArtifactDownloadAPI {
|
|||||||
@GET
|
@GET
|
||||||
@Override
|
@Override
|
||||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
@Path("/download-artifact/{md5sum}/{fileName}")
|
@Path("/download-artifact/{uuid}/{fileName}")
|
||||||
public Response getArtifact(
|
public Response getArtifact(
|
||||||
@PathParam("md5sum") String md5sum,
|
@PathParam("uuid") String uuid,
|
||||||
@PathParam("fileName") String fileName) {
|
@PathParam("fileName") String fileName) {
|
||||||
AppmDataHandler dataHandler = APIUtil.getDataHandler();
|
AppmDataHandler dataHandler = APIUtil.getDataHandler();
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -99,7 +99,5 @@ public interface ApplicationStorageManager {
|
|||||||
* @return {@link InputStream}
|
* @return {@link InputStream}
|
||||||
* @throws ApplicationStorageManagementException throws if an error occurs when accessing the file.
|
* @throws ApplicationStorageManagementException throws if an error occurs when accessing the file.
|
||||||
*/
|
*/
|
||||||
InputStream getFileSttream (String path) throws ApplicationStorageManagementException;
|
InputStream getFileSttream(String path) throws ApplicationStorageManagementException;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@ -86,8 +86,8 @@ public interface ApplicationReleaseDAO {
|
|||||||
* @return the updated ApplicationDTO Release
|
* @return the updated ApplicationDTO Release
|
||||||
* @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception
|
* @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception
|
||||||
*/
|
*/
|
||||||
ApplicationReleaseDTO updateRelease(ApplicationReleaseDTO applicationRelease, int tenantId) throws
|
ApplicationReleaseDTO updateRelease(ApplicationReleaseDTO applicationRelease, int tenantId)
|
||||||
ApplicationManagementDAOException;
|
throws ApplicationManagementDAOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To update an ApplicationDTO release.
|
* To update an ApplicationDTO release.
|
||||||
@ -168,7 +168,7 @@ public interface ApplicationReleaseDAO {
|
|||||||
*/
|
*/
|
||||||
boolean verifyReleaseExistenceByUuid(String uuid, int tenantId) throws ApplicationManagementDAOException;
|
boolean verifyReleaseExistenceByUuid(String uuid, int tenantId) throws ApplicationManagementDAOException;
|
||||||
|
|
||||||
ApplicationReleaseArtifactPaths getReleaseArtifactPaths(String uuid, int tenantId) throws ApplicationManagementDAOException;
|
String getReleaseHashValue(String uuid, int tenantId) throws ApplicationManagementDAOException;
|
||||||
|
|
||||||
/***
|
/***
|
||||||
*
|
*
|
||||||
|
|||||||
@ -656,7 +656,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApplicationReleaseArtifactPaths getReleaseArtifactPaths(String uuid, int tenantId) throws ApplicationManagementDAOException{
|
public String getReleaseHashValue(String uuid, int tenantId) throws ApplicationManagementDAOException{
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.debug("Getting application release artifact stored location paths for: " + uuid);
|
log.debug("Getting application release artifact stored location paths for: " + uuid);
|
||||||
}
|
}
|
||||||
@ -664,15 +664,12 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
|
|||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
ApplicationReleaseArtifactPaths applicationReleaseArtifactPaths = null;
|
ApplicationReleaseArtifactPaths applicationReleaseArtifactPaths = null;
|
||||||
|
String releaseHashValue = null;
|
||||||
try {
|
try {
|
||||||
conn = this.getDBConnection();
|
conn = this.getDBConnection();
|
||||||
String sql = "SELECT AR.INSTALLER_LOCATION AS INSTALLER,"
|
String sql = "SELECT "
|
||||||
+ "AR.ICON_LOCATION AS ICON,"
|
+ "AR.APP_HASH_VALUE AS HASH_VALUE "
|
||||||
+ "AR.BANNER_LOCATION AS BANNER,"
|
+ "FROM AP_APP_RELEASE "
|
||||||
+ "AR.SC_1_LOCATION AS SC1,"
|
|
||||||
+ "AR.SC_2_LOCATION AS SC2,"
|
|
||||||
+ "AR.SC_3_LOCATION AS SC3 "
|
|
||||||
+ "FROM AP_APP_RELEASE AS AR "
|
|
||||||
+ "WHERE AR.UUID = ? AND AR.TENANT_ID = ?;";
|
+ "WHERE AR.UUID = ? AND AR.TENANT_ID = ?;";
|
||||||
|
|
||||||
stmt = conn.prepareStatement(sql);
|
stmt = conn.prepareStatement(sql);
|
||||||
@ -686,21 +683,15 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
|
|||||||
+ uuid);
|
+ uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rs.getFetchSize() == 0 || rs.getFetchSize() >1){
|
if (rs.getFetchSize() >1){
|
||||||
return null;
|
String msg = "Found more than one application release for UUID: " + uuid;
|
||||||
|
log.error(msg);
|
||||||
|
throw new ApplicationManagementDAOException(msg);
|
||||||
}
|
}
|
||||||
while(rs.next()){
|
while(rs.next()){
|
||||||
applicationReleaseArtifactPaths = new ApplicationReleaseArtifactPaths();
|
releaseHashValue = rs.getString("HASH_VALUE");
|
||||||
List<String> scs = new ArrayList<>();
|
|
||||||
applicationReleaseArtifactPaths.setInstallerPath(rs.getString("INSTALLER"));
|
|
||||||
applicationReleaseArtifactPaths.setIconPath(rs.getString("ICON"));
|
|
||||||
applicationReleaseArtifactPaths.setBannerPath(rs.getString("BANNER"));
|
|
||||||
scs.add(rs.getString("SC1"));
|
|
||||||
scs.add(rs.getString("SC2"));
|
|
||||||
scs.add(rs.getString("SC3"));
|
|
||||||
applicationReleaseArtifactPaths.setScreenshotPaths(scs);
|
|
||||||
}
|
}
|
||||||
return applicationReleaseArtifactPaths;
|
return releaseHashValue;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new ApplicationManagementDAOException(
|
throw new ApplicationManagementDAOException(
|
||||||
"Error occurred when executing query to get application release artifact paths for App release uuid: "
|
"Error occurred when executing query to get application release artifact paths for App release uuid: "
|
||||||
|
|||||||
@ -29,6 +29,8 @@ import org.wso2.carbon.device.application.mgt.core.dao.ApplicationReleaseDAO;
|
|||||||
import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOFactory;
|
import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOFactory;
|
||||||
import org.wso2.carbon.device.application.mgt.core.dao.common.Util;
|
import org.wso2.carbon.device.application.mgt.core.dao.common.Util;
|
||||||
import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException;
|
import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException;
|
||||||
|
import org.wso2.carbon.device.application.mgt.core.exception.BadRequestException;
|
||||||
|
import org.wso2.carbon.device.application.mgt.core.util.Constants;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
@ -51,53 +53,26 @@ public class AppmDataHandlerImpl implements AppmDataHandler {
|
|||||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
|
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
|
||||||
ApplicationStorageManager applicationStorageManager = Util.getApplicationStorageManager();
|
ApplicationStorageManager applicationStorageManager = Util.getApplicationStorageManager();
|
||||||
ApplicationReleaseDAO applicationReleaseDAO = ApplicationManagementDAOFactory.getApplicationReleaseDAO();
|
ApplicationReleaseDAO applicationReleaseDAO = ApplicationManagementDAOFactory.getApplicationReleaseDAO();
|
||||||
String artifactPath = null;
|
String artifactPath;
|
||||||
|
|
||||||
if (StringUtils.isEmpty(uuid) || StringUtils.isEmpty(artifactName)) {
|
String appReleaseHashValue = null;
|
||||||
// todo throw
|
|
||||||
}
|
|
||||||
ApplicationReleaseArtifactPaths applicationReleaseArtifactPaths = null;
|
|
||||||
try {
|
try {
|
||||||
applicationReleaseArtifactPaths = applicationReleaseDAO
|
appReleaseHashValue = applicationReleaseDAO.getReleaseHashValue(uuid, tenantId);
|
||||||
.getReleaseArtifactPaths(uuid, tenantId);
|
artifactPath = appReleaseHashValue + Constants.FORWARD_SLASH + artifactName;
|
||||||
|
return applicationStorageManager.getFileSttream(artifactPath);
|
||||||
|
|
||||||
|
|
||||||
} catch (ApplicationManagementDAOException e) {
|
} catch (ApplicationManagementDAOException e) {
|
||||||
// todo throw
|
// todo throw
|
||||||
// throw new ApplicationManagementException();
|
// throw new ApplicationManagementException();
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
|
}catch (ApplicationStorageManagementException e) {
|
||||||
|
// todo throw
|
||||||
|
// throw new ApplicationManagementException();
|
||||||
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
String installerFileName = applicationReleaseArtifactPaths.getInstallerPath();
|
|
||||||
String iconFileName = applicationReleaseArtifactPaths.getIconPath();
|
|
||||||
String bannerFileName = applicationReleaseArtifactPaths.getBannerPath();
|
|
||||||
|
|
||||||
if (StringUtils.isEmpty(installerFileName) && artifactName.equals(installerFileName)) {
|
|
||||||
artifactPath = applicationReleaseArtifactPaths.getInstallerPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StringUtils.isEmpty(iconFileName) && artifactName.equals(iconFileName)) {
|
|
||||||
artifactPath = applicationReleaseArtifactPaths.getIconPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StringUtils.isEmpty(bannerFileName) && artifactName.equals(bannerFileName)) {
|
|
||||||
artifactPath = applicationReleaseArtifactPaths.getBannerPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (String screenshotPath : applicationReleaseArtifactPaths.getScreenshotPaths()) {
|
|
||||||
if (screenshotPath != null && screenshotPath.contains(artifactName)) {
|
|
||||||
artifactPath = screenshotPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (artifactPath != null) {
|
|
||||||
try {
|
|
||||||
return applicationStorageManager.getFileSttream(artifactPath);
|
|
||||||
} catch (ApplicationStorageManagementException e) {
|
|
||||||
// todo throw
|
|
||||||
// throw new ApplicationManagementException();
|
|
||||||
// e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -126,6 +126,8 @@ public class StorageManagementUtil {
|
|||||||
* @throws IOException throws if error occured when reading file or if couldn't find a file in the filePath
|
* @throws IOException throws if error occured when reading file or if couldn't find a file in the filePath
|
||||||
*/
|
*/
|
||||||
public static InputStream getInputStream (String filePath) throws IOException {
|
public static InputStream getInputStream (String filePath) throws IOException {
|
||||||
|
File sourceFile = new File(filePath);
|
||||||
|
|
||||||
try (InputStream inputStream = new FileInputStream(filePath)){
|
try (InputStream inputStream = new FileInputStream(filePath)){
|
||||||
return inputStream;
|
return inputStream;
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
|
|||||||
@ -45,10 +45,10 @@ import javax.servlet.http.HttpSession;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import static java.net.HttpURLConnection.HTTP_BAD_REQUEST;
|
import static java.net.HttpURLConnection.HTTP_BAD_REQUEST;
|
||||||
import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED;
|
|
||||||
import static org.wso2.carbon.device.application.mgt.handler.util.HandlerUtil.execute;
|
import static org.wso2.carbon.device.application.mgt.handler.util.HandlerUtil.execute;
|
||||||
|
|
||||||
@MultipartConfig @WebServlet("/invoke")
|
@MultipartConfig
|
||||||
|
@WebServlet("/invoke")
|
||||||
public class InvokerHandler extends HttpServlet {
|
public class InvokerHandler extends HttpServlet {
|
||||||
private static final Log log = LogFactory.getLog(LoginHandler.class);
|
private static final Log log = LogFactory.getLog(LoginHandler.class);
|
||||||
private static final long serialVersionUID = -6508020875358160165L;
|
private static final long serialVersionUID = -6508020875358160165L;
|
||||||
@ -58,7 +58,8 @@ public class InvokerHandler extends HttpServlet {
|
|||||||
private static String serverUrl;
|
private static String serverUrl;
|
||||||
private static String platform;
|
private static String platform;
|
||||||
|
|
||||||
@Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) {
|
@Override
|
||||||
|
protected void doPost(HttpServletRequest req, HttpServletResponse resp) {
|
||||||
try {
|
try {
|
||||||
if (!validateRequest(req, resp)) {
|
if (!validateRequest(req, resp)) {
|
||||||
return;
|
return;
|
||||||
@ -69,8 +70,8 @@ public class InvokerHandler extends HttpServlet {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
executor.setHeader(HandlerConstants.AUTHORIZATION_HEADER_KEY, "Bearer " + authData.getAccessToken());
|
executor.setHeader(HandlerConstants.AUTHORIZATION_HEADER_KEY, "Bearer " + authData.getAccessToken());
|
||||||
|
|
||||||
ProxyResponse proxyResponse = execute(executor);
|
ProxyResponse proxyResponse = execute(executor);
|
||||||
|
|
||||||
if (HandlerConstants.TOKEN_IS_EXPIRED.equals(proxyResponse.getExecutorResponse())) {
|
if (HandlerConstants.TOKEN_IS_EXPIRED.equals(proxyResponse.getExecutorResponse())) {
|
||||||
if (!refreshToken(req, resp)) {
|
if (!refreshToken(req, resp)) {
|
||||||
return;
|
return;
|
||||||
@ -83,15 +84,12 @@ public class InvokerHandler extends HttpServlet {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (proxyResponse.getExecutorResponse().contains(HandlerConstants.EXECUTOR_EXCEPTION_PREFIX)) {
|
if (proxyResponse.getExecutorResponse().contains(HandlerConstants.EXECUTOR_EXCEPTION_PREFIX)) {
|
||||||
log.error("Error occurred while invoking the API endpoint.");
|
log.error("Error occurred while invoking the API endpoint.");
|
||||||
HandlerUtil.handleError(req, resp, serverUrl, platform, proxyResponse);
|
HandlerUtil.handleError(req, resp, serverUrl, platform, proxyResponse);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
HandlerUtil.handleSuccess(req, resp, serverUrl, platform, proxyResponse);
|
HandlerUtil.handleSuccess(req, resp, serverUrl, platform, proxyResponse);
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Error occured when processing invoke call.", e);
|
log.error("Error occured when processing invoke call.", e);
|
||||||
}
|
}
|
||||||
@ -136,23 +134,38 @@ public class InvokerHandler extends HttpServlet {
|
|||||||
* @throws IOException If and error occurs while witting error response to client side
|
* @throws IOException If and error occurs while witting error response to client side
|
||||||
*/
|
*/
|
||||||
private static boolean validateRequest(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
private static boolean validateRequest(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||||
|
serverUrl = req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort();
|
||||||
|
apiEndpoint = req.getParameter("api-endpoint");
|
||||||
|
method = req.getParameter("method");
|
||||||
HttpSession session = req.getSession(false);
|
HttpSession session = req.getSession(false);
|
||||||
if (session == null) {
|
if (session == null) {
|
||||||
resp.sendError(HTTP_UNAUTHORIZED, "Unauthorized, You are not logged in. Please log in to the portal");
|
log.error("Unauthorized, You are not logged in. Please log in to the portal");
|
||||||
|
ProxyResponse proxyResponse = new ProxyResponse();
|
||||||
|
proxyResponse.setCode(HttpStatus.SC_UNAUTHORIZED);
|
||||||
|
proxyResponse.setExecutorResponse(
|
||||||
|
HandlerConstants.EXECUTOR_EXCEPTION_PREFIX + HandlerUtil.getStatusKey(HttpStatus.SC_UNAUTHORIZED));
|
||||||
|
HandlerUtil.handleError(req, resp, serverUrl, platform, proxyResponse);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
authData = (AuthData) session.getAttribute(HandlerConstants.SESSION_AUTH_DATA_KEY);
|
authData = (AuthData) session.getAttribute(HandlerConstants.SESSION_AUTH_DATA_KEY);
|
||||||
platform = (String) session.getAttribute(HandlerConstants.PLATFORM);
|
platform = (String) session.getAttribute(HandlerConstants.PLATFORM);
|
||||||
if (authData == null) {
|
if (authData == null) {
|
||||||
resp.sendError(HTTP_UNAUTHORIZED, "Unauthorized, Access token couldn't found in the current session");
|
log.error("Unauthorized, Access token couldn't found in the current session");
|
||||||
|
ProxyResponse proxyResponse = new ProxyResponse();
|
||||||
|
proxyResponse.setCode(HttpStatus.SC_UNAUTHORIZED);
|
||||||
|
proxyResponse.setExecutorResponse(
|
||||||
|
HandlerConstants.EXECUTOR_EXCEPTION_PREFIX + HandlerUtil.getStatusKey(HttpStatus.SC_UNAUTHORIZED));
|
||||||
|
HandlerUtil.handleError(req, resp, serverUrl, platform, proxyResponse);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
apiEndpoint = req.getParameter("api-endpoint");
|
|
||||||
method = req.getParameter("method");
|
|
||||||
serverUrl = req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort();
|
|
||||||
if (apiEndpoint == null || method == null) {
|
if (apiEndpoint == null || method == null) {
|
||||||
resp.sendError(HTTP_BAD_REQUEST, "Bad Request, Either api-endpoint or method is empty");
|
log.error("Bad Request, Either api-endpoint or method is empty");
|
||||||
|
ProxyResponse proxyResponse = new ProxyResponse();
|
||||||
|
proxyResponse.setCode(HttpStatus.SC_BAD_REQUEST);
|
||||||
|
proxyResponse.setExecutorResponse(
|
||||||
|
HandlerConstants.EXECUTOR_EXCEPTION_PREFIX + HandlerUtil.getStatusKey(HttpStatus.SC_BAD_REQUEST));
|
||||||
|
HandlerUtil.handleError(req, resp, serverUrl, platform, proxyResponse);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -50,7 +50,8 @@ import java.util.Base64;
|
|||||||
|
|
||||||
import static org.wso2.carbon.device.application.mgt.handler.util.HandlerUtil.execute;
|
import static org.wso2.carbon.device.application.mgt.handler.util.HandlerUtil.execute;
|
||||||
|
|
||||||
@MultipartConfig @WebServlet("/login")
|
@MultipartConfig
|
||||||
|
@WebServlet("/login")
|
||||||
public class LoginHandler extends HttpServlet {
|
public class LoginHandler extends HttpServlet {
|
||||||
private static final Log log = LogFactory.getLog(LoginHandler.class);
|
private static final Log log = LogFactory.getLog(LoginHandler.class);
|
||||||
private static final long serialVersionUID = 9050048549140517002L;
|
private static final long serialVersionUID = 9050048549140517002L;
|
||||||
@ -61,7 +62,8 @@ public class LoginHandler extends HttpServlet {
|
|||||||
private static String serverUrl;
|
private static String serverUrl;
|
||||||
private static String uiConfigUrl;
|
private static String uiConfigUrl;
|
||||||
|
|
||||||
@Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) {
|
@Override
|
||||||
|
protected void doPost(HttpServletRequest req, HttpServletResponse resp) {
|
||||||
try {
|
try {
|
||||||
validateLoginRequest(req, resp);
|
validateLoginRequest(req, resp);
|
||||||
DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance()
|
DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance()
|
||||||
@ -286,7 +288,6 @@ public class LoginHandler extends HttpServlet {
|
|||||||
"grant_type=password&username=" + username + "&password=" + password + "&scope=" + scopeString,
|
"grant_type=password&username=" + username + "&password=" + password + "&scope=" + scopeString,
|
||||||
ContentType.APPLICATION_FORM_URLENCODED);
|
ContentType.APPLICATION_FORM_URLENCODED);
|
||||||
tokenEndpoint.setEntity(tokenEPPayload);
|
tokenEndpoint.setEntity(tokenEPPayload);
|
||||||
|
|
||||||
return execute(tokenEndpoint);
|
return execute(tokenEndpoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -161,6 +161,9 @@ public class HandlerUtil {
|
|||||||
proxyResponse.setExecutorResponse(HandlerConstants.EXECUTOR_EXCEPTION_PREFIX + HandlerUtil
|
proxyResponse.setExecutorResponse(HandlerConstants.EXECUTOR_EXCEPTION_PREFIX + HandlerUtil
|
||||||
.getStatusKey(HandlerConstants.INTERNAL_ERROR_CODE));
|
.getStatusKey(HandlerConstants.INTERNAL_ERROR_CODE));
|
||||||
}
|
}
|
||||||
|
if (platform == null){
|
||||||
|
platform = "default";
|
||||||
|
}
|
||||||
|
|
||||||
resp.setStatus(proxyResponse.getCode());
|
resp.setStatus(proxyResponse.getCode());
|
||||||
resp.setContentType("application/json");
|
resp.setContentType("application/json");
|
||||||
|
|||||||
@ -154,7 +154,7 @@
|
|||||||
<Issuer>app-mgt</Issuer>
|
<Issuer>app-mgt</Issuer>
|
||||||
</SSOConfiguration>
|
</SSOConfiguration>
|
||||||
<LoginResponse>
|
<LoginResponse>
|
||||||
<SuccessCallback>/application-mgt</SuccessCallback>
|
<SuccessCallback>/apps</SuccessCallback>
|
||||||
<FailureCallback>
|
<FailureCallback>
|
||||||
<BadRequest>/pages/error/client-errors/400</BadRequest>
|
<BadRequest>/pages/error/client-errors/400</BadRequest>
|
||||||
<Unauthorized>/pages/error/client-errors/401</Unauthorized>
|
<Unauthorized>/pages/error/client-errors/401</Unauthorized>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user