feat: initial commit

This commit is contained in:
2025-06-15 14:46:32 +02:00
parent 85f0bc1024
commit c50d1858f2
25 changed files with 2002 additions and 55 deletions

View File

@ -31,13 +31,25 @@ func (h *Handler) handleProviderCallback(w http.ResponseWriter, r *http.Request)
slog.DebugContext(ctx, "authenticated user", slog.Any("user", gothUser))
user := &User{
ID: gothUser.UserID,
Email: gothUser.Email,
Provider: gothUser.Provider,
AccessToken: gothUser.AccessToken,
IDToken: gothUser.IDToken,
Name: gothUser.Name,
}
if user.Email == "" {
slog.ErrorContext(r.Context(), "could not authenticate user", slog.Any("error", errors.New("user email missing")))
http.Redirect(w, r, "/auth/logout", http.StatusTemporaryRedirect)
return
}
if user.Provider == "" {
slog.ErrorContext(r.Context(), "could not authenticate user", slog.Any("error", errors.New("user provider missing")))
http.Redirect(w, r, "/auth/logout", http.StatusTemporaryRedirect)
return
}
rawPreferredUsername, exists := gothUser.RawData["preferred_username"]
if exists {
if preferredUsername, ok := rawPreferredUsername.(string); ok {