EmailOTPBrowserMFAChecker implements BrowserMFAChecker { protected static String obfuscateEmailAddress(String emailAddress) { String alias = emailAddress.substring(0, emailAddress.indexOf('@')); int maskLength = Math.max( (int)Math.ceil(alias.length() / 2.0), Math.min(3, alias.length())); int startIndex = (int)Math.ceil((alias.length() - maskLength) / 2.0); int endIndex = startIndex + maskLength; char[] chars = emailAddress.toCharArray(); for (int i = startIndex; i < endIndex; i++) { chars[i] = '*'; } return new String(chars); }  @Override void includeBrowserVerification(
			HttpServletRequest httpServletRequest,
			HttpServletResponse httpServletResponse, long userId); @Override boolean isBrowserVerified(
		HttpServletRequest httpServletRequest, long userId); @Override boolean verifyBrowserRequest(
			HttpServletRequest httpServletRequest,
			HttpServletResponse httpServletResponse, long userId);  }
@Test public void testObfuscateEmailAddress() throws Exception { Assert.assertEquals( "*@liferay.com", EmailOTPBrowserMFAChecker.obfuscateEmailAddress("t@liferay.com")); Assert.assertEquals( "**@liferay.com", EmailOTPBrowserMFAChecker.obfuscateEmailAddress("te@liferay.com")); Assert.assertEquals( "***@liferay.com", EmailOTPBrowserMFAChecker.obfuscateEmailAddress("tes@liferay.com")); Assert.assertEquals( "t***@liferay.com", EmailOTPBrowserMFAChecker.obfuscateEmailAddress( "test@liferay.com")); Assert.assertEquals( "t***1@liferay.com", EmailOTPBrowserMFAChecker.obfuscateEmailAddress( "test1@liferay.com")); Assert.assertEquals( "te***1@liferay.com", EmailOTPBrowserMFAChecker.obfuscateEmailAddress( "test11@liferay.com")); }