Skip to content

Invalid Certificate - PKIX Path - RestTemplate #14251

@Jatish-Khanna

Description

@Jatish-Khanna

Describe the bug
Caused by: org.springframework.web.client.ResourceAccessException: I/O error on GET request for "https://.../.well-known/openid-configuration": PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at org.springframework.web.client.RestTemplate.createResourceAccessException(RestTemplate.java:888)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:868)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:714)
at org.springframework.security.oauth2.client.registration.ClientRegistrations.lambda$oidc$0(ClientRegistrations.java:163)
at org.springframework.security.oauth2.client.registration.ClientRegistrations.getBuilder(ClientRegistrations.java:216)
... 58 common frames omitted

To Reproduce
Don't have the SSL certificate in the cacerts and use Spring boot security - oauth2 client 6.1.5

Expected behavior
Either it should depend on the RestTemplate bean or should accept the certificate.

Sample
Used SSL configuration as well

spring:
ssl:
bundle:
pem:
client:
truststore:
certificate: "classpath:config/tls/certs.crt"
server:
ssl:
bundle: "client"
http2:
enabled: true

Reports that include a sample will take priority over reports that do not.
At times, we may require a sample, so it is good to try and include a sample up front.

Metadata

Metadata

Assignees

Labels

in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions