Documentation
¶
Overview ¶
Package auth 负责登录、启动信息和用户身份解析 endpoint。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthEndpoint ¶
type AuthEndpoint struct {
// contains filtered or unexported fields
}
AuthEndpoint 提供登录、启动信息和用户身份解析 capability。
func NewAuth ¶
func NewAuth(c *client.Client) *AuthEndpoint
NewAuth 用共享 transport 构造 auth capability。
func (*AuthEndpoint) Login ¶
func (e *AuthEndpoint) Login(username, password string) (string, error)
Login 提交用户名密码并把返回 token 写入 client。
func (*AuthEndpoint) ResolveUserID ¶
func (e *AuthEndpoint) ResolveUserID(token string) (int64, string, error)
ResolveUserID 依次尝试 JWT claims、/users 和 /startup.user。
func (*AuthEndpoint) Startup ¶
func (e *AuthEndpoint) Startup() (map[string]json.RawMessage, error)
Startup 返回 GET /api/v1/startup 的 data。
func (*AuthEndpoint) Users ¶
func (e *AuthEndpoint) Users() (map[string]json.RawMessage, error)
Users 返回 GET /api/v1/users 的 profile data。
Click to show internal directories.
Click to hide internal directories.