导出修改
This commit is contained in:
parent
1f8c7babfa
commit
0daa17af13
|
|
@ -47,7 +47,7 @@ public class PartApplyAppServiceImp {
|
|||
public ServerResponse getDevList(MachinesVo dto) {
|
||||
try{
|
||||
List<MachinesVo> list=mapper.getDevList(dto);
|
||||
ServerResponse.createSuccess(list);
|
||||
return ServerResponse.createSuccess(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
|
|||
String jwtToken = SecurityUtils.getToken(request);
|
||||
String uri=request.getRequestURI();
|
||||
System.err.println(uri);
|
||||
|
||||
if("/login/userLogin".equals(uri)){
|
||||
filterChain.doFilter(request, response);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ public class Md5Utils {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static boolean validatePassword2(String input, String storedHash) {
|
||||
try {
|
||||
|
||||
|
|
@ -42,9 +44,9 @@ public class Md5Utils {
|
|||
}
|
||||
public static void main(String[] args) throws NoSuchAlgorithmException {
|
||||
// 生成密码散列
|
||||
String password = "123456";
|
||||
String password = "1";
|
||||
String hashedPassword = generateMD5(password);
|
||||
|
||||
System.out.println("Password is valid: " + hashedPassword);
|
||||
// 验证密码
|
||||
boolean isValid = validatePassword(password, hashedPassword);
|
||||
System.out.println("Password is valid: " + isValid);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,68 @@
|
|||
package com.bonus.gzgqj.manager.security.jwt;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
public class md5 {
|
||||
|
||||
|
||||
|
||||
// public static String getMD5(String str) {
|
||||
// try {
|
||||
// // 生成一个MD5加密计算摘要
|
||||
// MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
// // 计算md5函数
|
||||
// md.update(str.getBytes());
|
||||
// // digest()最后确定返回md5 hash值,返回值为8为字符串。因为md5 hash值是16位的hex值,实际上就是8位的字符
|
||||
// // BigInteger函数则将8位的字符串转换成16位hex值,用字符串来表示;得到字符串形式的hash值
|
||||
// return new BigInteger(1, md.digest()).toString(16);
|
||||
// } catch (Exception e) {
|
||||
// System.out.println("MD5加密出现错误");
|
||||
// }
|
||||
// return str;
|
||||
// }
|
||||
|
||||
public static void main(String[] args) {
|
||||
String pwd="Abc@123++";
|
||||
//MD5加盐算法:
|
||||
System.out.println(getMD5WithSalt(pwd));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* MD5加密工具类
|
||||
*/
|
||||
|
||||
/**
|
||||
* 获取MD5字符串
|
||||
*/
|
||||
public static String getMD5(String content) {
|
||||
try {
|
||||
MessageDigest digest = MessageDigest.getInstance("MD5");
|
||||
digest.update(content.getBytes());
|
||||
return getHashString(digest);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static final String SALT = "946a175ccf87b28219f2ccbed6622dab";
|
||||
|
||||
/**
|
||||
* 获取加盐的MD5字符串
|
||||
*/
|
||||
public static String getMD5WithSalt(String content) {
|
||||
return getMD5(getMD5(content+SALT));
|
||||
}
|
||||
|
||||
private static String getHashString(MessageDigest digest) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (byte b : digest.digest()) {
|
||||
builder.append(Integer.toHexString((b >> 4) & 0xf));
|
||||
builder.append(Integer.toHexString(b & 0xf));
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue