com.gitee.easyopen.CacheAppSecretManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of easyopen-mini Show documentation
Show all versions of easyopen-mini Show documentation
easyopen mini版,保留基本签名校验,文档功能。https://gitee.com/durcframework/easyopen
package com.gitee.easyopen;
import java.util.HashMap;
import java.util.Map;
/**
* appkey,secret默认管理,简单放在map中,如果要放在redis中,可以参照此方式实现AppSecretManager,然后在ApiConfig中setAppSecretManager()
* @author tanghc
*
*/
public class CacheAppSecretManager implements AppSecretManager {
private Map secretMap = new HashMap(64);
@Override
public void addAppSecret(Map appSecretStore) {
secretMap.putAll(appSecretStore);
}
@Override
public String getSecret(String appKey) {
return secretMap.get(appKey);
}
@Override
public boolean isValidAppKey(String appKey) {
if (appKey == null) {
return false;
}
return getSecret(appKey) != null;
}
}