zoukankan      html  css  js  c++  java
  • jboss 5.1 数据连接池 数据库密码加密码

    1.修改数据源文件jtds-ds.xml

    <datasources>
      <local-tx-datasource>
        <jndi-name>MSSQLDS</jndi-name>
        <connection-url>jdbc:jtds:sqlserver://ip地址:端口/数据库名;tds=8.0;lastupdatecount=true</connection-url>
        <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
        <security-domain>EncryptDBPassword</security-domain>
       <!--
                sql to call on an existing pooled connection when it is obtained from pool
        -->
        <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>     
      </local-tx-datasource>
    </datasources>

    2.接着我们修改server\default\conf\login-config.xml文件,加上下面这一段配置文件

     <application-policy name="EncryptDBPassword">   
         <authentication>  
           <login-module code="org.jboss.resource.security.SecureIdentityLoginModule"  flag="required">  
             <module-option name="username">userName</module-option>   
             <module-option name="password">-7c9065f142ec1c019b95c743bfc0fde2</module-option>
            <module-option name="managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=MSSQLDS</module-option>  
           </login-module>  
         </authentication>  
    </application-policy>

    3.密文生成工具 

    在jboss中找到applet.jar,jbosssx.jar,将这两个文件放到一个文件夹里,在cmd控制台,进入该目录,输入:java -cp "jbosssx.jar;applet.jar" org.jboss.resource.security.SecureIdentityLoginModule root
    这里的root是我们想要加密的密码,Encoded password: 6f8e652f571678f2 红色就是加密后的密码;

  • 相关阅读:
    迭代器
    逻辑量词
    How to distinguish between strings in heap or literals?
    Is the “*apply” family really not vectorized?
    power of the test
    The Most Simple Introduction to Hypothesis Testing
    析构函数允许重载吗?
    C++中析构函数的作用
    在C#中的构造函数和解析函数
    c++构造函数与析构函数
  • 原文地址:https://www.cnblogs.com/yuanermen/p/2967140.html
Copyright © 2011-2022 走看看