Documentation
¶
Index ¶
- Variables
- func CreateAccessToken(ctx context.Context, data UserData) (string, error)
- func CreateRefreshToken(ctx context.Context, id uuid.UUID) (string, error)
- func GetToken(ctx context.Context) (string, error)
- func GetUserIDFromContext(ctx context.Context) (uuid.UUID, error)
- func RefreshAccessToken(ctx context.Context, tokenString string, data UserData) (string, error)
- func TokenInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, ...) (resp any, err error)
- type AccessTokenClaims
- type Broker
- type Instruction
- type Message
- type RefreshTokenClaims
- type UserData
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrServer = status.Error(codes.Internal, "Server error") ErrMissingMetadata = status.Error(codes.InvalidArgument, "missing metadata") ErrInvalidToken = status.Error(codes.Unauthenticated, "invalid token") ErrUsersNotFound = status.Error(codes.InvalidArgument, "users not found") )
Functions ¶
func CreateRefreshToken ¶
func RefreshAccessToken ¶
func TokenInterceptor ¶
func TokenInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error)
Types ¶
type AccessTokenClaims ¶
type AccessTokenClaims struct { Username string Email string jwt.StandardClaims }
func ParseToken ¶
func ParseToken(ctx context.Context, tokenString string) (AccessTokenClaims, error)
type Broker ¶
type Broker[T any] struct { // contains filtered or unexported fields }
func (*Broker[T]) Unsubscribe ¶
func (b *Broker[T]) Unsubscribe(msgCh chan T)
type Instruction ¶
type Message ¶
type Message struct { Instruction *Instruction Sender string }
type RefreshTokenClaims ¶
type RefreshTokenClaims struct {
jwt.StandardClaims
}
Click to show internal directories.
Click to hide internal directories.