Documentation
¶
Index ¶
- Constants
- func Bearer(accessToken string) client.Option
- type ChangePasswordRequest
- type Client
- func (c *Client) AdminInfo(ctx context.Context) (InfoResponse, error)
- func (c *Client) ChangePassword(ctx context.Context, req ChangePasswordRequest) error
- func (c *Client) CreateUser(ctx context.Context, req CreateUserRequest) (UserResponse, error)
- func (c *Client) ListSessions(ctx context.Context) (ListSessionsResponse, error)
- func (c *Client) Login(ctx context.Context, req LoginRequest) (LoginResponse, error)
- func (c *Client) Logout(ctx context.Context, req LogoutRequest) error
- func (c *Client) Refresh(ctx context.Context, req RefreshRequest) (RefreshResponse, error)
- func (c *Client) RevokeOtherSessions(ctx context.Context) (RevokeOthersResponse, error)
- func (c *Client) RevokeSession(ctx context.Context, sid string) error
- func (c *Client) Session(ctx context.Context) (SessionResponse, error)
- func (c *Client) SetUserAccess(ctx context.Context, req SetUserAccessRequest) (SetUserAccessResponse, error)
- type CreateUserRequest
- type InfoResponse
- type ListSessionsResponse
- type LoginRequest
- type LoginResponse
- type LogoutRequest
- type PastSession
- type RefreshRequest
- type RefreshResponse
- type RevokeOthersResponse
- type RevokeSessionRequest
- type Session
- type SessionResponse
- type SetUserAccessRequest
- type SetUserAccessResponse
- type Tokens
- type UserResponse
Constants ¶
View Source
const ( PathLogin = "/api/v1/auth/login" PathRefresh = "/api/v1/auth/refresh" PathLogout = "/api/v1/auth/logout" PathSession = "/api/v1/session" PathSessions = "/api/v1/auth/sessions" PathSessionByID = "/api/v1/auth/sessions/{sid}" PathRevokeOthers = "/api/v1/auth/sessions/revoke-others" PathPassword = "/api/v1/auth/password" PathUsers = "/api/v1/auth/users" PathUserAccess = "/api/v1/auth/users/{userId}/access" PathAdminInfo = "/api/v1/admin/info" RoleAdmin = "admin" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChangePasswordRequest ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) ChangePassword ¶
func (c *Client) ChangePassword(ctx context.Context, req ChangePasswordRequest) error
func (*Client) CreateUser ¶
func (c *Client) CreateUser(ctx context.Context, req CreateUserRequest) (UserResponse, error)
func (*Client) ListSessions ¶
func (c *Client) ListSessions(ctx context.Context) (ListSessionsResponse, error)
func (*Client) Login ¶
func (c *Client) Login(ctx context.Context, req LoginRequest) (LoginResponse, error)
func (*Client) Refresh ¶
func (c *Client) Refresh(ctx context.Context, req RefreshRequest) (RefreshResponse, error)
func (*Client) RevokeOtherSessions ¶
func (c *Client) RevokeOtherSessions(ctx context.Context) (RevokeOthersResponse, error)
func (*Client) RevokeSession ¶
func (*Client) SetUserAccess ¶
func (c *Client) SetUserAccess(ctx context.Context, req SetUserAccessRequest) (SetUserAccessResponse, error)
type CreateUserRequest ¶
type CreateUserRequest struct {
Email string `json:"email" validate:"required,email,max=254"`
Name string `json:"name" validate:"max=200"`
Password string `json:"password" validate:"required,max=1024"`
Roles []string `json:"roles" validate:"max=50,dive,min=1,max=64"`
Features []string `json:"features" validate:"max=200,dive,min=1,max=64"`
}
type InfoResponse ¶
type ListSessionsResponse ¶
type ListSessionsResponse struct {
Sessions []Session `json:"sessions"`
History []PastSession `json:"history"`
}
type LoginRequest ¶
type LoginResponse ¶
type LogoutRequest ¶
type LogoutRequest struct {
RefreshToken string `json:"refreshToken,omitempty" validate:"max=512"`
}
type PastSession ¶
type RefreshRequest ¶
type RefreshRequest struct {
RefreshToken string `json:"refreshToken" validate:"required,max=512"`
}
type RefreshResponse ¶
type RefreshResponse struct {
User types.User `json:"user"`
Tokens Tokens `json:"tokens"`
}
type RevokeOthersResponse ¶
type RevokeOthersResponse struct {
Revoked int `json:"revoked"`
}
type RevokeSessionRequest ¶
type RevokeSessionRequest struct {
SID string `path:"sid" json:"-" validate:"required,max=64"`
}
type SessionResponse ¶
type SessionResponse struct {
User types.User `json:"user"`
Session Session `json:"session"`
}
type SetUserAccessRequest ¶
type SetUserAccessResponse ¶
type SetUserAccessResponse struct {
User types.User `json:"user"`
SessionsUpdated int `json:"sessionsUpdated"`
}
type UserResponse ¶
type UserResponse struct {
User types.User `json:"user"`
}
Click to show internal directories.
Click to hide internal directories.