Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Cannot disable freemarker email template anymore in v23 (from v21) in production #27233

@JimVanEeden

Description

@JimVanEeden

Before reporting an issue

  • I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

Area

core

Describe the bug

I've implemented a custom email provider, which used to work absolutely fine in v21. Already then, I found out that this only works when you disable the default freemarker provider. If this is not done, I get the following error when trying to send any email:

Failed authentication: java.lang.NullPointerException: Cannot invoke "org.keycloak.email.EmailTemplateProvider.setRealm(org.keycloak.models.RealmModel)" because the return value of "org.keycloak.models.KeycloakSession.getProvider(java.lang.Class)" is null

Disabling freemarker email template is done in the build and run steps as follows:

kc.sh build --spi-email-template-freemarker-enabled=false
kc.sh start --optimized --spi-email-template-freemarker-enabled=false

Resulting in it being disabled:

image

As said, this used to work in v21. Now in v23 it still works in dev mode, but not in prod mode:

image

Is there some change in the way this is done, or is there a bug? Or alternatively, can I set up my email template provider in such a way that I don't have to disable the freemarker template?

Version

23.0.6

Regression

  • The issue is a regression

Expected behavior

Freemarker email template provider is removed

Actual behavior

Freemarker email template provider is not removed

How to Reproduce?

Add --spi-email-template-freemarker-enabled=false to build and start commands in Keycloak v23

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions