This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package auth | |
| import ( | |
| "github.com/Renrensan/go-auth-demo/middleware" | |
| "github.com/gin-gonic/gin" | |
| "github.com/redis/go-redis/v9" | |
| "gorm.io/gorm" | |
| ) | |
| // RegisterAuthRoutes sets up authentication-related routes on the provided router group. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package auth | |
| import ( | |
| "github.com/Renrensan/go-auth-demo/utils" | |
| "github.com/gin-gonic/gin" | |
| ) | |
| // AuthController is responsible for handling authentication-related HTTP requests. | |
| // It communicates with the AuthService to process authentication logic. | |
| type AuthController struct { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package auth | |
| import ( | |
| "github.com/Renrensan/go-auth-demo/utils" | |
| ) | |
| // AuthService contains the business logic for authentication operations. | |
| type AuthService struct { | |
| authRepository IAuthRepository // Repository for accessing data (e.g., user information) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package auth | |
| import ( | |
| "context" | |
| "errors" | |
| "fmt" | |
| "time" | |
| "github.com/Renrensan/go-auth-demo/db" | |
| "github.com/Renrensan/go-auth-demo/utils" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package auth | |
| import ( | |
| "github.com/Renrensan/go-auth-demo/middleware" | |
| "github.com/gin-gonic/gin" | |
| "github.com/redis/go-redis/v9" | |
| "gorm.io/gorm" | |
| ) | |
| // RegisterAuthRoutes sets up authentication-related routes on the provided router group. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| func (authController *AuthController) Protected(ctx *gin.Context) { | |
| response := utils.NewHttpResponse(200, "Hello Protected", nil) | |
| ctx.JSON(response.StatusCode, response) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package middleware | |
| import ( | |
| "errors" | |
| "fmt" | |
| "os" | |
| "strings" | |
| "github.com/Renrensan/go-auth-demo/utils" | |
| "github.com/gin-gonic/gin" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package auth | |
| import ( | |
| "github.com/gin-gonic/gin" | |
| "github.com/redis/go-redis/v9" | |
| "gorm.io/gorm" | |
| ) | |
| // RegisterAuthRoutes sets up authentication-related routes on the provided router group. | |
| // It takes the Gin router group, GORM database connection, and Redis client as dependencies. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package auth | |
| import ( | |
| "github.com/Renrensan/go-auth-demo/utils" | |
| "github.com/gin-gonic/gin" | |
| ) | |
| // AuthController is responsible for handling authentication-related HTTP requests. | |
| // It communicates with the AuthService to process authentication logic. | |
| type AuthController struct { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package auth | |
| import ( | |
| "github.com/Renrensan/go-auth-demo/utils" | |
| ) | |
| // AuthService contains the business logic for authentication operations. | |
| type AuthService struct { | |
| authRepository IAuthRepository // Repository for accessing data (e.g., user information) | |
| } |
NewerOlder