Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclear errors #16

Open
RaveNN-0 opened this issue Feb 21, 2025 · 3 comments
Open

Unclear errors #16

RaveNN-0 opened this issue Feb 21, 2025 · 3 comments

Comments

@RaveNN-0
Copy link

RaveNN-0 commented Feb 21, 2025

Hello,

I'm trying to setup eIDAS but when trying to test im getting these errors. I followed the instructions in the readme but can't seem to figure out what is causing the error. I know it says freemarker error but theres only the country to select (which I do), I don't understand what error could occur from that. I also see that it failed on $lang, I tried disabling localization but still got the same error.

----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----

----
FTL stack trace ("~" means nesting-related):
        - Failed at: ${lang}  [in template "template.ftl" in macro "registrationLayout" at line 4, column 48]
        - Reached through: @layout.registrationLayout; section  [in template "eidas-saml-post-form.ftl" at line 2, column 1]
----
        at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134)
        at freemarker.core.EvalUtil.coerceModelToTextualCommon(EvalUtil.java:481)
        at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:401)
        at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:370)
        at freemarker.core.DollarVariable.calculateInterpolatedStringOrMarkup(DollarVariable.java:104)
        at freemarker.core.DollarVariable.accept(DollarVariable.java:63)
        at freemarker.core.Environment.visit(Environment.java:371)
        at freemarker.core.Environment.invokeMacroOrFunctionCommonPart(Environment.java:877)
        at freemarker.core.Environment.invokeMacro(Environment.java:813)
        at freemarker.core.UnifiedCall.accept(UnifiedCall.java:84)
        at freemarker.core.Environment.visit(Environment.java:335)
        at freemarker.core.Environment.visit(Environment.java:341)
        at freemarker.core.Environment.process(Environment.java:314)
        at freemarker.template.Template.process(Template.java:383)
        at org.keycloak.theme.freemarker.DefaultFreeMarkerProvider.processTemplate(DefaultFreeMarkerProvider.java:49)
        at gr.grnet.keycloak.idp.forms.EidasFreeMarkerLoginFormsProvider.processTemplate(EidasFreeMarkerLoginFormsProvider.java:339)
        at gr.grnet.keycloak.idp.forms.EidasFreeMarkerLoginFormsProvider.createEidasSamlPostForm(EidasFreeMarkerLoginFormsProvider.java:139)
        at gr.grnet.keycloak.idp.saml.EidasJaxrsSAML2BindingBuilder$PostBindingBuilder.createResponse(EidasJaxrsSAML2BindingBuilder.java:80)
        at gr.grnet.keycloak.idp.saml.EidasJaxrsSAML2BindingBuilder$PostBindingBuilder.request(EidasJaxrsSAML2BindingBuilder.java:58)
        at gr.grnet.keycloak.idp.EidasSAMLIdentityProvider.performLogin(EidasSAMLIdentityProvider.java:226)
        at org.keycloak.services.resources.IdentityBrokerService.performLogin(IdentityBrokerService.java:396)
        at org.keycloak.services.resources.IdentityBrokerService$quarkusrestinvoker$performLogin_639fa76256feb47da66621dcdd20f8de386404c5.invoke(Unknown Source)
        at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
        at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:141)
        at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:147)
        at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:635)
        at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
        at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11)
        at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:1583)

2025-02-21 10:47:38,308 ERROR [gr.grnet.keycloak.idp.forms.EidasFreeMarkerLoginFormsProvider] (executor-thread-1) Failed to process template: org.keycloak.theme.FreeMarkerException: Failed to process template eidas-saml-post-form.ftl
        at org.keycloak.theme.freemarker.DefaultFreeMarkerProvider.processTemplate(DefaultFreeMarkerProvider.java:52)
        at gr.grnet.keycloak.idp.forms.EidasFreeMarkerLoginFormsProvider.processTemplate(EidasFreeMarkerLoginFormsProvider.java:339)
        at gr.grnet.keycloak.idp.forms.EidasFreeMarkerLoginFormsProvider.createEidasSamlPostForm(EidasFreeMarkerLoginFormsProvider.java:139)
        at gr.grnet.keycloak.idp.saml.EidasJaxrsSAML2BindingBuilder$PostBindingBuilder.createResponse(EidasJaxrsSAML2BindingBuilder.java:80)
        at gr.grnet.keycloak.idp.saml.EidasJaxrsSAML2BindingBuilder$PostBindingBuilder.request(EidasJaxrsSAML2BindingBuilder.java:58)
        at gr.grnet.keycloak.idp.EidasSAMLIdentityProvider.performLogin(EidasSAMLIdentityProvider.java:226)
        at org.keycloak.services.resources.IdentityBrokerService.performLogin(IdentityBrokerService.java:396)
        at org.keycloak.services.resources.IdentityBrokerService$quarkusrestinvoker$performLogin_639fa76256feb47da66621dcdd20f8de386404c5.invoke(Unknown Source)
        at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
        at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:141)
        at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:147)
        at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:635)
        at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
        at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11)
        at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
==> lang  [in template "template.ftl" at line 4, column 50]

----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----

----
FTL stack trace ("~" means nesting-related):
        - Failed at: ${lang}  [in template "template.ftl" in macro "registrationLayout" at line 4, column 48]
        - Reached through: @layout.registrationLayout; section  [in template "eidas-saml-post-form.ftl" at line 2, column 1]
----
        at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134)
        at freemarker.core.EvalUtil.coerceModelToTextualCommon(EvalUtil.java:481)
        at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:401)
        at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:370)
        at freemarker.core.DollarVariable.calculateInterpolatedStringOrMarkup(DollarVariable.java:104)
        at freemarker.core.DollarVariable.accept(DollarVariable.java:63)
        at freemarker.core.Environment.visit(Environment.java:371)
        at freemarker.core.Environment.invokeMacroOrFunctionCommonPart(Environment.java:877)
        at freemarker.core.Environment.invokeMacro(Environment.java:813)
        at freemarker.core.UnifiedCall.accept(UnifiedCall.java:84)
        at freemarker.core.Environment.visit(Environment.java:335)
        at freemarker.core.Environment.visit(Environment.java:341)
        at freemarker.core.Environment.process(Environment.java:314)
        at freemarker.template.Template.process(Template.java:383)
        at org.keycloak.theme.freemarker.DefaultFreeMarkerProvider.processTemplate(DefaultFreeMarkerProvider.java:49)
        ... 18 more

2025-02-21 10:47:38,309 ERROR [org.keycloak.headers.DefaultSecurityHeadersProvider] (executor-thread-1) MediaType not set on path /realms/eidas/broker/eidas-saml/login, with response status 500
2025-02-21 10:47:38,310 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (executor-thread-1) Uncaught server error: jakarta.ws.rs.InternalServerErrorException: HTTP 500 Internal Server Error
        at org.keycloak.headers.DefaultSecurityHeadersProvider.addHeaders(DefaultSecurityHeadersProvider.java:75)
        at org.keycloak.services.filters.KeycloakSecurityHeadersFilter.filter(KeycloakSecurityHeadersFilter.java:45)
        at org.jboss.resteasy.reactive.server.handlers.ResourceResponseFilterHandler.handle(ResourceResponseFilterHandler.java:25)
        at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:150)
        at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:147)
        at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:635)
        at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
        at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11)
        at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:1583)
@dhm-msd
Copy link
Collaborator

dhm-msd commented Feb 21, 2025

Can you please share which keycloak and extension version you are trying ?

@RaveNN-0
Copy link
Author

RaveNN-0 commented Feb 21, 2025

Keycloak version: 26.1.1
Extension version: 0.13

I have another instance running locally: version 26.0.7 and looks like it actually advances to further stages. Must be a 26.1.* error then.

I found more errors (keycloak ver 26.0.7) ) but I will open up issues as this progresses.

@RaveNN-0
Copy link
Author

RaveNN-0 commented Feb 24, 2025

Any update on this?

EDIT:

Temporary fix is to assign <#global lang = lang!'en'> in "eidas-samp-post-form.ftl".

<#global lang = lang!'en'>
<#import "template.ftl" as layout>
<@layout.registrationLayout; section>
    <#if section = "header">
        ${msg("saml.post-form.title")}
    <#elseif section = "form">
        <script>window.onload = function() {document.forms[0].submit()};</script>
        <p>${msg("saml.post-form.message")}</p>
        <form name="saml-post-binding" method="post" action="${samlPost.url}">
            <#if samlPost.SAMLRequest??>
                <input type="hidden" name="SAMLRequest" value="${samlPost.SAMLRequest}"/>
            </#if>
            <#if samlPost.SAMLResponse??>
                <input type="hidden" name="SAMLResponse" value="${samlPost.SAMLResponse}"/>
            </#if>
            <#if samlPost.relayState??>
                <input type="hidden" name="RelayState" value="${samlPost.relayState}"/>
            </#if>
            <#if samlPost.country??>
                <input type="hidden" name="country" value="${samlPost.country}"/>
            </#if>

            <noscript>
                <p>${msg("saml.post-form.js-disabled")}</p>
                <input type="submit" value="${msg("doContinue")}"/>
            </noscript>
        </form>
    </#if>
</@layout.registrationLayout>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants