Repository navigation
docs(provider): document SpiffeProvider.install() and provider class loading - #514
Merged
maxlambrecht merged 1 commit intoNov 14, 2026
Conversation
maxlambrecht
approved these changes
Nov 14, 2026
…loading Registering the provider with a `security.provider.<n>` entry only works when io.spiffe.provider.SpiffeProvider is visible to the system class loader: the JDK loads the providers declared in the security properties with it and silently skips any provider it cannot load. When the java-spiffe-provider jar is packaged inside an application archive, such as a Spring Boot executable jar (BOOT-INF/lib) or a WAR (WEB-INF/lib), the provider is never registered and requesting the Spiffe KeyStore fails with "KeyStoreException: Spiffe not found", as reported in spiffe#80. The provider README now: - explains this class loading requirement, the resulting error, and how to confirm it with -Djava.security.debug=jca; - documents SpiffeProvider.install(), which registers the provider at runtime from the application's own class loader, when to call it, and that the ssl.* properties are still read; - notes that the provider number must follow the last provider in the master file, since the JDK stops reading providers at the first gap; - lists programmatic installation as an alternative prerequisite for the Tomcat connector and gRPC examples. The SpiffeProvider Javadoc gets the same class loading note and a fuller install() description, and fixes its examples: the provider class is io.spiffe.provider.SpiffeProvider, not io.spiffe.SpiffeProvider, the -Dssl.spiffe.accept example repeated the property name in its value, and the ssl.spiffe.accept example ended with a stray comma. Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>
maxlambrecht
force-pushed
the
docs/provider-class-loader-registration
branch
from
November 14, 2026 20:25
2be5de0 to
69bec8b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Documents how to register
SpiffeProviderwhen thesecurity.provider.<n>entry can't load it, and documentsSpiffeProvider.install(), which the README didn't mention.Provider README:
java-spiffe-providerjar inside an application archive (a Spring Boot executable jar'sBOOT-INF/lib, a WAR'sWEB-INF/lib) is therefore never registered, and requesting aSpiffealgorithm fails withKeyStoreException: Spiffe not found. The note shows how to confirm this with-Djava.security.debug=jca.SpiffeProvider.install(), when to call it, that it is a no-op if aSpiffeprovider is already registered, and that thessl.*properties are still read.<n>bullet now says the number must follow the last provider in the master file. The JDK stops reading the provider list at the first missing number.SpiffeProviderJavadoc:install()description.io.spiffe.provider.SpiffeProvider, notio.spiffe.SpiffeProvider. The-Dssl.spiffe.acceptexample repeated the property name in its value, and thessl.spiffe.acceptexample ended with a stray comma.The changelog gets a
Documentationentry under Unreleased. No code changes.Fixes #80
Why
In #80, the provider was configured through
java.securityand worked from the IDE. It failed withSpiffe KeyStore not availablewhen the application ran as a Spring Boot executable jar. From the IDE, the jar is on the classpath. In the executable jar, it is nested and loaded by Spring Boot's own class loader, which the JDK doesn't use for providers. The thread found that callingSpiffeProvider.install()was needed, but the README only describes thejava.securityroute, so other users hit the same silent failure.How tested
I reproduced the behavior with the provider's
-alljar and a small launcher that loads the application and the jar through a childURLClassLoader, as an executable-jar launcher does. I ran it on OpenJDK 17.0.21 and 1.8.0_492, withsecurity.provider.<next>=io.spiffe.provider.SpiffeProviderandssl.KeyManagerFactory.algorithm=Spiffein a-Djava.security.propertiesfile:KeyStore.getInstance("Spiffe")throwsKeyStoreException: Spiffe not found. With-Djava.security.debug=jca, the JDK logsError loading provider io.spiffe.provider.SpiffeProvider(Java 8) orError loading legacy provider io.spiffe.provider.SpiffeProvider(Java 17).SpiffeProvider.install(): theSpiffeKeyStore resolves, andKeyManagerFactory.getDefaultAlgorithm()still returnsSpiffefrom the properties file../gradlew :java-spiffe-provider:javadoc :java-spiffe-provider:testpasses on JDK 17, and the rendered Javadoc shows the corrected examples.