Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUserAlreadyExist = errors.New("auth: user already exists") ErrUserNotFound = errors.New("auth: user not found") ErrRoleAlreadyExist = errors.New("auth: role already exists") ErrRoleNotFound = errors.New("auth: role not found") ErrAuthFailed = errors.New("auth: authentication failed, invalid user ID or password") )
Functions ¶
func NewAuthStore ¶
Types ¶
type AuthStore ¶
type AuthStore interface { // AuthEnable turns on the authentication feature AuthEnable() // Authenticate does authentication based on given user name and password, // and returns a token for successful case. // Note that the generated token is valid only for the member the client // connected to within fixed time duration. Reauth is required after the duration. Authenticate(name string, password string) (*pb.AuthenticateResponse, error) // Recover recovers the state of auth store from the given backend Recover(b backend.Backend) // UserAdd adds a new user UserAdd(r *pb.AuthUserAddRequest) (*pb.AuthUserAddResponse, error) // UserDelete deletes a user UserDelete(r *pb.AuthUserDeleteRequest) (*pb.AuthUserDeleteResponse, error) // UserChangePassword changes a password of a user UserChangePassword(r *pb.AuthUserChangePasswordRequest) (*pb.AuthUserChangePasswordResponse, error) // UserGrant grants a role to the user UserGrant(r *pb.AuthUserGrantRequest) (*pb.AuthUserGrantResponse, error) // RoleAdd adds a new role RoleAdd(r *pb.AuthRoleAddRequest) (*pb.AuthRoleAddResponse, error) // RoleGrant grants a permission to a role RoleGrant(r *pb.AuthRoleGrantRequest) (*pb.AuthRoleGrantResponse, error) }
Click to show internal directories.
Click to hide internal directories.