commons-go/noauthprobe/config/auth.go

25 lines
576 B
Go
Raw Normal View History

2018-04-12 09:38:04 +00:00
package config
2018-04-12 06:07:36 +00:00
import "time"
2018-04-12 06:09:26 +00:00
type AuthStateType int
2018-04-12 06:07:36 +00:00
const (
2018-04-12 06:09:26 +00:00
AuthStateTypeNotRegisterd AuthStateType = iota
AuthStateTypeRegisterd
2018-04-12 06:07:36 +00:00
)
type Auth struct {
2018-04-13 11:55:05 +00:00
TempKey *string `json:"tempKey,omitempty" yaml:"tempKey" toml:"tempKey"`
AcceptedDate *time.Time `json:"acceptedDate,omitempty" yaml:"acceptedDate" toml:"acceptedDate"`
DeniedDate *time.Time `json:"deniedDate,omitempty" yaml:"deniedDate" toml:"deniedDate"`
2018-04-12 06:07:36 +00:00
}
2018-04-12 06:09:26 +00:00
func (a *Auth) State() AuthStateType {
2018-04-12 06:07:36 +00:00
if nil != a.TempKey && "" != *a.TempKey {
2018-04-12 06:09:26 +00:00
return AuthStateTypeRegisterd
2018-04-12 06:07:36 +00:00
}
2018-04-12 06:09:26 +00:00
return AuthStateTypeNotRegisterd
2018-04-12 06:07:36 +00:00
}