spring-boot - 使用 Spring Security SAML 和 Spring Boot 在 MetadataGeneratorFilter 上设置实体基本 URL

标签 spring-boot spring-security spring-saml

我收到以下警告。如何设置entityBaseURL?

2018-04-19 19:38:00.771  WARN 31852 --- [http-nio-8080-exec-1] o.s.s.s.m.MetadataGeneratorFilter        : Generated default entity base URL https://test-auth.onlinephotosubmission.com:443 based on values in the first server request. Please set property entityBaseURL on MetadataGenerator bean bean to fixate the value.

最佳答案

application.properties中,添加以下设置

saml.sso.metadata-generator.entity-base-url=https://myserver.mydomain.com

在您的配置文件(我的文件名为 WebSecurityConfig)中,添加以下字段

@Value("${saml.sso.metadata-generator.entity-base-url}")
private String entityBaseUrl;

然后在同一配置文件中,通过调用 setEntityBaseURL()MetadataGenerator bean 上设置 entityBaseUrl

@Bean
public MetadataGenerator metadataGenerator() {

    MetadataGenerator metadataGenerator = new MetadataGenerator();
    metadataGenerator.setEntityId(samlSpId);
    metadataGenerator.setExtendedMetadata(extendedMetadata());
    metadataGenerator.setIncludeDiscoveryExtension(false);
    metadataGenerator.setKeyManager(keyManager());
    metadataGenerator.setEntityBaseURL(entityBaseUrl);
    return metadataGenerator;
}

关于spring-boot - 使用 Spring Security SAML 和 Spring Boot 在 MetadataGeneratorFilter 上设置实体基本 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50091430/

相关文章:

java - 在请求范围内使用工厂方法 Autowiring

java - Spring security 预认证成功处理程序

java - Spring Security SAML 与标准 java 应用程序

java - 在 SP(服务提供商)中导入 SAML SSO IDP 元数据时遇到问题

maven - 不使用 Spring Boot 作为父 pom 会有什么后果?

java - 部署应用程序时出现 ClassNotFoundException 时如何处理 hazelcast

java - Spring Boot启动失败——bean之间存在循环依赖

java - 如何配置 Spring Boot 数据源部分以在生产中使用?

java - 同一项目中的 Spring Boot Basic Authentication 和 OAuth2?

java - 查询字符串未保留在 SAML HTTP 重定向绑定(bind)中