将数据库的用户名和密码保存在xml文件中并将其导入spring security的安全文件中是一个好主意吗?还有更好的选择吗?如果我需要加密密码怎么做以及如何在phpMyAdmin上找到加密版本的密码?MySQL的
登录-service.xml中
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost/muDB" />
<property name="username" value="jack" />
<property name="password" value="alex123432" />
</bean>
</beans>
Run Code Online (Sandbox Code Playgroud)
MyProject的-security.xml文件
....
<beans:import resource='login-service.xml'/>
....
Run Code Online (Sandbox Code Playgroud)
请注意:由于所有用户相关的密码都已加密,我只想隐藏DATABASE本身的密码而不是表格列.我的应用程序将使用此密码连接到数据库.
我已经建立了一个MySQL(社区服务器,5.1)数据库服务器.
我已经设置了SSL,创建了证书等.
我创建了一个具有REQUIRES X509属性的用户.
我可以使用命令行客户端"mysql"使用此用户进行连接,"status"命令显示SSL处于活动状态等.
我完全按照MySQL站点的说明将证书导入Java truststore/keystore文件.
我只是无法使用这些连接到数据库.
如果我使用具有REQUIRES SSL的用户只使用truststore文件,那么一切都很好.使用带有REQUIRES X509的用户的密钥库文件就没有了.
在网络上似乎有很多证据表明人们正在努力解决这个问题并没有多少答案.有没有人真的有这个工作?