Documentation ¶
Index ¶
Constants ¶
const ( ReadPerm = "r" WritePerm = "w" ExecutePerm = "x" DefaultPerm = ReadPerm FullPerm = "rwx" )
const (
PasswordHashLength = 16
)
Variables ¶
This section is empty.
Functions ¶
func GenerateAuthCommandData ¶
GenerateAuthCommandData generate auth command request data
func ParseStringUsers ¶
ParseStringUsers parse user list to user string
Types ¶
type HashUser ¶
type HashUser struct { // UserNameHash a 16 bytes hash of username UserNameHash string // PasswordHash a 16 bytes hash of password PasswordHash string // Perm the user permission Perm Perm // Expires 14 bytes auth request info expires of utc, format like "20060102150405" Expires string // Version 2 bytes of auth api version Version []byte }
HashUser store the hash info of User
func NewHashUser ¶
NewHashUser create a HashUser instance
func ParseAuthCommandData ¶
ParseAuthCommandData parse auth command request data
func ToHashUserList ¶
ToHashUserList convert User list to HashUser list
func (*HashUser) RefreshExpires ¶
RefreshExpires refresh expires with current utc time
type Perm ¶
type Perm string
func ToPermWithDefault ¶
ToPermWithDefault convert a perm string to Perm defaultPerm if the perm is empty, replace with the defaultPerm
type SessionUser ¶
SessionUser the login user info that is stored in session
func MapperToSessionUser ¶
func MapperToSessionUser(user *User) *SessionUser
MapperToSessionUser convert User to SessionUser
type User ¶
type User struct {
// contains filtered or unexported fields
}
User a login user info
func ParseUsers ¶
ParseUsers parse users string to User List For example: user1|password1|rwx,user2|password2|rwx
func RandomUser ¶
RandomUser generate some user with random username and password count is user count you want userLen is the length of random username, max length is 20 pwdLen is the length of random password, max length is 20 perm is the default permission of every random user, like 'rwx'
func (*User) ToHashUser ¶
ToHashUser convert User to HashUser