All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gitee.easyopen.CacheAppSecretManager Maven / Gradle / Ivy

Go to download

easyopen mini版,保留基本签名校验,文档功能。https://gitee.com/durcframework/easyopen

There is a newer version: 1.0.4
Show newest version
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;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy