Text
Hibernate2 配置文件加密
最近公司做配置文件加密项目,遇到一个应用使用的是Hibernate2,在网上没有找到现有的Hibernate2的方案,于是自己参考jasypt的源码,写了一个Connection Provider实现了加密运作
其中Encoded.decrypt加密、解密的类在此不提供,各位自己发挥
import java.util.Properties;
import com.walmart.init.Encoded;
import net.sf.hibernate.HibernateException; import net.sf.hibernate.connection.DriverManagerConnectionProvider;
public final class EncryptedPasswordDriverManagerConnectionProvider extends DriverManagerConnectionProvider {
public void configure(Properties props) { String user = props.getProperty("hibernate.connection.username"); String password = props.getProperty("hibernate.connection.password"); if (isEncryptedValue(user)) { user = getInnerEncryptedValue(user); props.setProperty("hibernate.connection.username", Encoded.decrypt(user)); } if (isEncryptedValue(password)) { password = getInnerEncryptedValue(password); props.setProperty("hibernate.connection.password", Encoded.decrypt(password)); } try { super.configure(props); } catch (HibernateException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static boolean isEncryptedValue(String value) { if (value == null) { return false; } String trimmedValue = value.trim(); return (trimmedValue.startsWith("ENC(")) && (trimmedValue.endsWith(")")); } private static String getInnerEncryptedValue(String value) { return value.substring("ENC(".length(), value.length() - ")".length()); }
}
Hibernate.cfg.xml文件供参考
<session-factory> <property name="hibernate.connection.provider_class"> com.walmart.china.ConnectionProvider.EncryptedPasswordDriverManagerConnectionProvider </property> <!-- provider --> <!--property name="connection.datasource">java:comp/env/jdbc/mysql</property --> <!-- Test Config Intr@net--> <property name="dialect">net.sf.hibernate.dialect.SQLServerDialect</property> <property name="connection.driver_class">com.ddtek.jdbc.sqlserver.SQLServerDriver</property> <property name="connection.url">jdbc:datadirect:sqlserver://PCNNT57006SQL\NI1:1433;databaseName=pipeline</property> <!-- <property name="connection.driver_class">sun.jdbc.odbc.JdbcOdbcDriver</property> <property name="connection.url">jdbc:odbc:LocalServer;databaseName=pipeline</property> --> <property name="connection.username">user</property> <property name="connection.password">ENC(STMw69FIE6LihJ+vW/myEA==)</property> ...... </session-factory>
1 note
·
View note
Link
目录贴: 跟我学Shiro目录贴 在涉及到密码存储问题上,应该加密/生成密码摘要存储,而不是存储明文密码。比如之前的600w csdn账号泄露对用户可能造成很大损失,因此应加密/生成不可逆的摘要方式存储。 5.1 编码/解码 Shiro提供了base64和16进制字符串编码/解码的API支持,方便一些编码解码操作。Shiro内部的一些数据的存储/表示都使用了base64和 ...
0 notes
Link
Note: OpenShift now officially supports Tomcat. The following blog post covers how to install Tomcat on a DIY self-supported application server. For the official version, please refer to this blog.
1 note
·
View note
Link
Public Function RoundToLarger(dblInput As Double, intDecimals As Integer) As Double Dim strFormatString As String If dblInput 0 Then strFormatString = "#." & String(intDecimals, "#") RoundToLarger = Format(dblInput, strFormatString) Else RoundToLarger = 0 End If End Function
0 notes
Link
jQuery 的选择器可谓之强大无比,这里简单地总结一下常用的元素查找方法
0 notes
Link
环境:Tomcat6 + jdk6 Tomcat服务启动成功,但访问index.jsp出错,Tomcat报错如下: 严重: Servlet.service() for servlet jsp threw exceptionjava.lang.NullPointerException at org.apache.jsp.index_jsp._jspInit(index_jsp.java ...
tomcat与jsp-api.jar冲突,部署项目报空指针错误 项目编译时取消jsp-api.jar
0 notes
Link
报错如下: [INFO] No JSP support. Check that JSP jars are in lib/jsp and that the JSP option has been specified to start.jar 注意:jsp-2.1-glassfish是必要的,如果使用jetty-jsp-2.1貌似还是会报这个错。 ...
0 notes
Link
编辑模式与开发模式微信公众帐号申请成功后,要想接收处理用户的请求,就必须要在“高级功能”里进行配置,点击“高级功能”,将看到如下界面:从上图中可以看到,高级功能包含两种模式:编辑模式和开发模式,并且这两种模式是互斥关系,即两种模式不能同时开启。那两种模式有什么区别呢?作为开发人员到底要开启哪一种呢?编辑模式:主要针对非编程人员及信息发布类公众帐号使用。开启该模式后,可以方便地通
0 notes
Link
Apache Maven 入门学习
M2eclipse在线安装地址为:http://download.eclipse.org/technology/m2e/releases
0 notes
Link
linux 下安装SAP for Java后,发现ABAP功能实在太弱,所以想在Eclipse中开发,结果安装完成之后发现无法连接到SAP,经过漫长的查找发现这个消息,经测试完善解决,总结共享之
ABAP Development Tools (ADT) on Eclipse还没装好?好吧,狂点到这里找方法吧!
找到并打开SAPGUI的settings文件(Mac可参考原文中的路径,下面为Linux)
在末尾增加下面信息,路径修改为与settings文件相同的路径
@INCLUDE = "file:///root/.SAPGUI/connections" @MESSAGESERVER = "file:///root/.SAPGUI/messageserver.txt"
在settings文件的路径下,新建messageserver.txt文件并插入SAP的连接信息
conn=/H/192.168.70.6/S/3200&clnt=200&lang=ZH&expert=true
再次进入ABAP Development Tools (ADT) on Eclipse,新建ABAP项目,选择相应的连接...
Enjoy it : )
0 notes
Link
调用Smartforms时输出OTF数据:w_cparam-getotf = 'X'.
调用函数CONVERT_OTF将OTF数据转换成PDF二进制文件
将二进制文件使用GUI_DOWNLOAD下载到本地
另一个方法参考
0 notes
Text
SAP 池表和簇表的字段列表中不支持聚合函数和附加项 DISTINCT
select sum( DMBTR ) from BSEG into IT_EKPO-YFJE where UMSKZ eq 'A' and EBELN eq EBELN and EBELP eq IT_EKPO-EBELP.
执行以上代码,报错: 池表和簇表的字段列表中不支持聚合函数和附加项 DISTINCT。 DISTINCT are not supported in field lists for pooled and cluster tables.
解决: REF:https://scn.sap.com/message/3572180#3572180
As long as possible we should not use BSEG table for selecting data instead we can use the following tables as the BKPF and BSEG stores the data of the following 6 tables BSID, BSAD --for Account Receivables(customer related ref to Billing Doc) BSIK, BSAK -- for Account Payables (vendor related ref to PO) BSIS and BSAS ---GL related Only in the rare condition when the data is not avialble in the above tables and is there only in BSEG then first write a select to BKPF table into ITAB and for all entries of that ITAB write a select to BSEG and loop and calculate the SUM.
0 notes
Link
http://blog.csdn.net/xyang81/article/details/7675152
0 notes
Link
log4j:WARN No appenders could be found for logger
解决办法:在src下面新建file名为log4j.properties内容如下:
0 notes
Text
重磅 : SAP RFC接口调试工具 - Excel版
主要功能:
查询SAP RFC接口的参数信息
直接填入传入值,测试SAP RFC接口,并返回信息
适用于:
OA \ 考勤等与SAP接口交互时,对SAP RFC接口的调试工作,
获取:
2014-04-04 V0.11 优化及修复BUG
2014-04-03 上线
点击下载最新的 fuRfcDebug.xlsm
用户手册页
SAP连接信息配置页
SAP RFC调试页
0 notes
Text
SAP CALL WEB SERVICES - 补充篇3
在实际的工作中,提供WEB SERVICES的平台也会有测试机和正式机,那么在这个时候应该如何在ABAP中快速实现呢?
这个时候,你可能需要了解一下LP(逻辑端口)的作用了,下面贴出关键实现代码(在创建Web Services对象的时候指定逻辑端口)
data: LP type SRT_LP_NAME. case SY-MANDT. when 100."生产机 LP = 'OAPRD'. when others."其他 LP = 'OADEV'. endcase. create object WS exporting LOGICAL_PORT_NAME = LP.
而在此之前,同样需要为新的连接地址设置RFC目标(Tcode:SM59)和新建逻辑端口(Tcode:SOAManager,参见下图)
0 notes