1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- /**
- * Copyright (c) 2022 Yansen Zhang
- * wxcomponent is licensed under Mulan PSL v2.
- * You can use this software according to the terms and conditions of the Mulan PSL v2.
- * You may obtain a copy of Mulan PSL v2 at:
- * http://license.coscl.org.cn/MulanPSL2
- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
- * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
- * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
- * See the Mulan PSL v2 for more details.
- **/
-
- package config
-
- import (
- "time"
-
- "gitee.com/yansen_zh/wxcomponent/api/authorization"
- )
-
- type Config interface {
- // GetAppID 获取平台 APPID
- GetAppID() string
-
- // GetAppSecret 获取平台 APPSECRET
- GetAppSecret() string
-
- // GetAppSecret 获取平台消息校验Token
- GetMsgToken() string
-
- // GetToken 获取 Token
- GetAccessToken() string
-
- // RefreshToken 刷新 Token
- RefreshToken(token string, expire time.Time) error
-
- // GetTicket 获取票据
- GetVerifyTicket() string
-
- // RefreshTicket 刷新票据
- RefreshVerifyTicket(ticket string, expire time.Time) error
-
- // GetPushTicketState 是否开启票据推送服务
- GetPushTicketState() bool
-
- // RefreshPushTicketState 刷新票据推送服务状态
- RefreshPushTicketState(state bool)
- }
-
- var conf Config
-
- // AuthorizerConfig 公众号或小程序配置
- type AuthorizerConfig interface {
- // GetToken 获取 Token
- GetAccessToken(appID string) string
-
- // GetRefreshToken 获取 RefreshToken
- GetRefreshToken(appID string) string
-
- // RefreshToken 刷新 Token
- RefreshToken(appID, token, refreshToken string, expire time.Time) error
-
- // RefreshFuncInfo 刷新权限集列表
- RefreshFuncInfo(appID string, lst []authorization.FuncInfo)
- }
|