authorizer.go 1011B

12345678910111213141516171819202122232425262728293031323334
  1. /**
  2. * Copyright (c) 2022 Yansen Zhang
  3. * wxcomponent is licensed under Mulan PSL v2.
  4. * You can use this software according to the terms and conditions of the Mulan PSL v2.
  5. * You may obtain a copy of Mulan PSL v2 at:
  6. * http://license.coscl.org.cn/MulanPSL2
  7. * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  8. * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  9. * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  10. * See the Mulan PSL v2 for more details.
  11. **/
  12. package config
  13. import (
  14. "time"
  15. )
  16. // AuthorizerConfig 公众号或小程序配置
  17. type AuthorizerConfig interface {
  18. // GetToken 获取 Token
  19. GetAccessToken(appID string) string
  20. // GetRefreshToken 获取 RefreshToken
  21. GetRefreshToken(appID string) string
  22. // RefreshToken 刷新 Token
  23. RefreshToken(appID, token, refreshToken string, expire time.Time) error
  24. // RefreshFuncInfo 刷新权限集列表
  25. RefreshFuncInfo(appID string, lst []int)
  26. }
  27. var authorizer AuthorizerConfig