Add user repo and keycloak
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user