Nicolas Crittin
unread,Oct 8, 2025, 4:23:15 AMOct 8Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Pac4j development mailing list
Hi,
I'm working with pac4j 6.2.2. and I encountered some issues with pac4j-saml client when using artifact bindings response. The SAML Artifact decoding fails due to some missing initializations. The stacktrace say this:
org.pac4j.saml.exceptions.SAMLException: Error decoding Artifact SAML message
at org.pac4j.saml.credentials.extractor.SAML2CredentialsExtractor.getDecoder(SAML2CredentialsExtractor.java:123)
at org.pac4j.saml.credentials.extractor.SAML2CredentialsExtractor.extract(SAML2CredentialsExtractor.java:84)
at org.pac4j.core.client.BaseClient.getCredentials(BaseClient.java:80)
at org.pac4j.core.engine.DefaultCallbackLogic.perform(DefaultCallbackLogic.java:81)
at org.pac4j.jee.filter.CallbackFilter.internalFilter(CallbackFilter.java:63)
at org.pac4j.jee.config.AbstractConfigFilter.doFilter(AbstractConfigFilter.java:92)
...
Caused by: org.opensaml.messaging.decoder.MessageDecodingException: org.opensaml.messaging.decoder.MessageDecodingException: Fatal error decoding or resolving inbound artifact
at org.pac4j.saml.sso.artifact.SAML2ArtifactBindingDecoder.doDecode(SAML2ArtifactBindingDecoder.java:100)
at org.opensaml.messaging.decoder.AbstractMessageDecoder.decode(AbstractMessageDecoder.java:66)
at org.pac4j.saml.credentials.extractor.SAML2CredentialsExtractor.getDecoder(SAML2CredentialsExtractor.java:121)
... 23 more
Caused by: org.opensaml.messaging.decoder.MessageDecodingException: Fatal error decoding or resolving inbound artifact
at org.pac4j.saml.transport.Pac4jHTTPArtifactDecoder.processArtifact(Pac4jHTTPArtifactDecoder.java:300)
at org.pac4j.saml.transport.Pac4jHTTPArtifactDecoder.doDecode(Pac4jHTTPArtifactDecoder.java:199)
at org.opensaml.messaging.decoder.AbstractMessageDecoder.decode(AbstractMessageDecoder.java:66)
at org.pac4j.saml.transport.Pac4jHTTPArtifactDecoder.decode(Pac4jHTTPArtifactDecoder.java:169)
at org.pac4j.saml.sso.artifact.SAML2ArtifactBindingDecoder.doDecode(SAML2ArtifactBindingDecoder.java:93)
... 25 more
Caused by: net.shibboleth.shared.component.UninitializedComponentException: Unidentified Component has not yet been initialized and cannot be used.
at net.shibboleth.shared.component.AbstractInitializableComponent.ifNotInitializedThrowUninitializedComponentException(AbstractInitializableComponent.java:81)
at net.shibboleth.shared.component.AbstractInitializableComponent.checkComponentActive(AbstractInitializableComponent.java:110)
at org.opensaml.messaging.handler.AbstractMessageHandler.invoke(AbstractMessageHandler.java:82)
at org.opensaml.soap.client.http.AbstractPipelineHttpSOAPClient.send(AbstractPipelineHttpSOAPClient.java:178)
at org.pac4j.saml.sso.artifact.SAML2ArtifactBindingDecoder$1.send(SAML2ArtifactBindingDecoder.java:77)
at org.pac4j.saml.transport.Pac4jHTTPArtifactDecoder.dereferenceArtifact(Pac4jHTTPArtifactDecoder.java:333)
at org.pac4j.saml.transport.Pac4jHTTPArtifactDecoder.processArtifact(Pac4jHTTPArtifactDecoder.java:294)
... 29 more
After some debug, I could confirm that some components are not initialized in DefaultSOAPPipelineFactory (all other components are initialized). I tried initialize them and it fixes above issue. Here is how to fix it:
In org.pac4j.saml.sso.artifact.DefaultSOAPPipelineFactory, just replace the methods below with following code:
protected BasicMessageHandlerChain toHandlerChain(final List<MessageHandler> handlers) throws ComponentInitializationException {
var ret = new BasicMessageHandlerChain();
ret.setHandlers(handlers);
ret.initialize();
return ret;
}
protected MessageHandler buildCheckMandatoryAuthentication() throws ComponentInitializationException {
val mandatoryAuthentication = new CheckMandatoryAuthentication();
mandatoryAuthentication.setAuthenticationLookupStrategy(
context -> context.getSubcontext(SAMLPeerEntityContext.class).isAuthenticated());
mandatoryAuthentication.initialize();
return mandatoryAuthentication;
}
Best Regards
Nicolas