github.com/infraboard/keyauth@v0.8.1/apps/provider/auth/wxwork/config.go (about)

     1  package wxwork
     2  
     3  import "fmt"
     4  
     5  // NewDefaultConfig 初始化默认配置
     6  func NewDefaultConfig() *Config {
     7  	return &Config{
     8  		CorpID:     "",
     9  		AgentID:    "",
    10  		CorpSecret: "",
    11  		State:      "",
    12  	}
    13  }
    14  
    15  // Config 企业微信相关认证配置
    16  type Config struct {
    17  	CorpID     string `bson:"corp_id" json:"corp_id"`
    18  	AgentID    string `bson:"agent_id" json:"agent_id"`
    19  	CorpSecret string `bson:"corp_secret" json:"corp_secret"`
    20  	State      string `bson:"state" json:"state"`
    21  }
    22  
    23  func (c *Config) Validate() error {
    24  	if c.CorpID == "" || c.CorpSecret == "" {
    25  		return fmt.Errorf("corpID and CorpSecret required")
    26  	}
    27  	return nil
    28  }