diff --git a/services/src/main/java/org/keycloak/authentication/actiontoken/updateemail/UpdateEmailActionToken.java b/services/src/main/java/org/keycloak/authentication/actiontoken/updateemail/UpdateEmailActionToken.java index 04b22589b7..e019198248 100644 --- a/services/src/main/java/org/keycloak/authentication/actiontoken/updateemail/UpdateEmailActionToken.java +++ b/services/src/main/java/org/keycloak/authentication/actiontoken/updateemail/UpdateEmailActionToken.java @@ -30,17 +30,24 @@ public class UpdateEmailActionToken extends DefaultActionToken { private String newEmail; @JsonProperty("logoutSessions") private Boolean logoutSessions; + @JsonProperty("reduri") + private String redirectUri; public UpdateEmailActionToken(String userId, int absoluteExpirationInSecs, String oldEmail, String newEmail, String clientId) { this(userId, absoluteExpirationInSecs, oldEmail, newEmail, clientId, null); } public UpdateEmailActionToken(String userId, int absoluteExpirationInSecs, String oldEmail, String newEmail, String clientId, Boolean logoutSessions){ + this(userId, absoluteExpirationInSecs, oldEmail, newEmail, clientId, logoutSessions, null); + } + + public UpdateEmailActionToken(String userId, int absoluteExpirationInSecs, String oldEmail, String newEmail, String clientId, Boolean logoutSessions, String redirectUri){ super(userId, TOKEN_TYPE, absoluteExpirationInSecs, null); this.oldEmail = oldEmail; this.newEmail = newEmail; this.issuedFor = clientId; - this.logoutSessions = Boolean.TRUE.equals(logoutSessions)? true : null; + this.logoutSessions = Boolean.TRUE.equals(logoutSessions)? true : null; + this.redirectUri = redirectUri; } private UpdateEmailActionToken(){ @@ -70,4 +77,12 @@ public class UpdateEmailActionToken extends DefaultActionToken { public void setLogoutSessions(Boolean logoutSessions) { this.logoutSessions = Boolean.TRUE.equals(logoutSessions)? true : null; } + + public String getRedirectUri() { + return redirectUri; + } + + public void setRedirectUri(String redirectUri) { + this.redirectUri = redirectUri; + } } diff --git a/services/src/main/java/org/keycloak/authentication/actiontoken/updateemail/UpdateEmailActionTokenHandler.java b/services/src/main/java/org/keycloak/authentication/actiontoken/updateemail/UpdateEmailActionTokenHandler.java index 82436ad849..f14a51c2b5 100644 --- a/services/src/main/java/org/keycloak/authentication/actiontoken/updateemail/UpdateEmailActionTokenHandler.java +++ b/services/src/main/java/org/keycloak/authentication/actiontoken/updateemail/UpdateEmailActionTokenHandler.java @@ -32,6 +32,9 @@ import org.keycloak.forms.login.LoginFormsProvider; import org.keycloak.models.KeycloakSession; import org.keycloak.models.UserModel; import org.keycloak.models.utils.FormMessage; +import org.keycloak.protocol.oidc.OIDCLoginProtocol; +import org.keycloak.protocol.oidc.utils.RedirectUtils; +import org.keycloak.services.managers.AuthenticationManager; import org.keycloak.services.messages.Messages; import org.keycloak.services.validation.Validation; import org.keycloak.sessions.AuthenticationSessionModel; @@ -88,7 +91,12 @@ public class UpdateEmailActionTokenHandler extends AbstractActionTokenHandler