Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultUser = "root"
Variables ¶
View Source
var MethodMap = map[string]AccessType{ http.MethodGet: AccessTypeRead, http.MethodHead: AccessTypeRead, http.MethodPost: AccessTypeWrite, http.MethodPut: AccessTypeWrite, http.MethodPatch: AccessTypeWrite, http.MethodDelete: AccessTypeWrite, http.MethodConnect: AccessTypeRead, http.MethodOptions: AccessTypeRead, http.MethodTrace: AccessTypeRead, }
Functions ¶
This section is empty.
Types ¶
type AccessType ¶
type AccessType string
const ( AccessTypeRead AccessType = "read" AccessTypeWrite AccessType = "write" AccessTypeAll AccessType = "all" AccessTypeAny AccessType = matchAllSymbol )
type Scope ¶
type Scope struct { AccessType AccessType `json:"access_type"` Service string `json:"service"` Action string `json:"action"` }
type ScopeChecker ¶
type ScopeChecker struct {
// contains filtered or unexported fields
}
func NewScopeChecker ¶
func NewScopeChecker(ctx context.Context, s string) (*ScopeChecker, error)
type User ¶
type User struct { CreatedAt time.Time `bson:"created_at" json:"created_at"` Role UserRole `bson:"role" json:"role"` Name string `bson:"name" json:"name"` Scopes Scopes `bson:"scopes" json:"scopes"` PasswordHash []byte `bson:"password_hash" json:"password_hash"` ID primitive.ObjectID `bson:"_id" json:"id"` OrgID primitive.ObjectID `bson:"org_id" json:"org_id"` ChangePassword bool `bson:"change_password" json:"change_password"` }
func (*User) IsPasswordValid ¶
func (*User) SetPassword ¶
Click to show internal directories.
Click to hide internal directories.