parser: github.com/pingcap/parser/auth Index | Files

package auth

import "github.com/pingcap/parser/auth"

Index

Package Files

auth.go

func CheckScrambledPassword Uses

func CheckScrambledPassword(salt, hpwd, auth []byte) bool

CheckScrambledPassword check scrambled password received from client. The new authentication is performed in following manner:

SERVER:  public_seed=create_random_string()
         send(public_seed)
CLIENT:  recv(public_seed)
         hash_stage1=sha1("password")
         hash_stage2=sha1(hash_stage1)
         reply=xor(hash_stage1, sha1(public_seed,hash_stage2)
         // this three steps are done in scramble()
         send(reply)
SERVER:  recv(reply)
         hash_stage1=xor(reply, sha1(public_seed,hash_stage2))
         candidate_hash2=sha1(hash_stage1)
         check(candidate_hash2==hash_stage2)
         // this three steps are done in check_scramble()

func DecodePassword Uses

func DecodePassword(pwd string) ([]byte, error)

DecodePassword converts hex string password without prefix '*' to byte array.

func EncodePassword Uses

func EncodePassword(pwd string) string

EncodePassword converts plaintext password to hashed hex string.

func Sha1Hash Uses

func Sha1Hash(bs []byte) []byte

Sha1Hash is an util function to calculate sha1 hash.

type RoleIdentity Uses

type RoleIdentity struct {
    Username string
    Hostname string
}

func (*RoleIdentity) Restore Uses

func (role *RoleIdentity) Restore(ctx *RestoreCtx) error

func (*RoleIdentity) String Uses

func (role *RoleIdentity) String() string

String converts UserIdentity to the format user@host.

type UserIdentity Uses

type UserIdentity struct {
    Username     string
    Hostname     string
    CurrentUser  bool
    AuthUsername string // Username matched in privileges system
    AuthHostname string // Match in privs system (i.e. could be a wildcard)
}

UserIdentity represents username and hostname.

func (*UserIdentity) AuthIdentityString Uses

func (user *UserIdentity) AuthIdentityString() string

AuthIdentityString returns matched identity in user@host format

func (*UserIdentity) Restore Uses

func (user *UserIdentity) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

func (*UserIdentity) String Uses

func (user *UserIdentity) String() string

String converts UserIdentity to the format user@host.

Package auth imports 7 packages (graph) and is imported by 92 packages. Updated 2019-12-15. Refresh now. Tools for package owners.