diff --git a/components/org.wso2.carbon.identity.application.authenticator.magiclink/src/main/java/org/wso2/carbon/identity/application/authenticator/magiclink/MagicLinkAuthenticator.java b/components/org.wso2.carbon.identity.application.authenticator.magiclink/src/main/java/org/wso2/carbon/identity/application/authenticator/magiclink/MagicLinkAuthenticator.java index ef6dbcb..c02a8e4 100644 --- a/components/org.wso2.carbon.identity.application.authenticator.magiclink/src/main/java/org/wso2/carbon/identity/application/authenticator/magiclink/MagicLinkAuthenticator.java +++ b/components/org.wso2.carbon.identity.application.authenticator.magiclink/src/main/java/org/wso2/carbon/identity/application/authenticator/magiclink/MagicLinkAuthenticator.java @@ -71,11 +71,14 @@ import static org.wso2.carbon.identity.application.authenticator.magiclink.MagicLinkAuthenticatorConstants.BLOCKED_USERSTORE_DOMAINS_LIST; import static org.wso2.carbon.identity.application.authenticator.magiclink.MagicLinkAuthenticatorConstants.BLOCKED_USERSTORE_DOMAINS_SEPARATOR; import static org.wso2.carbon.identity.application.authenticator.magiclink.MagicLinkAuthenticatorConstants.DEFAULT_EXPIRY_TIME; +import static org.wso2.carbon.identity.application.authenticator.magiclink.MagicLinkAuthenticatorConstants.DISPLAY_MAGIC_LINK_TOKEN; +import static org.wso2.carbon.identity.application.authenticator.magiclink.MagicLinkAuthenticatorConstants.DISPLAY_USER_NAME; import static org.wso2.carbon.identity.application.authenticator.magiclink.MagicLinkAuthenticatorConstants.EXPIRY_TIME; import static org.wso2.carbon.identity.application.authenticator.magiclink.MagicLinkAuthenticatorConstants.LogConstants.ActionIDs.PROCESS_AUTHENTICATION_RESPONSE; import static org.wso2.carbon.identity.application.authenticator.magiclink.MagicLinkAuthenticatorConstants.LogConstants.ActionIDs.SEND_MAGIC_LINK; import static org.wso2.carbon.identity.application.authenticator.magiclink.MagicLinkAuthenticatorConstants.LogConstants.ActionIDs.VALIDATE_MAGIC_LINK_REQUEST; import static org.wso2.carbon.identity.application.authenticator.magiclink.MagicLinkAuthenticatorConstants.LogConstants.MAGIC_LINK_AUTH_SERVICE; +import static org.wso2.carbon.identity.application.authenticator.magiclink.MagicLinkAuthenticatorConstants.MAGIC_LINK_TOKEN; import static org.wso2.carbon.identity.application.authenticator.magiclink.MagicLinkAuthenticatorConstants.USERNAME_PARAM; import static org.wso2.carbon.identity.application.authenticator.magiclink.MagicLinkAuthenticatorConstants.USER_NAME; import static org.wso2.carbon.identity.application.authenticator.magiclink.MagicLinkAuthenticatorConstants.USER_PROMPT; @@ -253,10 +256,10 @@ protected void processAuthenticationResponse(HttpServletRequest request, HttpSer .inputParams(getApplicationDetails(context)); LoggerUtils.triggerDiagnosticLogEvent(diagnosticLogBuilder); } - if (StringUtils.isEmpty(request.getParameter(MagicLinkAuthenticatorConstants.MAGIC_LINK_TOKEN))) { + if (StringUtils.isEmpty(request.getParameter(MAGIC_LINK_TOKEN))) { throw new InvalidCredentialsException("MagicToken cannot be null."); } else { - String magicToken = request.getParameter(MagicLinkAuthenticatorConstants.MAGIC_LINK_TOKEN); + String magicToken = request.getParameter(MAGIC_LINK_TOKEN); MagicLinkAuthContextCacheKey magicLinkAuthContextCacheKey = new MagicLinkAuthContextCacheKey(magicToken); MagicLinkAuthContextCacheEntry magicLinkAuthContextCacheEntry = MagicLinkAuthContextCache.getInstance() .getValueFromCache(magicLinkAuthContextCacheKey); @@ -330,7 +333,7 @@ public boolean canHandle(HttpServletRequest httpServletRequest) { return canHandle; } boolean canHandle = StringUtils.isNotEmpty(httpServletRequest.getParameter( - MagicLinkAuthenticatorConstants.MAGIC_LINK_TOKEN)); + MAGIC_LINK_TOKEN)); if (LoggerUtils.isDiagnosticLogsEnabled() && diagnosticLogBuilder != null && canHandle) { diagnosticLogBuilder.resultMessage("Magic link authenticator is handling the authentication."); LoggerUtils.triggerDiagnosticLogEvent(diagnosticLogBuilder); @@ -341,7 +344,7 @@ public boolean canHandle(HttpServletRequest httpServletRequest) { @Override public String getContextIdentifier(HttpServletRequest request) { - String magicToken = request.getParameter(MagicLinkAuthenticatorConstants.MAGIC_LINK_TOKEN); + String magicToken = request.getParameter(MAGIC_LINK_TOKEN); if (StringUtils.isEmpty(magicToken)) { return null; @@ -424,8 +427,8 @@ protected void triggerEvent(User user, AuthenticationContext context, String mag private void setAuthParams(AuthenticatorData authenticatorData) { List authenticatorParamMetadataList = new ArrayList<>(); - AuthenticatorParamMetadata usernameMetadata = new AuthenticatorParamMetadata( - MagicLinkAuthenticatorConstants.MAGIC_LINK_TOKEN, FrameworkConstants.AuthenticatorParamType.STRING, + AuthenticatorParamMetadata usernameMetadata = new AuthenticatorParamMetadata(MAGIC_LINK_TOKEN, + DISPLAY_MAGIC_LINK_TOKEN, FrameworkConstants.AuthenticatorParamType.STRING, 0, Boolean.TRUE, MagicLinkAuthenticatorConstants.MAGIC_LINK_CODE); authenticatorParamMetadataList.add(usernameMetadata); authenticatorData.setAuthParams(authenticatorParamMetadataList); @@ -666,7 +669,7 @@ private void setAuthParamsForIdfInitiatedFromMagicLink(AuthenticatorData authent List authenticatorParamMetadataList = new ArrayList<>(); AuthenticatorParamMetadata usernameMetadata = new AuthenticatorParamMetadata( - USER_NAME, FrameworkConstants.AuthenticatorParamType.STRING, + USER_NAME, DISPLAY_USER_NAME, FrameworkConstants.AuthenticatorParamType.STRING, 0, Boolean.FALSE, USERNAME_PARAM); authenticatorParamMetadataList.add(usernameMetadata); authenticatorData.setAuthParams(authenticatorParamMetadataList); diff --git a/components/org.wso2.carbon.identity.application.authenticator.magiclink/src/main/java/org/wso2/carbon/identity/application/authenticator/magiclink/MagicLinkAuthenticatorConstants.java b/components/org.wso2.carbon.identity.application.authenticator.magiclink/src/main/java/org/wso2/carbon/identity/application/authenticator/magiclink/MagicLinkAuthenticatorConstants.java index 6080c83..9f044ca 100644 --- a/components/org.wso2.carbon.identity.application.authenticator.magiclink/src/main/java/org/wso2/carbon/identity/application/authenticator/magiclink/MagicLinkAuthenticatorConstants.java +++ b/components/org.wso2.carbon.identity.application.authenticator.magiclink/src/main/java/org/wso2/carbon/identity/application/authenticator/magiclink/MagicLinkAuthenticatorConstants.java @@ -33,6 +33,7 @@ private MagicLinkAuthenticatorConstants() { public static final String AUTHENTICATOR_FRIENDLY_NAME = "Magic Link"; public static final String MAGIC_LINK_NOTIFICATION_PAGE = "authenticationendpoint/magic_link_notification.do"; public static final String MAGIC_LINK_TOKEN = "mlt"; + public static final String DISPLAY_MAGIC_LINK_TOKEN = "Magic Link Token"; public static final String EXPIRY_TIME = "ExpiryTime"; public static final String BLOCKED_USERSTORE_DOMAINS_LIST = "BlockedUserStoreDomains"; public static final String BLOCKED_USERSTORE_DOMAINS_SEPARATOR = ","; @@ -41,6 +42,7 @@ private MagicLinkAuthenticatorConstants() { public static final String IDF_HANDLER_NAME = "IdentifierExecutor"; public static final String LOCAL = "LOCAL"; public static final String USER_NAME = "username"; + public static final String DISPLAY_USER_NAME = "Username"; public static final String USERNAME_PARAM = "username.param"; public static final String MAGIC_LINK_CODE = "magic.link.code.param"; public static final String USER_PROMPT = "USER_PROMPT"; diff --git a/components/org.wso2.carbon.identity.application.authenticator.magiclink/src/test/java/org/wso2/carbon/identity/application/authenticator/magiclink/MagicLinkAuthenticatorTest.java b/components/org.wso2.carbon.identity.application.authenticator.magiclink/src/test/java/org/wso2/carbon/identity/application/authenticator/magiclink/MagicLinkAuthenticatorTest.java index 8b83757..5583c5b 100644 --- a/components/org.wso2.carbon.identity.application.authenticator.magiclink/src/test/java/org/wso2/carbon/identity/application/authenticator/magiclink/MagicLinkAuthenticatorTest.java +++ b/components/org.wso2.carbon.identity.application.authenticator.magiclink/src/test/java/org/wso2/carbon/identity/application/authenticator/magiclink/MagicLinkAuthenticatorTest.java @@ -85,6 +85,7 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertThrows; import static org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.USERNAME_CLAIM; +import static org.wso2.carbon.identity.application.authenticator.magiclink.MagicLinkAuthenticatorConstants.DISPLAY_USER_NAME; import static org.wso2.carbon.identity.application.authenticator.magiclink.MagicLinkAuthenticatorConstants.USERNAME_PARAM; import static org.wso2.carbon.identity.application.authenticator.magiclink.MagicLinkAuthenticatorConstants.USER_NAME; @@ -576,8 +577,8 @@ public void testGetAuthInitiationData() { List authenticatorParamMetadataList = new ArrayList<>(); AuthenticatorParamMetadata usernameMetadata = new AuthenticatorParamMetadata( - MagicLinkAuthenticatorConstants.USER_NAME, FrameworkConstants.AuthenticatorParamType.STRING, - 0, Boolean.FALSE, MagicLinkAuthenticatorConstants.USERNAME_PARAM); + USER_NAME, DISPLAY_USER_NAME, FrameworkConstants.AuthenticatorParamType.STRING, + 0, Boolean.FALSE, USERNAME_PARAM); authenticatorParamMetadataList.add(usernameMetadata); diff --git a/pom.xml b/pom.xml index 0e7a8f9..67ea7b8 100644 --- a/pom.xml +++ b/pom.xml @@ -212,7 +212,7 @@ ${project.version} 4.9.10 - 5.25.509 + 5.25.522 1.2.10 1.3.14 6.11.172