ApiAppSecretManager.java
1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package com.xiniunet.api.manager;
import com.xiniunet.apiframework.security.AppSecretManager;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/*public class ApiAppSecretManager implements AppSecretManager {
private Map<String, String> appKeySecretMap = new ConcurrentHashMap<String, String>();
@Autowired
private MasterHelper masterHelper;
public String getSecret(String appKey) {
return appKeySecretMap.get(appKey);
}
public boolean isValidAppKey(String appKey) {
if(appKeySecretMap.containsKey(appKey)){
return true;
}
SysProductFindRequest sysProductFindRequest = new SysProductFindRequest();
sysProductFindRequest.setKey(appKey);
List<Product> productList = masterHelper.findSysProduct(sysProductFindRequest,new Passport()).getResult();
Product product = null;
if(productList.size() == 1){
product = productList.get(0);
}
if(product!=null){
appKeySecretMap.put(product.getAppKey(),product.getAppSecret());
return true;
}else{
return false;
}
}
@Override
public boolean isNormal(String arg0) {
return true;
}
}*/
public class ApiAppSecretManager implements AppSecretManager {
private static Map<String, String> appKeySecretMap = new ConcurrentHashMap<>();
static {
appKeySecretMap.put("0617CA8376F9901F28FF46B69BF9CF55","28570C9D069ED51226DD9F028BD5E6EE");
}
public String getSecret(String appKey) {
return appKeySecretMap.get(appKey);
}
public boolean isValidAppKey(String appKey) {
return true;
}
@Override
public boolean isNormal(String arg0) {
return true;
}
}