Add user repo and keycloak

This commit is contained in:
Achim Rohn
2025-07-27 19:12:46 +02:00
parent d6a229c95f
commit 258853857f
7 changed files with 589 additions and 8 deletions
+3 -7
View File
@@ -7,6 +7,7 @@ import (
"encoding/json"
"errors"
"ersteller-lib"
"ersteller-lib/authentication"
"github.com/gorilla/sessions"
"github.com/labstack/echo/v4"
"golang.org/x/oauth2"
@@ -28,22 +29,17 @@ type AuthEnv struct {
SessionName string
}
type UserRepository interface {
GetUserId(email string) (int, error)
Create(email string) (int, error)
}
type Auth struct {
Config oauth2.Config
repo *GoogleAuthRepository
isLocal bool
userRepo UserRepository
userRepo authentication.UserRepository
sessionStore *sessions.CookieStore
GoogleLoginRoute ersteller_lib.Route
environment AuthEnv
}
func NewAuth(env AuthEnv, repo *GoogleAuthRepository, userRepo UserRepository, sessionStore *sessions.CookieStore) *Auth {
func NewAuth(env AuthEnv, repo *GoogleAuthRepository, userRepo authentication.UserRepository, sessionStore *sessions.CookieStore) *Auth {
config := oauth2.Config{
ClientID: env.GoogleClientId,
ClientSecret: env.GoogleClientSecret,