java - 将对象的 Yaml 配置列表添加到属性文件

标签 java spring-boot spring-security yaml properties-file

我正在尝试将以下 SAML2 安全性的 yaml 配置转换为等效属性文件。

spring:
  security:
    saml2:
      relyingparty:
        registration:
          xyz:
            signing:
              credentials:
              - certificate-location: "classpath:saml/xyz.pem"
                private-key-location: "classpath:saml/xyz.key"
            identityprovider:
              entity-id: xyz
              sso-url: xyz.com
              verification: 
                credentials:
                - certificate-location: "classpath:saml/xyz.pem"

它包含列表,但如何将其转换为属性并不明显。 我在网上找不到太多相关信息。

配置文件的这一部分配置以下类:

org.springframework.boot.autoconfigure.security.saml2.Saml2RelyingPartyProperties

来自 spring-boot-autoconfigure-2.2.5.RELEASE.jar。

最佳答案

试试这个。这应该有效

spring.security.saml2.relyingparty.registration.xyz.signing.credentials[0].certificate-location=classpath:saml/xyz.pem
spring.security.saml2.relyingparty.registration.xyz.signing.credentials[0].private-key-location=classpath:saml/xyz.key
spring.security.saml2.relyingparty.registration.xyz.identityprovider.entity-id=xyz
spring.security.saml2.relyingparty.registration.xyz.identityprovider.sso-url=xyz.com
spring.security.saml2.relyingparty.registration.xyz.identityprovider.verification.credentials[0].certificate-location=classpath:saml/xyz.pem

关于java - 将对象的 Yaml 配置列表添加到属性文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60857526/

相关文章:

java - 计算活跃用户

spring - 将现有域类与 Spring Security 插件一起使用

spring-security - Spring Boot with Security OAuth2 - 如何使用带有 Web 登录表单的资源服务器?

java - 仅允许某些类构造另一个类的模式的名称

本地项目源码包出现java.lang.NoSuchMethodError?

java - 在 Spring Data Rest 中启用跨源请求

spring-boot - 在springboot2.0中使用ehcache时 'sync=true'是否有效

java - 如何关闭 h2 内存数据库?

具有 2 列的 Java ArrayList

java - 如何使用 @ControllerAdvise(和 @RestControllerAdvise)类保留 Spring 的内置 REST 响应 JSON 主体?