Documentation ¶
Index ¶
- func AuthMiddleware(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (interface{}, error)
- func CheckPassword(p string, hp string) error
- func CreateJWT(uuid string, email string, t TokenType) (string, error)
- func EmailSender(receiverEmail string, subject string, body string, htmlBody string) error
- func EmailVerification(receiverEmail string, code string) error
- func HashPassword(p string) (string, error)
- func HttpAuthMiddleware(next http.Handler) http.Handler
- type Claims
- type ErrorResponse
- type TokenType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthMiddleware ¶
func AuthMiddleware(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
AuthMiddleware checks for JWT in the authorization header and validates it (ONLY WHEN MAKING CALLS VIA GRPC PORT)
func CheckPassword ¶
CheckPassword checks if the provided plaintext password is equivalent to the hashed password
func EmailSender ¶
func EmailVerification ¶
func HashPassword ¶
HashPassword returns the hashed password
Types ¶
type Claims ¶
type Claims struct { Uuid string `json:"uuid"` Email string `json:"email"` Type TokenType `json:"type"` //To decide whether it is access(0) or refresh(1) token jwt.RegisteredClaims }
Claims represents the JWT claims structure
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
Click to show internal directories.
Click to hide internal directories.