feat: Implement Steam login initialization logic
Some checks failed
CI - Build and Push / Build and Push Docker Image (push) Failing after 32s

- Added SteamLoginInitLogic to handle the initiation of Steam login.
- Created service context for managing configuration and Redis connection.
- Defined types for Steam login requests and callbacks.
- Implemented utility functions for building OpenID query strings and validating responses from Steam.
- Updated go.mod and go.sum to include necessary dependencies.
- Modified GenApi.ps1 script to generate code in the correct directory.
This commit is contained in:
2025-10-12 10:54:11 +08:00
parent cde4235332
commit b6c464cb12
18 changed files with 35 additions and 35 deletions

2
.gitignore vendored
View File

@@ -1,6 +1,6 @@
/api/Authenticator.json
/api/Authenticator.yaml
*.exe
/src/src
/app/app
/.vscode
/.ignore

View File

@@ -7,14 +7,14 @@ RUN apk add --no-cache git
# Set working directory
WORKDIR /app
# Copy go mod files from src directory
COPY src/go.mod src/go.sum ./
# Copy go mod files from root directory
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy source code from src directory
COPY src/ .
# Copy source code from app directory
COPY app/ .
# Build the application
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o authenticator authenticator.go

View File

@@ -4,9 +4,9 @@ import (
"flag"
"fmt"
"src/internal/config"
"src/internal/handler"
"src/internal/svc"
"git.cialloo.com/CiallooWeb/Authenticator/app/internal/config"
"git.cialloo.com/CiallooWeb/Authenticator/app/internal/handler"
"git.cialloo.com/CiallooWeb/Authenticator/app/internal/svc"
"github.com/zeromicro/go-zero/core/conf"
"github.com/zeromicro/go-zero/rest"

View File

@@ -3,10 +3,10 @@ package handler
import (
"net/http"
"git.cialloo.com/CiallooWeb/Authenticator/app/internal/logic"
"git.cialloo.com/CiallooWeb/Authenticator/app/internal/svc"
"git.cialloo.com/CiallooWeb/Authenticator/app/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
"src/internal/logic"
"src/internal/svc"
"src/internal/types"
)
// Ping the server to check if it's alive

View File

@@ -6,7 +6,7 @@ package handler
import (
"net/http"
"src/internal/svc"
"git.cialloo.com/CiallooWeb/Authenticator/app/internal/svc"
"github.com/zeromicro/go-zero/rest"
)

View File

@@ -3,9 +3,9 @@ package handler
import (
"net/http"
"src/internal/logic"
"src/internal/svc"
"src/internal/types"
"git.cialloo.com/CiallooWeb/Authenticator/app/internal/logic"
"git.cialloo.com/CiallooWeb/Authenticator/app/internal/svc"
"git.cialloo.com/CiallooWeb/Authenticator/app/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)

View File

@@ -3,9 +3,9 @@ package handler
import (
"net/http"
"src/internal/logic"
"src/internal/svc"
"src/internal/types"
"git.cialloo.com/CiallooWeb/Authenticator/app/internal/logic"
"git.cialloo.com/CiallooWeb/Authenticator/app/internal/svc"
"git.cialloo.com/CiallooWeb/Authenticator/app/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)

View File

@@ -3,8 +3,8 @@ package logic
import (
"context"
"src/internal/svc"
"src/internal/types"
"git.cialloo.com/CiallooWeb/Authenticator/app/internal/svc"
"git.cialloo.com/CiallooWeb/Authenticator/app/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)

View File

@@ -7,9 +7,9 @@ import (
"net/url"
"time"
"src/internal/svc"
"src/internal/types"
"src/internal/utils/steamauth"
"git.cialloo.com/CiallooWeb/Authenticator/app/internal/svc"
"git.cialloo.com/CiallooWeb/Authenticator/app/internal/types"
"git.cialloo.com/CiallooWeb/Authenticator/app/internal/utils/steamauth"
"github.com/golang-jwt/jwt/v4"
"github.com/zeromicro/go-zero/core/logx"

View File

@@ -6,9 +6,9 @@ import (
"net/http"
"time"
"src/internal/svc"
"src/internal/types"
"src/internal/utils/steamauth"
"git.cialloo.com/CiallooWeb/Authenticator/app/internal/svc"
"git.cialloo.com/CiallooWeb/Authenticator/app/internal/types"
"git.cialloo.com/CiallooWeb/Authenticator/app/internal/utils/steamauth"
"github.com/google/uuid"
"github.com/zeromicro/go-zero/core/logx"

View File

@@ -1,7 +1,7 @@
package svc
import (
"src/internal/config"
"git.cialloo.com/CiallooWeb/Authenticator/app/internal/config"
"github.com/zeromicro/go-zero/core/stores/redis"
)

View File

@@ -1,11 +1,11 @@
module src
module git.cialloo.com/CiallooWeb/Authenticator
go 1.24.4
require (
github.com/golang-jwt/jwt/v4 v4.5.2
github.com/google/uuid v1.6.0
github.com/zeromicro/go-zero v1.9.1
github.com/zeromicro/go-zero v1.9.2
)
require (
@@ -29,7 +29,7 @@ require (
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.62.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/redis/go-redis/v9 v9.15.0 // indirect
github.com/redis/go-redis/v9 v9.14.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect

View File

@@ -67,8 +67,8 @@ github.com/prometheus/common v0.62.0 h1:xasJaQlnWAeyHdUBeGjXmutelfJHWMRr+Fg4QszZ
github.com/prometheus/common v0.62.0/go.mod h1:vyBcEuLSvWos9B1+CyL7JZ2up+uFzXhkqml0W5zIY1I=
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
github.com/redis/go-redis/v9 v9.15.0 h1:2jdes0xJxer4h3NUZrZ4OGSntGlXp4WbXju2nOTRXto=
github.com/redis/go-redis/v9 v9.15.0/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw=
github.com/redis/go-redis/v9 v9.14.0 h1:u4tNCjXOyzfgeLN+vAZaW1xUooqWDqVEsZN0U01jfAE=
github.com/redis/go-redis/v9 v9.14.0/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
@@ -86,8 +86,8 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M=
github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw=
github.com/zeromicro/go-zero v1.9.1 h1:GZCl4jun/ZgZHnSvX3SSNDHf+tEGmEQ8x2Z23xjHa9g=
github.com/zeromicro/go-zero v1.9.1/go.mod h1:bHOl7Xr7EV/iHZWEqsUNJwFc/9WgAMrPpPagYvOaMtY=
github.com/zeromicro/go-zero v1.9.2 h1:ZXOXBIcazZ1pWAMiHyVnDQ3Sxwy7DYPzjE89Qtj9vqM=
github.com/zeromicro/go-zero v1.9.2/go.mod h1:k8YBMEFZKjTd4q/qO5RCW+zDgUlNyAs5vue3P4/Kmn0=
go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo=
go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo=
go.opentelemetry.io/otel/exporters/jaeger v1.17.0 h1:D7UpUy2Xc2wsi1Ras6V40q806WM07rqoCWzXu7Sqy+4=

View File

@@ -17,7 +17,7 @@ Set-Location -Path (Resolve-Path "../../api")
goctl api format -dir .
# generate go-zero code
goctl api go -api Authenticator.api -dir ../src --style=gozero
goctl api go -api Authenticator.api -dir ../app --style=gozero
# generate swagger and convert to openapi3 only when -s is provided
if ($s) {