Documentation ¶
Index ¶
- func AuthorizeUser(next http.Handler) http.Handler
- func CreateEvent(ctx context.Context, msg string, s *ent.Server, u *ent.User) error
- func GenerateToken(userID string) (string, error)
- func GenerateTokenCookie(userID string) (*http.Cookie, error)
- func GetServerObject(ctx context.Context, s *ent.Server) (*common.ServerObject, error)
- func GetUser(ctx context.Context) string
- func InitRouter(ctx context.Context, c *config.Configs) *chi.Mux
- type Server
- func (s *Server) AdminCreateTemplate(w http.ResponseWriter, r *http.Request)
- func (s *Server) AdminGetUserList(w http.ResponseWriter, r *http.Request)
- func (s *Server) AdminSetQuota(w http.ResponseWriter, r *http.Request)
- func (s *Server) CreateServer(w http.ResponseWriter, r *http.Request)
- func (s *Server) DeleteServer(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetServer(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetServerList(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetTemplateList(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetUserInfo(w http.ResponseWriter, r *http.Request)
- func (s *Server) LoginUser(w http.ResponseWriter, r *http.Request)
- func (s *Server) LogoutUser(w http.ResponseWriter, r *http.Request)
- func (s *Server) UpdateUserInfo(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthorizeUser ¶
AuthorizeUser middleware for validating user token and embed to userinfo to context
func CreateEvent ¶
func GenerateToken ¶
GenerateToken generate token for user auth
func GenerateTokenCookie ¶
GenerateTokenCookie generate cookie which includes JWT
func GetServerObject ¶
GetServerObject Get Server Object by querying db
Types ¶
type Server ¶
type Server struct{}
Server dummy routing sturct
func (*Server) AdminCreateTemplate ¶
func (s *Server) AdminCreateTemplate(w http.ResponseWriter, r *http.Request)
AdminCreateTemplate create template (POST /admin/template)
func (*Server) AdminGetUserList ¶
func (s *Server) AdminGetUserList(w http.ResponseWriter, r *http.Request)
AdminGetUserList get user list (GET /admin/user)
func (*Server) AdminSetQuota ¶
func (s *Server) AdminSetQuota(w http.ResponseWriter, r *http.Request)
AdminSetQuota set user quota (POST /admin/quota) and (POST /admin/quota/{userId})
func (*Server) CreateServer ¶
func (s *Server) CreateServer(w http.ResponseWriter, r *http.Request)
CreateServer Create server request (POST /server)
func (*Server) DeleteServer ¶
func (s *Server) DeleteServer(w http.ResponseWriter, r *http.Request)
DeleteServer Delete server (DELETE /server/{serverId}
func (*Server) GetServer ¶
func (s *Server) GetServer(w http.ResponseWriter, r *http.Request)
GetServer Get server info (GET /server/{serverId}
func (*Server) GetServerList ¶
func (s *Server) GetServerList(w http.ResponseWriter, r *http.Request)
GetServerList Get list of accessible server to user (GET /server)
func (*Server) GetTemplateList ¶
func (s *Server) GetTemplateList(w http.ResponseWriter, r *http.Request)
GetTemplateList get template list (GET /template)
func (*Server) GetUserInfo ¶
func (s *Server) GetUserInfo(w http.ResponseWriter, r *http.Request)
GetUserInfo get user info (GET /user)
func (*Server) LoginUser ¶
func (s *Server) LoginUser(w http.ResponseWriter, r *http.Request)
LoginUser Logs in user by set cookie (POST /login)
func (*Server) LogoutUser ¶
func (s *Server) LogoutUser(w http.ResponseWriter, r *http.Request)
LogoutUser Log out user by clear cookie (GET /logout)
func (*Server) UpdateUserInfo ¶
func (s *Server) UpdateUserInfo(w http.ResponseWriter, r *http.Request)
UpdateUserInfo update user info (POST /user)