简体   繁体   English

Play中的SSL连接! 骨架

[英]SSL connection in Play! Framework

From the Play! 来自Play! API it follows that a database connection can be made with the following configs in application.conf: API遵循以下内容:可以使用application.conf中的以下配置建立数据库连接:

db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgresql://someDomain.com/someDatabase"
db.default.user=user
db.default.password=password

But when I'm throwing in &ssl=true in the url, it doesn't get registered and I receive the following error: 但是当我在url中输入&ssl=true时,它没有被注册,我收到以下错误:

Caused by: org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "xx.xx.xx.xx", user "user", database "test&ssl=true&sslfactory=org.postgresql.ssl.NonValida", SSL off 引起:org.postgresql.util.PSQLException:致命:主机“xx.xx.xx.xx”没有pg_hba.conf条目,用户“user”,数据库“test&ssl = true&sslfactory = org.postgresql.ssl.NonValida”, SSL关闭

Are there any ways you can force Play! 你有什么方法可以强制玩! to use SSL connections through the .conf file? 通过.conf文件使用SSL连接?

Update: I forgot to mention that I made a successful login attempt from a console using the psql command. 更新:我忘了提到我使用psql命令从控制台成功登录尝试。 Somehow it must be Play that doesn't understand the ssl parameter. 不知何故,它必须是不理解ssl参数的Play。

Thanks, 谢谢,

Postgresql reporting database "test&ssl=true&sslfactory=org.postgresql.ssl.NonValida" as the database name you're trying to connect to indicates that the JDBC driver isn't taking that suffix off the end and handling it, as you need it to do. Postgresql报告database "test&ssl=true&sslfactory=org.postgresql.ssl.NonValida"作为您尝试连接的数据库名称表示JDBC驱动程序没有将该后缀放在最后并处理它,因为您需要它做。

You probably need to use ? 你可能需要使用? before the first parameter, like a normal URL: 在第一个参数之前,就像普通的URL一样:

jdbc://db.example.com/test?ssl=true

The problem appears to be configuration on the Postgres end? 问题似乎是Postgres端的配置?

From the docs I suspect the default pg_hba.conf file being created by the db doesn't contain an entry for SSL and you need to add this manually. 从文档中我怀疑db创建的默认pg_hba.conf文件不包含SSL条目,您需要手动添加它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM