server

package
v0.0.0-...-f4c426e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package server implements the gRPC server for the authentication service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	pb.UnimplementedAuthServiceServer
	DB        *db.Queries
	Logger    *zap.Logger
	SecretKey []byte
}

Server represents the gRPC server for authentication.

func NewServer

func NewServer(logger *zap.Logger, pool *pgxpool.Pool, SecretKey []byte) *Server

NewServer creates a new instance of the authentication server.

func (*Server) Login

func (s *Server) Login(ctx context.Context, req *pb.LoginRequest) (*pb.LoginResponse, error)

Login handles user authentication and returns a JWT token upon successful login.

func (*Server) ValidateToken

func (s *Server) ValidateToken(ctx context.Context, req *pb.ValidateTokenRequest) (*pb.ValidateTokenResponse, error)

ValidateToken verifies the provided JWT token and returns the associated user ID if valid.

type VerifyTokenResponse

type VerifyTokenResponse struct {
	UserID   string
	ClientID string
	Valid    bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL