Documentation ¶
Index ¶
- Constants
- Variables
- func AKSKAuth() gin.HandlerFunc
- func CheckUser(username, password string) (*login.User, error)
- func CreateToken(payload jwt.Claims, secret []byte) (string, error)
- func GenPassword(password, salt string) string
- func GeneralJwtToken(userName string) (string, error)
- func GeneralSession() string
- func HubAuthRequestOption() *grequests.RequestOptions
- func InnerAuthRequestOption() *grequests.RequestOptions
- func Metrics() gin.HandlerFunc
- func RBACAuth() gin.HandlerFunc
- func RuleIDSort(one MetaRule, other MetaRule) bool
- func SdAuthRequestOption() *grequests.RequestOptions
- func SvrAuthRequestOption() *grequests.RequestOptions
- func TokenAuth() gin.HandlerFunc
- func VerifyToken(tokenString string, secret []byte) (*jwt.MapClaims, error)
- type AcController
- type AcRule
- type AuthClaims
- type MetaRule
Constants ¶
View Source
const (
JWTExpireMinute = 720
)
Variables ¶
View Source
var APITokenSecret = []byte(infra.Secret)
Functions ¶
func AKSKAuth ¶
func AKSKAuth() gin.HandlerFunc
func GenPassword ¶
func GeneralJwtToken ¶
func GeneralSession ¶
func GeneralSession() string
func HubAuthRequestOption ¶
func HubAuthRequestOption() *grequests.RequestOptions
func InnerAuthRequestOption ¶
func InnerAuthRequestOption() *grequests.RequestOptions
func Metrics ¶
func Metrics() gin.HandlerFunc
func RBACAuth ¶
func RBACAuth() gin.HandlerFunc
func RuleIDSort ¶
func SdAuthRequestOption ¶
func SdAuthRequestOption() *grequests.RequestOptions
func SvrAuthRequestOption ¶
func SvrAuthRequestOption() *grequests.RequestOptions
func TokenAuth ¶
func TokenAuth() gin.HandlerFunc
Types ¶
type AcController ¶
type AcController struct {
// contains filtered or unexported fields
}
var ACWorker *AcController
func NewAcController ¶
func NewAcController(fileName string) (*AcController, error)
func (*AcController) IsRequestGranted ¶
func (a *AcController) IsRequestGranted(path, role string) bool
type AuthClaims ¶
type AuthClaims struct { Username string `json:"username"` jwt.StandardClaims }
type MetaRule ¶
type MetaRule struct { ID int `json:"id" yaml:"id"` Desc string `json:"desc" yaml:"desc"` PathEqual []string `json:"path_equal" yaml:"path_equal"` PathPre []string `json:"path_pre" yaml:"path_pre"` PathRegex []string `json:"path_regex" yaml:"path_regex"` AuthorizedRoles []int `json:"authorized_roles" yaml:"authorized_roles"` AllowAnyone bool `json:"allow_anyone" yaml:"allow_anyone"` }
Click to show internal directories.
Click to hide internal directories.