Improve OTP creating logic

revert-70ac1926
tcdlpds@gmail.com 4 years ago
parent 1d465c2909
commit 8494f0bc58

@ -49,7 +49,6 @@ import io.swagger.annotations.ResponseHeader;
import org.apache.axis2.transport.http.HTTPConstants; import org.apache.axis2.transport.http.HTTPConstants;
import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.apimgt.annotations.api.Scopes;
import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.device.mgt.common.otp.mgt.wrapper.OTPMailWrapper;
import org.wso2.carbon.device.mgt.jaxrs.beans.ActivityList; import org.wso2.carbon.device.mgt.jaxrs.beans.ActivityList;
import org.wso2.carbon.device.mgt.jaxrs.beans.BasicUserInfo; import org.wso2.carbon.device.mgt.jaxrs.beans.BasicUserInfo;
import org.wso2.carbon.device.mgt.jaxrs.beans.BasicUserInfoList; import org.wso2.carbon.device.mgt.jaxrs.beans.BasicUserInfoList;

@ -1288,6 +1288,10 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
operation.setId(operationStatusBean.getOperationId()); operation.setId(operationStatusBean.getOperationId());
DeviceMgtAPIUtils.getDeviceManagementService().updateOperation(device, operation); DeviceMgtAPIUtils.getDeviceManagementService().updateOperation(device, operation);
return Response.status(Response.Status.OK).entity("OperationStatus updated successfully.").build(); return Response.status(Response.Status.OK).entity("OperationStatus updated successfully.").build();
} catch (BadRequestException e) {
String msg = "Error occured due to invalid request";
log.error(msg, e);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String msg = "Error occurred when fetching device " + deviceIdentifier.toString(); String msg = "Error occurred when fetching device " + deviceIdentifier.toString();
log.error(msg, e); log.error(msg, e);
@ -1296,10 +1300,6 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
String msg = "Error occurred when updating operation of device " + deviceIdentifier; String msg = "Error occurred when updating operation of device " + deviceIdentifier;
log.error(msg, e); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (BadRequestException e) {
String msg = "Error occured due to invalid request";
log.error(msg, e);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
} }
} }

@ -45,11 +45,8 @@ import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException;
import org.wso2.carbon.device.mgt.common.exceptions.OTPManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.common.spi.OTPManagementService;
import org.wso2.carbon.device.mgt.common.otp.mgt.wrapper.OTPMailWrapper;
import org.wso2.carbon.device.mgt.core.DeviceManagementConstants; import org.wso2.carbon.device.mgt.core.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.device.mgt.core.service.EmailMetaInfo; import org.wso2.carbon.device.mgt.core.service.EmailMetaInfo;

@ -125,4 +125,14 @@ public final class DeviceManagementConstants {
public static final String DEFAULT_HTTP_PROTOCOL = "https"; public static final String DEFAULT_HTTP_PROTOCOL = "https";
public static final String DAS_URL = DEFAULT_HTTP_PROTOCOL + "://" + DAS_HOST_NAME + ":" + DAS_PORT; public static final String DAS_URL = DEFAULT_HTTP_PROTOCOL + "://" + DAS_HOST_NAME + ":" + DAS_PORT;
} }
public static final class OTPProperties {
private OTPProperties() { throw new AssertionError(); }
public static final String FIRST_NAME = "first-name";
public static final String LAST_NAME = "last-name";
public static final String TENANT_ADMIN_USERNAME = "tenant-admin-username";
public static final String TENANT_ADMIN_PASSWORD = "tenant-admin-password";
}
} }

@ -19,7 +19,7 @@
package org.wso2.carbon.device.mgt.common.exceptions; package org.wso2.carbon.device.mgt.common.exceptions;
public class BadRequestException extends Exception { public class BadRequestException extends DeviceManagementException {
private static final long serialVersionUID = 2304023531260840549L; private static final long serialVersionUID = 2304023531260840549L;
public BadRequestException() { public BadRequestException() {

@ -0,0 +1,45 @@
/*
* Copyright (c) 2020, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved.
*
* Entgra (pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.wso2.carbon.device.mgt.common.exceptions;
public class UnAuthorizedException extends DeviceManagementException {
private static final long serialVersionUID = 2304023531260840549L;
public UnAuthorizedException() {
super();
}
public UnAuthorizedException(String msg) {
super(msg);
}
public UnAuthorizedException(Throwable cause) {
super(cause);
}
public UnAuthorizedException(String msg, Exception nestedEx) {
super(msg, nestedEx);
}
public UnAuthorizedException(String message, Throwable cause) {
super(message, cause);
}
}

@ -31,7 +31,6 @@ public class OTPMailDTO {
Timestamp createdAt; Timestamp createdAt;
int expiryTime; int expiryTime;
boolean isExpired; boolean isExpired;
boolean isTenantCreated;
public int getTenantId() { public int getTenantId() {
return tenantId; return tenantId;
@ -111,7 +110,4 @@ public class OTPMailDTO {
isExpired = expired; isExpired = expired;
} }
public boolean isTenantCreated() { return isTenantCreated; }
public void setTenantCreated(boolean tenantCreated) { isTenantCreated = tenantCreated; }
} }

@ -16,39 +16,16 @@
*/ */
package org.wso2.carbon.device.mgt.common.otp.mgt.wrapper; package org.wso2.carbon.device.mgt.common.otp.mgt.wrapper;
public class OTPMailWrapper { import org.wso2.carbon.device.mgt.common.metadata.mgt.Metadata;
private String firstName; import java.util.List;
private String lastName;
private String adminUsername;
int tenantId;
private String adminPassword;
private String email;
private String emailType;
public int getTenantId() {
return tenantId;
}
public void setTenantId(int tenantId) {
this.tenantId = tenantId;
}
public String getAdminUsername() {
return adminUsername;
}
public void setAdminUsername(String adminUsername) {
this.adminUsername = adminUsername;
}
public String getAdminPassword() { public class OTPWrapper {
return adminPassword;
}
public void setAdminPassword(String adminPassword) { private String email;
this.adminPassword = adminPassword; private String emailType;
} private String username;
private List<Metadata> properties;
public String getEmail() { public String getEmail() {
return email; return email;
@ -66,19 +43,11 @@ public class OTPMailWrapper {
this.emailType = emailType; this.emailType = emailType;
} }
public String getFirstName() { public String getUsername() { return username; }
return firstName;
}
public void setFirstName(String firstName) { public void setUsername(String username) { this.username = username; }
this.firstName = firstName;
}
public String getLastName() { public List<Metadata> getProperties() { return properties; }
return lastName;
}
public void setLastName(String lastName) { public void setProperties(List<Metadata> properties) { this.properties = properties; }
this.lastName = lastName;
}
} }

@ -18,20 +18,20 @@
package org.wso2.carbon.device.mgt.common.spi; package org.wso2.carbon.device.mgt.common.spi;
import org.wso2.carbon.device.mgt.common.exceptions.BadRequestException; import org.wso2.carbon.device.mgt.common.exceptions.BadRequestException;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.exceptions.OTPManagementException; import org.wso2.carbon.device.mgt.common.exceptions.OTPManagementException;
import org.wso2.carbon.device.mgt.common.otp.mgt.dto.OTPMailDTO; import org.wso2.carbon.device.mgt.common.otp.mgt.dto.OTPMailDTO;
import org.wso2.carbon.device.mgt.common.otp.mgt.wrapper.OTPMailWrapper; import org.wso2.carbon.device.mgt.common.otp.mgt.wrapper.OTPWrapper;
public interface OTPManagementService { public interface OTPManagementService {
/** /**
* Create OTP token and store tenant details in the DB * Create OTP token and store tenant details in the DB
* @param otpMailWrapper OTP Mail Wrapper object which contains tenant details of registering user * @param otpWrapper OTP Mail Wrapper object which contains tenant details of registering user
* @return OTPToken
* @throws OTPManagementException if error occurs while creating OTP token and storing tenant details. * @throws OTPManagementException if error occurs while creating OTP token and storing tenant details.
* @throws BadRequestException if found and incompatible payload to create OTP token. * @throws BadRequestException if found and incompatible payload to create OTP token.
*/ */
String createOTPToken (OTPMailWrapper otpMailWrapper) throws OTPManagementException, BadRequestException; void sendUserVerifyingMail(OTPWrapper otpWrapper) throws OTPManagementException, DeviceManagementException;
/** /**
* Check the validity of the OTP * Check the validity of the OTP

@ -102,7 +102,6 @@ public class GenericOTPManagementDAOImpl extends AbstractDAOImpl implements OTPM
+ "CREATED_AT, " + "CREATED_AT, "
+ "EXPIRY_TIME, " + "EXPIRY_TIME, "
+ "IS_EXPIRED, " + "IS_EXPIRED, "
+ "TENANT_CREATED,"
+ "TENANT_ID, " + "TENANT_ID, "
+ "USERNAME FROM DM_OTP_DATA " + "USERNAME FROM DM_OTP_DATA "
+ "WHERE OTP_TOKEN = ?"; + "WHERE OTP_TOKEN = ?";
@ -123,7 +122,6 @@ public class GenericOTPManagementDAOImpl extends AbstractDAOImpl implements OTPM
otpMailDTO.setCreatedAt(rs.getTimestamp("CREATED_AT")); otpMailDTO.setCreatedAt(rs.getTimestamp("CREATED_AT"));
otpMailDTO.setExpiryTime(rs.getInt("EXPIRY_TIME")); otpMailDTO.setExpiryTime(rs.getInt("EXPIRY_TIME"));
otpMailDTO.setExpired(rs.getBoolean("IS_EXPIRED")); otpMailDTO.setExpired(rs.getBoolean("IS_EXPIRED"));
otpMailDTO.setTenantCreated(rs.getBoolean("TENANT_CREATED"));
otpMailDTO.setTenantId(rs.getInt("TENANT_ID")); otpMailDTO.setTenantId(rs.getInt("TENANT_ID"));
otpMailDTO.setUsername(rs.getString("USERNAME")); otpMailDTO.setUsername(rs.getString("USERNAME"));
return otpMailDTO; return otpMailDTO;

@ -26,19 +26,28 @@ import org.wso2.carbon.device.mgt.common.exceptions.DBConnectionException;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.exceptions.OTPManagementException; import org.wso2.carbon.device.mgt.common.exceptions.OTPManagementException;
import org.wso2.carbon.device.mgt.common.exceptions.TransactionManagementException; import org.wso2.carbon.device.mgt.common.exceptions.TransactionManagementException;
import org.wso2.carbon.device.mgt.common.exceptions.UnAuthorizedException;
import org.wso2.carbon.device.mgt.common.metadata.mgt.Metadata;
import org.wso2.carbon.device.mgt.common.otp.mgt.dto.OTPMailDTO; import org.wso2.carbon.device.mgt.common.otp.mgt.dto.OTPMailDTO;
import org.wso2.carbon.device.mgt.common.spi.OTPManagementService; import org.wso2.carbon.device.mgt.common.spi.OTPManagementService;
import org.wso2.carbon.device.mgt.core.DeviceManagementConstants; import org.wso2.carbon.device.mgt.core.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager;
import org.wso2.carbon.device.mgt.core.config.DeviceManagementConfig;
import org.wso2.carbon.device.mgt.core.config.keymanager.KeyManagerConfigurations;
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
import org.wso2.carbon.device.mgt.core.otp.mgt.dao.OTPManagementDAO; import org.wso2.carbon.device.mgt.core.otp.mgt.dao.OTPManagementDAO;
import org.wso2.carbon.device.mgt.common.otp.mgt.wrapper.OTPMailWrapper; import org.wso2.carbon.device.mgt.common.otp.mgt.wrapper.OTPWrapper;
import org.wso2.carbon.device.mgt.core.otp.mgt.dao.OTPManagementDAOFactory; import org.wso2.carbon.device.mgt.core.otp.mgt.dao.OTPManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.otp.mgt.exception.OTPManagementDAOException; import org.wso2.carbon.device.mgt.core.otp.mgt.exception.OTPManagementDAOException;
import org.wso2.carbon.device.mgt.core.otp.mgt.util.ConnectionManagerUtil; import org.wso2.carbon.device.mgt.core.otp.mgt.util.ConnectionManagerUtil;
import org.wso2.carbon.device.mgt.core.service.EmailMetaInfo; import org.wso2.carbon.device.mgt.core.service.EmailMetaInfo;
import org.wso2.carbon.user.api.Tenant;
import static org.wso2.carbon.device.mgt.common.DeviceManagementConstants.OTPProperties;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.Calendar; import java.util.Calendar;
import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.UUID; import java.util.UUID;
@ -56,23 +65,35 @@ public class OTPManagementServiceImpl implements OTPManagementService {
} }
@Override @Override
public String createOTPToken(OTPMailWrapper otpMailWrapper) throws OTPManagementException, BadRequestException { public void sendUserVerifyingMail(OTPWrapper otpWrapper) throws OTPManagementException, DeviceManagementException {
if (!isValidOTPTokenCreatingRequest(otpMailWrapper)){ Tenant tenant = validateOTPTokenCreatingRequest(otpWrapper);
if (tenant == null){
String msg = "Found invalid payload with OTP creating request"; String msg = "Found invalid payload with OTP creating request";
log.error(msg); log.error(msg);
throw new BadRequestException(msg); throw new BadRequestException(msg);
} }
DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance()
.getDeviceManagementConfig();
KeyManagerConfigurations kmConfig = deviceManagementConfig.getKeyManagerConfigurations();
String superTenantUsername = kmConfig.getAdminUsername();
if (!otpWrapper.getUsername().equals(superTenantUsername)) {
String msg = "You don't have required permission to create OTP";
log.error(msg);
throw new UnAuthorizedException(msg);
}
Gson gson = new Gson(); Gson gson = new Gson();
String metaInfo = gson.toJson(otpMailWrapper); String metaInfo = gson.toJson(tenant);
String otpValue = UUID.randomUUID().toString(); String otpValue = UUID.randomUUID().toString();
OTPMailDTO otpMailDTO = new OTPMailDTO(); OTPMailDTO otpMailDTO = new OTPMailDTO();
otpMailDTO.setEmail(otpMailWrapper.getEmail()); otpMailDTO.setEmail(otpWrapper.getEmail());
otpMailDTO.setTenantId(otpMailDTO.getTenantId()); otpMailDTO.setTenantId(-1234);
otpMailDTO.setUsername(otpMailWrapper.getAdminUsername()); otpMailDTO.setUsername(otpWrapper.getUsername());
otpMailDTO.setEmailType(otpMailWrapper.getEmailType()); otpMailDTO.setEmailType(otpWrapper.getEmailType());
otpMailDTO.setMetaInfo(metaInfo); otpMailDTO.setMetaInfo(metaInfo);
otpMailDTO.setOtpToken(otpValue); otpMailDTO.setOtpToken(otpValue);
@ -84,8 +105,8 @@ public class OTPManagementServiceImpl implements OTPManagementService {
log.error(msg); log.error(msg);
throw new OTPManagementException(msg); throw new OTPManagementException(msg);
} }
sendMail(tenant.getAdminFirstName(), otpValue, tenant.getEmail());
ConnectionManagerUtil.commitDBTransaction(); ConnectionManagerUtil.commitDBTransaction();
return otpValue;
} catch (TransactionManagementException e) { } catch (TransactionManagementException e) {
String msg = "Error occurred while disabling AutoCommit."; String msg = "Error occurred while disabling AutoCommit.";
log.error(msg, e); log.error(msg, e);
@ -117,10 +138,6 @@ public class OTPManagementServiceImpl implements OTPManagementService {
log.warn("Token is expired. OTP: " + oneTimeToken); log.warn("Token is expired. OTP: " + oneTimeToken);
return null; return null;
} }
if (otpMailDTO.isTenantCreated()) {
log.warn("Tenant is already created for the token. OTP: " + oneTimeToken);
return null;
}
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
Timestamp currentTimestamp = new Timestamp(calendar.getTime().getTime()); Timestamp currentTimestamp = new Timestamp(calendar.getTime().getTime());
@ -131,8 +148,8 @@ public class OTPManagementServiceImpl implements OTPManagementService {
String renewedOTP = UUID.randomUUID().toString(); String renewedOTP = UUID.randomUUID().toString();
renewOTP(otpMailDTO, renewedOTP); renewOTP(otpMailDTO, renewedOTP);
Gson gson = new Gson(); Gson gson = new Gson();
OTPMailWrapper otpMailWrapper = gson.fromJson(otpMailDTO.getMetaInfo(), OTPMailWrapper.class); Tenant tenant = gson.fromJson(otpMailDTO.getMetaInfo(), Tenant.class);
resendUserVerifyingMail(otpMailWrapper.getFirstName(), renewedOTP, otpMailDTO.getEmail()); sendMail(tenant.getAdminFirstName(), renewedOTP, otpMailDTO.getEmail());
return null; return null;
} }
return otpMailDTO; return otpMailDTO;
@ -163,39 +180,63 @@ public class OTPManagementServiceImpl implements OTPManagementService {
/** /**
* Validate OTP token creating payload * Validate OTP token creating payload
* @param otpMailWrapper OTPMailWrapper * @param otpWrapper OTP-Wrapper
* @return true if its valid payload otherwise returns false * @return true if its valid payload otherwise returns false
*/ */
private boolean isValidOTPTokenCreatingRequest(OTPMailWrapper otpMailWrapper) { private Tenant validateOTPTokenCreatingRequest(OTPWrapper otpWrapper) {
if (StringUtils.isBlank(otpMailWrapper.getFirstName())) {
log.error("Received empty or blank first name field with OTP creating payload."); Tenant tenant = new Tenant();
return false; List<Metadata> properties = otpWrapper.getProperties();
} for (Metadata property : properties) {
if (StringUtils.isBlank(otpMailWrapper.getLastName())) { switch (property.getMetaKey()) {
log.error("Received empty or blank last name field with OTP creating payload."); case OTPProperties.FIRST_NAME:
return false; String firstName = property.getMetaValue();
} if (StringUtils.isBlank(firstName)) {
if (StringUtils.isBlank(otpMailWrapper.getAdminUsername())) { log.error("Received empty or blank first name field with OTP creating payload.");
log.error("Received empty or blank admin username field with OTP creating payload."); return null;
return false; }
} tenant.setAdminFirstName(firstName);
if (StringUtils.isBlank(otpMailWrapper.getAdminPassword())) { break;
log.error("Received empty or blank admin password field with OTP creating payload."); case OTPProperties.LAST_NAME:
return false; String lastName = property.getMetaValue();
if (StringUtils.isBlank(lastName)) {
log.error("Received empty or blank last name field with OTP creating payload.");
return null;
}
tenant.setAdminLastName(lastName);
break;
case OTPProperties.TENANT_ADMIN_USERNAME:
String username = property.getMetaValue();
if (StringUtils.isBlank(username)) {
log.error("Received empty or blank admin username field with OTP creating payload.");
return null;
}
tenant.setAdminName(username);
break;
case OTPProperties.TENANT_ADMIN_PASSWORD:
String pwd = property.getMetaValue();
if (StringUtils.isBlank(pwd)) {
log.error("Received empty or blank admin password field with OTP creating payload.");
return null;
}
tenant.setAdminPassword(pwd);
break;
default:
log.error("Received invalid key with OTP properties for creating OTP.");
return null;
}
} }
if (StringUtils.isBlank(otpMailWrapper.getEmail())) {
if (StringUtils.isBlank(otpWrapper.getEmail())) {
log.error("Received empty or blank email field with OTP creating payload."); log.error("Received empty or blank email field with OTP creating payload.");
return false; return null;
} }
if (StringUtils.isBlank(otpMailWrapper.getEmailType())) { if (StringUtils.isBlank(otpWrapper.getEmailType())) {
log.error("Received empty or blank email type field with OTP creating payload."); log.error("Received empty or blank email type field with OTP creating payload.");
return false; return null;
}
if (otpMailWrapper.getTenantId() != -1234 && otpMailWrapper.getTenantId() < 1) {
log.error("Invalid tenant Id field with OTP creating payload.");
return false;
} }
return true; tenant.setEmail(otpWrapper.getEmail());
return tenant;
} }
/** /**
@ -205,7 +246,7 @@ public class OTPManagementServiceImpl implements OTPManagementService {
* @param mailAddress Mail Address of the User * @param mailAddress Mail Address of the User
* @throws OTPManagementException if error occurred while resend the user verifying mail * @throws OTPManagementException if error occurred while resend the user verifying mail
*/ */
private void resendUserVerifyingMail(String firstName, String renewedOTP, String mailAddress) private void sendMail(String firstName, String renewedOTP, String mailAddress)
throws OTPManagementException { throws OTPManagementException {
Properties props = new Properties(); Properties props = new Properties();
props.setProperty("first-name", firstName); props.setProperty("first-name", firstName);
@ -216,8 +257,9 @@ public class OTPManagementServiceImpl implements OTPManagementService {
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider() DeviceManagementDataHolder.getInstance().getDeviceManagementProvider()
.sendEnrolmentInvitation(DeviceManagementConstants.EmailAttributes.USER_VERIFY_TEMPLATE, metaInfo); .sendEnrolmentInvitation(DeviceManagementConstants.EmailAttributes.USER_VERIFY_TEMPLATE, metaInfo);
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
e.printStackTrace(); String msg = "Error occurred while inviting user to enrol their device";
throw new OTPManagementException(e); log.error(msg, e);
throw new OTPManagementException(msg, e);
} catch (ConfigurationManagementException e) { } catch (ConfigurationManagementException e) {
throw new OTPManagementException(e); throw new OTPManagementException(e);
} }

@ -584,7 +584,6 @@ CREATE TABLE IF NOT EXISTS DM_OTP_DATA (
CREATED_AT TIMESTAMP NOT NULL, CREATED_AT TIMESTAMP NOT NULL,
EXPIRY_TIME INT NOT NULL DEFAULT 3600, EXPIRY_TIME INT NOT NULL DEFAULT 3600,
IS_EXPIRED BOOLEAN DEFAULT false, IS_EXPIRED BOOLEAN DEFAULT false,
TENANT_CREATED BOOLEAN DEFAULT false,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT email_type_uk UNIQUE (EMAIL, EMAIL_TYPE) CONSTRAINT email_type_uk UNIQUE (EMAIL, EMAIL_TYPE)
); );

@ -626,7 +626,6 @@ CREATE TABLE DM_OTP_DATA (
CREATED_AT DATETIME2(0) NOT NULL, CREATED_AT DATETIME2(0) NOT NULL,
EXPIRY_TIME INT NOT NULL DEFAULT 3600, EXPIRY_TIME INT NOT NULL DEFAULT 3600,
IS_EXPIRED BIT DEFAULT false, IS_EXPIRED BIT DEFAULT false,
TENANT_CREATED BOOLEAN DEFAULT false,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT email_type_uk UNIQUE (EMAIL, EMAIL_TYPE) CONSTRAINT email_type_uk UNIQUE (EMAIL, EMAIL_TYPE)
); );

@ -642,7 +642,6 @@ CREATE TABLE IF NOT EXISTS DM_OTP_DATA (
CREATED_AT TIMESTAMP NOT NULL, CREATED_AT TIMESTAMP NOT NULL,
EXPIRY_TIME INT NOT NULL DEFAULT 3600, EXPIRY_TIME INT NOT NULL DEFAULT 3600,
IS_EXPIRED BOOLEAN DEFAULT false, IS_EXPIRED BOOLEAN DEFAULT false,
TENANT_CREATED BOOLEAN DEFAULT false,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT email_type_uk UNIQUE (EMAIL, EMAIL_TYPE) CONSTRAINT email_type_uk UNIQUE (EMAIL, EMAIL_TYPE)
); );

@ -990,7 +990,6 @@ CREATE TABLE DM_OTP_DATA (
CREATED_AT TIMESTAMP(0) NOT NULL, CREATED_AT TIMESTAMP(0) NOT NULL,
EXPIRY_TIME NUMBER(10) DEFAULT 3600 NOT NULL, EXPIRY_TIME NUMBER(10) DEFAULT 3600 NOT NULL,
IS_EXPIRED CHAR(1) DEFAULT false, IS_EXPIRED CHAR(1) DEFAULT false,
TENANT_CREATED BOOLEAN DEFAULT false,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT email_type_uk UNIQUE (EMAIL, EMAIL_TYPE) CONSTRAINT email_type_uk UNIQUE (EMAIL, EMAIL_TYPE)
); );

@ -631,7 +631,6 @@ CREATE TABLE IF NOT EXISTS DM_OTP_DATA (
CREATED_AT TIMESTAMP(0) NOT NULL, CREATED_AT TIMESTAMP(0) NOT NULL,
EXPIRY_TIME INT NOT NULL DEFAULT 3600, EXPIRY_TIME INT NOT NULL DEFAULT 3600,
IS_EXPIRED BOOLEAN DEFAULT false, IS_EXPIRED BOOLEAN DEFAULT false,
TENANT_CREATED BOOLEAN DEFAULT false,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT email_type_uk UNIQUE (EMAIL, EMAIL_TYPE) CONSTRAINT email_type_uk UNIQUE (EMAIL, EMAIL_TYPE)
); );

@ -29,7 +29,7 @@
</Authenticator> </Authenticator>
<Authenticator> <Authenticator>
<Name>CertificateAuth</Name> <Name>CertificateAuth</Name>
<ClassName>org.wso2.carbon.webapp.authenticator.framework.authenticator.gitCertificateAuthenticator</ClassName> <ClassName>org.wso2.carbon.webapp.authenticator.framework.authenticator.CertificateAuthenticator</ClassName>
</Authenticator> </Authenticator>
<Authenticator> <Authenticator>
<Name>OTPAuth</Name> <Name>OTPAuth</Name>

Loading…
Cancel
Save