Files
hspguard/internal/oauth/routes.go

29 lines
582 B
Go

package oauth
import (
"gitea.local/admin/hspguard/internal/config"
"gitea.local/admin/hspguard/internal/repository"
"github.com/go-chi/chi/v5"
)
type OAuthHandler struct {
repo *repository.Queries
cfg *config.AppConfig
}
func NewOAuthHandler(repo *repository.Queries, cfg *config.AppConfig) *OAuthHandler {
return &OAuthHandler{
repo,
cfg,
}
}
func (h *OAuthHandler) RegisterRoutes(router chi.Router) {
router.Route("/oauth", func(r chi.Router) {
r.Post("/token", h.tokenEndpoint)
r.Post("/code", h.getAuthCode)
r.Get("/authorize", h.AuthorizeClient)
})
}