List of usage examples for org.apache.shiro.crypto.hash Md5Hash Md5Hash
public Md5Hash(Object source, Object salt)
From source file:cn.com.axiom.system.security.ShiroDbRealm.java
License:Apache License
/** * ?,.// w w w . j a v a 2s.c o m */ @Override protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken) throws AuthenticationException { UsernamePasswordToken token = (UsernamePasswordToken) authcToken; User user = userService.findUserByUserName(token.getUsername()); if (user != null) { if (user.getStatus() != 1) { throw new DisabledAccountException(); } // sysLogService.log("","",user.getUserName(), SysLog.INFO, // token.getHost(),SysLog.USER); SimpleByteSource salt = (SimpleByteSource) ByteSource.Util.bytes(user.getUserName()); String passwordMd5 = new Md5Hash(user.getPassword().getBytes(), salt).toString(); return new SimpleAuthenticationInfo(new ShiroUser(user.getId(), user.getUserName(), user.getRealName()), passwordMd5, ByteSource.Util.bytes(user.getUserName()), getName()); } else { return null; } }
From source file:com.feihome.support.auth.shiro.MD5Util.java
License:Open Source License
public static String md5(String str) { return new Md5Hash(str, MD5_SALT).toString(); }
From source file:org.obiba.opal.core.runtime.security.CookieAuthenticatingRealm.java
License:Open Source License
/** * @param sessionId//from www .j a v a 2 s.c o m * @param url * @return */ private String getUrlHash(String sessionId, String url) { return new Md5Hash(url, sessionId).toHex(); }
From source file:org.youi.framework.util.PasswordUtils.java
License:Apache License
public static String md5Password(String password, String salt) { return new Md5Hash(password, salt).toHex(); }