Interface AppSecretProvider

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface AppSecretProvider
应用密钥获取函数式接口

用于根据 appId 获取对应的签名密钥,使用者可自行实现该接口

示例实现:

// 从数据库查询
AppSecretProvider dbProvider = appId -> {
    return appSecretRepository.findByAppId(appId).getSecret();
};

// 从配置中心获取
AppSecretProvider configProvider = appId -> {
    return configService.getSecret(appId);
};

// 简单Map实现
AppSecretProvider mapProvider = appId -> appSecrets.getOrDefault(appId, defaultSecret);
Author:
Kerbores(kerbores@riemann.tech)
  • Method Summary

    Modifier and Type
    Method
    Description
    根据 appId 获取签名密钥
  • Method Details

    • getSecret

      String getSecret(String appId)
      根据 appId 获取签名密钥
      Parameters:
      appId - 应用ID
      Returns:
      签名密钥,如果未找到可返回 null