Add swaggo annotations to all handlers and regenerate full Swagger docs
- Added @Summary/@Router/@Param/@Success/@Security annotations to all API handlers - Regenerated docs/swagger.json, docs/swagger.yaml, docs/docs.go with full endpoint definitions - Fixed generated docs.go to remove unsupported LeftDelim/RightDelim fields
This commit is contained in:
@@ -88,6 +88,16 @@ func (h *WebAuthnHandler) RegisterRoutes(r *http.ServeMux) {
|
||||
r.HandleFunc("POST /auth/webauthn/login/finish", h.LoginFinish)
|
||||
}
|
||||
|
||||
// @Summary Begin passkey registration
|
||||
// @Description Start passkey registration for an authenticated user
|
||||
// @Tags webauthn
|
||||
// @Produce json
|
||||
// @Security SessionAuth
|
||||
// @Success 200 {object} object "WebAuthn registration options"
|
||||
// @Failure 401 {object} map[string]string
|
||||
// @Failure 404 {object} map[string]string
|
||||
// @Failure 500 {object} map[string]string
|
||||
// @Router /auth/webauthn/register/begin [post]
|
||||
// RegisterBegin starts passkey registration for an authenticated user.
|
||||
func (h *WebAuthnHandler) RegisterBegin(w http.ResponseWriter, r *http.Request) {
|
||||
userID, ok := middleware.UserIDFromContext(r.Context())
|
||||
@@ -116,6 +126,16 @@ func (h *WebAuthnHandler) RegisterBegin(w http.ResponseWriter, r *http.Request)
|
||||
json.NewEncoder(w).Encode(options)
|
||||
}
|
||||
|
||||
// @Summary Finish passkey registration
|
||||
// @Description Complete passkey registration
|
||||
// @Tags webauthn
|
||||
// @Produce json
|
||||
// @Security SessionAuth
|
||||
// @Success 200 {object} map[string]string
|
||||
// @Failure 400 {object} map[string]string
|
||||
// @Failure 401 {object} map[string]string
|
||||
// @Failure 500 {object} map[string]string
|
||||
// @Router /auth/webauthn/register/finish [post]
|
||||
// RegisterFinish completes passkey registration.
|
||||
func (h *WebAuthnHandler) RegisterFinish(w http.ResponseWriter, r *http.Request) {
|
||||
userID, ok := middleware.UserIDFromContext(r.Context())
|
||||
@@ -163,6 +183,13 @@ func (h *WebAuthnHandler) RegisterFinish(w http.ResponseWriter, r *http.Request)
|
||||
json.NewEncoder(w).Encode(map[string]string{"status": "registered"})
|
||||
}
|
||||
|
||||
// @Summary Begin passkey login
|
||||
// @Description Start passkey authentication
|
||||
// @Tags webauthn
|
||||
// @Produce json
|
||||
// @Success 200 {object} object "WebAuthn login options"
|
||||
// @Failure 500 {object} map[string]string
|
||||
// @Router /auth/webauthn/login/begin [post]
|
||||
// LoginBegin starts passkey authentication (no auth required).
|
||||
func (h *WebAuthnHandler) LoginBegin(w http.ResponseWriter, r *http.Request) {
|
||||
// Get all registered credentials for the login ceremony
|
||||
@@ -213,6 +240,15 @@ func (h *WebAuthnHandler) LoginBegin(w http.ResponseWriter, r *http.Request) {
|
||||
json.NewEncoder(w).Encode(options)
|
||||
}
|
||||
|
||||
// @Summary Finish passkey login
|
||||
// @Description Complete passkey authentication
|
||||
// @Tags webauthn
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} map[string]string
|
||||
// @Failure 400 {object} map[string]string
|
||||
// @Failure 401 {object} map[string]string
|
||||
// @Router /auth/webauthn/login/finish [post]
|
||||
// LoginFinish completes passkey authentication.
|
||||
func (h *WebAuthnHandler) LoginFinish(w http.ResponseWriter, r *http.Request) {
|
||||
// Get challenge key from cookie
|
||||
|
||||
Reference in New Issue
Block a user