fix(saml): correct ClassPathResource handling for IdP metadata and add null-guard for privateKey

This commit is contained in:
Ludy87 2025-08-09 12:47:12 +02:00
parent 3938a07c13
commit 029f2e9418
No known key found for this signature in database
GPG Key ID: 92696155E0220F94

View File

@ -197,7 +197,7 @@ public class ApplicationProperties {
@JsonIgnore @JsonIgnore
public InputStream getIdpMetadataUri() throws IOException { public InputStream getIdpMetadataUri() throws IOException {
if (idpMetadataUri.startsWith("classpath:")) { if (idpMetadataUri.startsWith("classpath:")) {
return new ClassPathResource(idpMetadataUri.substring("classpath".length())) return new ClassPathResource(idpMetadataUri.substring("classpath:".length()))
.getInputStream(); .getInputStream();
} }
try { try {
@ -233,6 +233,7 @@ public class ApplicationProperties {
@JsonIgnore @JsonIgnore
public Resource getPrivateKey() { public Resource getPrivateKey() {
if (privateKey == null) return null;
if (privateKey.startsWith("classpath:")) { if (privateKey.startsWith("classpath:")) {
return new ClassPathResource(privateKey.substring("classpath:".length())); return new ClassPathResource(privateKey.substring("classpath:".length()));
} else { } else {