【问题标题】:Spring Boot Micro-service fails Kerberos Authentication when deployed on Pivotal Cloud Foundry PlatformSpring Boot 微服务在 Pivotal Cloud Foundry 平台上部署时无法通过 Kerberos 身份验证
【发布时间】:2017-09-26 11:31:26
【问题描述】:

我们开发了一个 Spring Boot 应用程序来从 HDP 2.5 上的 Hbase 查询数据。
当我们在本地 Windows 机器上运行该应用程序时,它可以正常工作,因为它能够找到保存在应用程序资源文件夹下的 jaas.conf 和 krb5.conf 文件,并且我们在代码中将它们作为系统属性提供为例如
System.setProperties("javax.security.auth.useSubjectCredsOnly","false"); System.setProperty("java.security.krb5.conf","D:\\host\\workspace\\projectname\\src\\main\\resources\\krb5.conf");

但是,当我们在 PCF 中部署时,它无法读取那些设置为系统属性的文件。

问题
在 PCF 中设置环境变量的方法是什么?
我们如何将文件放在 PCF 中,以便它们可用于应用程序的类路径?

【问题讨论】:

    标签: spring-boot spring-security kerberos hortonworks-data-platform cloud-foundry


    【解决方案1】:

    您可以在部署清单文件中指定环境变量。 这是details

    这是假设您的 jar 文件与 krb5.conf 文件打包在一起。

    另一个选项是使用配置服务器。这里是关于Spring Cloud Config的介绍

    【讨论】:

    • 感谢您的回复。我们能够从文档中找出我们可以在清单文件中设置环境变量。然而,在 env 部分下的清单文件中,我们添加了 JAVA_OPTS: 并在单引号中提供了多个值,并用空格分隔,就好像从 eclipse 编辑器将参数传递给 VM 一样,它起作用了。
    猜你喜欢
    • 1970-01-01
    • 2018-02-14
    • 2016-10-05
    • 1970-01-01
    • 2018-10-09
    • 2018-06-09
    • 1970-01-01
    • 2019-02-15
    • 2020-01-02
    相关资源
    最近更新 更多