<authentication-manager> <authentication-provider> <!--<user-service>--> <!--<user name="admin" password="admin" authorities="ROLE_USER" />--> <!--</user-service>--> <jdbc-user-service data-source-ref="dataSource" users-by-username-query="select username, password, 1 enabled from t_sys_info where username = ?" authorities-by-username-query="select username, 'ROLE_USER' authority from t_sys_info where username = ?"></jdbc-user-service><password-encoder base64="true" hash="md5"></ password-encoder> </authentication-provider> </authentication-manager>
public static String encoderByMd5(String str){ //Determine the calculation method MessageDigest md5= null ; String newstr= null; try { md5 = MessageDigest.getInstance("MD5"); BASE64Encoder base64en = new BASE64Encoder(); //encrypted string newstr=base64en.encode(md5.digest(str.getBytes( "utf-8" ))); } catch (NoSuchAlgorithmException e) { e.printStackTrace (); } catch (UnsupportedEncodingException e) { e.printStackTrace (); } return newstr;
}