the middle of the idiots

This commit is contained in:
2025-10-24 16:29:40 -05:00
parent 6a58e19b10
commit 721301c779
2472 changed files with 237076 additions and 418 deletions

View File

@@ -16,7 +16,6 @@ import (
"github.com/golang-jwt/jwt/v5"
"github.com/google/uuid"
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
"github.com/coreos/go-oidc/v3/oidc"
"github.com/redis/go-redis/v9"
)
@@ -244,7 +243,7 @@ func LogoutHandler(c *gin.Context) {
ctx := context.Background()
duration := time.Until(expirationTime)
if duration > 0 {
err := redisClient.SetEX(ctx, tokenKey, "true", duration).Err()
err := redisClient.SetEx(ctx, tokenKey, "true", duration).Err()
if err != nil {
log.Printf("Error adding token to blacklist: %v", err)
c.JSON(http.StatusInternalServerError, gin.H{"error": "Logout failed"})
@@ -262,7 +261,7 @@ func OIDCLoginHandler(c *gin.Context) {
// Store state in session or Redis for validation after callback
ctx := context.Background()
err := redisClient.SetEX(ctx, fmt.Sprintf("oidc_state:%s", state), "valid", 5*time.Minute).Err()
err := redisClient.SetEx(ctx, fmt.Sprintf("oidc_state:%s", state), "valid", 5*time.Minute).Err()
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": "Internal server error"})
return
@@ -464,7 +463,7 @@ func SocialLoginHandler(c *gin.Context) {
// Store state in session or Redis for validation after callback
ctx := context.Background()
err := redisClient.SetEX(ctx, fmt.Sprintf("social_state:%s:%s", provider, state), "valid", 5*time.Minute).Err()
err := redisClient.SetEx(ctx, fmt.Sprintf("social_state:%s:%s", provider, state), "valid", 5*time.Minute).Err()
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": "Internal server error"})
return
@@ -655,7 +654,7 @@ func getUserInfoFromProvider(provider, code string) (*SocialUserInfo, error) {
case "google":
// Example Google OAuth flow
// Exchange code for token
tokenURL := "https://oauth2.googleapis.com/token"
// tokenURL := "https://oauth2.googleapis.com/token"
// ... perform token exchange ...
// Get user info