|
|
@ -18,18 +18,12 @@
|
|
|
|
package io.entgra.device.mgt.core.device.mgt.core.otp.mgt.service;
|
|
|
|
package io.entgra.device.mgt.core.device.mgt.core.otp.mgt.service;
|
|
|
|
|
|
|
|
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.common.invitation.mgt.*;
|
|
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
|
|
|
|
import org.wso2.carbon.context.CarbonContext;
|
|
|
|
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationManagementException;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationManagementException;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.common.exceptions.BadRequestException;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.common.exceptions.*;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.common.exceptions.DBConnectionException;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.common.invitation.mgt.DeviceEnrollmentInvitation;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.common.invitation.mgt.DeviceEnrollmentType;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.common.exceptions.OTPManagementException;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.common.invitation.mgt.EnrollmentTypeMail;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.common.invitation.mgt.UserMailAttributes;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.common.otp.mgt.OTPEmailTypes;
|
|
|
|
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.common.otp.mgt.dto.OneTimePinDTO;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.common.otp.mgt.dto.OneTimePinDTO;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.common.spi.OTPManagementService;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.common.spi.OTPManagementService;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants;
|
|
|
@ -38,9 +32,11 @@ import io.entgra.device.mgt.core.device.mgt.core.otp.mgt.dao.OTPManagementDAO;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.core.otp.mgt.dao.OTPManagementDAOFactory;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.core.otp.mgt.dao.OTPManagementDAOFactory;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.core.otp.mgt.exception.OTPManagementDAOException;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.core.otp.mgt.exception.OTPManagementDAOException;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.core.otp.mgt.util.ConnectionManagerUtil;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.core.otp.mgt.util.ConnectionManagerUtil;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService;
|
|
|
|
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.core.service.EmailMetaInfo;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.core.service.EmailMetaInfo;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil;
|
|
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
import org.wso2.carbon.user.api.Tenant;
|
|
|
|
import org.wso2.carbon.user.api.Tenant;
|
|
|
|
import org.wso2.carbon.user.api.UserStoreException;
|
|
|
|
import org.wso2.carbon.user.api.UserStoreException;
|
|
|
|
|
|
|
|
|
|
|
@ -391,6 +387,11 @@ public class OTPManagementServiceImpl implements OTPManagementService {
|
|
|
|
return userMailAttributes;
|
|
|
|
return userMailAttributes;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Populate enrollment type mails with provided user attributes
|
|
|
|
|
|
|
|
* @param userMailAttributes User attributes
|
|
|
|
|
|
|
|
* @param enrollmentTypeMails Enrollment type mails
|
|
|
|
|
|
|
|
*/
|
|
|
|
private void populateUserAttributes(UserMailAttributes userMailAttributes, List<EnrollmentTypeMail> enrollmentTypeMails) {
|
|
|
|
private void populateUserAttributes(UserMailAttributes userMailAttributes, List<EnrollmentTypeMail> enrollmentTypeMails) {
|
|
|
|
for (EnrollmentTypeMail enrollmentTypeMail : enrollmentTypeMails) {
|
|
|
|
for (EnrollmentTypeMail enrollmentTypeMail : enrollmentTypeMails) {
|
|
|
|
Properties properties = new Properties();
|
|
|
|
Properties properties = new Properties();
|
|
|
@ -420,6 +421,11 @@ public class OTPManagementServiceImpl implements OTPManagementService {
|
|
|
|
return enrollmentTypeMail;
|
|
|
|
return enrollmentTypeMail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Generate enrollment type mails from device enrollment types
|
|
|
|
|
|
|
|
* @param deviceEnrollmentTypes List of device enrollment types
|
|
|
|
|
|
|
|
* @return List of enrollment type mails
|
|
|
|
|
|
|
|
*/
|
|
|
|
private List<EnrollmentTypeMail> getEnrollmentTypeMails(List<DeviceEnrollmentType> deviceEnrollmentTypes) {
|
|
|
|
private List<EnrollmentTypeMail> getEnrollmentTypeMails(List<DeviceEnrollmentType> deviceEnrollmentTypes) {
|
|
|
|
List<EnrollmentTypeMail> enrollmentTypeMails = new ArrayList<>();
|
|
|
|
List<EnrollmentTypeMail> enrollmentTypeMails = new ArrayList<>();
|
|
|
|
for (DeviceEnrollmentType deviceEnrollmentType : deviceEnrollmentTypes) {
|
|
|
|
for (DeviceEnrollmentType deviceEnrollmentType : deviceEnrollmentTypes) {
|
|
|
|