Files
query-orchestration/api/queryAPI/authHandlers.go
T

34 lines
1.1 KiB
Go
Raw Normal View History

2025-04-07 14:10:39 -07:00
package queryapi
import (
"net/http"
"github.com/labstack/echo/v4"
)
2025-04-15 12:04:54 -07:00
// All of the auth related handlers that are called from the
// generated swagger code.
2025-04-07 14:10:39 -07:00
func (s *Controllers) Login(ctx echo.Context) error {
// Redirect to Cognito login page
// This is a placeholder implementation - you'll need to implement the actual Cognito redirect logic
loginURL := "https://doczy.auth.us-east-1.amazoncognito.com/oauth2/authorize"
return ctx.Redirect(http.StatusFound, loginURL)
}
func (s *Controllers) LoginCallback(ctx echo.Context, params LoginCallbackParams) error {
2025-04-15 12:04:54 -07:00
return ctx.JSON(http.StatusOK, map[string]string{"message": "Login callback is a no op since its handled by the middleware."})
2025-04-07 14:10:39 -07:00
}
2025-04-15 12:04:54 -07:00
// Logout is called by the swagger generated code for the logout endpoint.
2025-04-07 14:10:39 -07:00
func (s *Controllers) Logout(ctx echo.Context) error {
2025-04-15 12:04:54 -07:00
// the middleware will have already removed the auth cookie
// so we can just redirect to the home page after logging out.
return ctx.Redirect(http.StatusFound, "/home")
2025-04-07 14:10:39 -07:00
}
func (s *Controllers) GetHomePage(ctx echo.Context) error {
return HomeHandler(ctx)
}