[keycloak-user] How to change link to verify-email in email template?

Alex Berg chexxor at gmail.com
Mon Jun 5 14:56:54 EDT 2017


I have a proxy running which proxies "www.mydomain.com/auth/" to
"mykeycloakhost/auth/realms/MyApp/". I think it's less noisy for users of
my website.

In dev, when I have keycloak send a "verify email" action, the URI in the
email is "localhost:8080/auth/realms/MyApp/login-actions/
execute-actions?key=the-key"

How do I change this URI in the "verify email" email to be
"localhost:8080/auth/login-actions/execute-actions?key=the-key"?

I see it's calculated like:

UriInfo uriInfo = session.getContext().getUri();
UriBuilder builder = Urls.actionTokenBuilder(uriInfo.getBaseUri(),
token.serialize(session, realm, uriInfo));
String link = builder.build(realm.getName()).toString();

- Source:
/services/src/main/java/org/keycloak/authentication/requiredactions/VerifyEmail.java#L139
<https://github.com/keycloak/keycloak/blob/70d7e07526546cd20d8cbbc6d0557597ba1540fb/services/src/main/java/org/keycloak/authentication/requiredactions/VerifyEmail.java#L139>

I'm not great at understanding Java and OO, so I can't figure how where
"session.getContext()" is defined.

How are other people solving this? Should I just remove the link variable
in the email template and use a hardcoded link?


More information about the keycloak-user mailing list