On branch main
modified: internal/domain/auth/dto.go modified: internal/domain/auth/handler.go modified: internal/domain/auth/router.go modified: internal/domain/auth/servcie.go modified: internal/middleware/auth.go modified: internal/router/router.go auth implemented without reset password
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
// router.go
|
||||
package auth
|
||||
|
||||
import (
|
||||
"api_yal/internal/logger"
|
||||
"api_yal/internal/middleware"
|
||||
"api_yal/internal/repository"
|
||||
"time"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
"gorm.io/gorm"
|
||||
@@ -13,8 +15,16 @@ import (
|
||||
func RegisterRoutes(r chi.Router, db *gorm.DB, jwtSecret string) {
|
||||
// Создаем репозиторий и сервис
|
||||
accountRepo := repository.NewAccountRepository(db)
|
||||
authService := NewAuthService(accountRepo, jwtSecret)
|
||||
handler := NewAuthHandler(&authService)
|
||||
|
||||
// Конфигурация токенов
|
||||
authConfig := AuthServiceConfig{
|
||||
JWTSecret: jwtSecret,
|
||||
AccessTokenTTL: 15 * time.Minute, // Access token живет 15 минут
|
||||
RefreshTokenTTL: 7 * 24 * time.Hour, // Refresh token живет 7 дней
|
||||
}
|
||||
|
||||
authService := NewAuthService(accountRepo, authConfig)
|
||||
handler := NewAuthHandler(authService)
|
||||
|
||||
l := logger.Get()
|
||||
l.Debug("Регистрация маршрутов аутентификации")
|
||||
|
||||
Reference in New Issue
Block a user