Files
upstream-centrifugo/internal/jwtverify/token_verifier.go
upstream-mirror b352a9a30d
Some checks failed
test / Lint (push) Failing after 3s
test / Test with Go 1.26.8 (push) Failing after 2s
snapshot of https://github.com/centrifugal/centrifugo.git (master, 2026-09-16; blobs > 131072B omitted)
2026-09-16 01:17:21 +05:00

46 lines
1.5 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package jwtverify
import (
"encoding/json"
"github.com/centrifugal/centrifuge"
)
type Verifier interface {
VerifyConnectToken(token string, skipVerify bool) (ConnectToken, error)
VerifySubscribeToken(token string, skipVerify bool) (SubscribeToken, error)
}
type ConnectToken struct {
// UserID tells an ID of connecting user.
UserID string
// ExpireAt allows setting time in future when connection must be validated.
// Validation can be server-side using On().Refresh callback or client-side
// if On().Refresh not set.
ExpireAt int64
// Info contains additional information about connection. It will be
// included into Join/Leave messages, into Alive information, also
// info becomes a part of published message if it was published from
// client directly. In some cases having additional info can be an
// overhead – but you are simply free to not use it.
Info []byte
// Meta is custom data to append to a connection. Can be retrieved later
// for connection inspection. Never sent in a client protocol and accessible
// from a backend-side only.
Meta json.RawMessage
// Subs is a map of channels to subscribe server-side with options.
Subs map[string]centrifuge.SubscribeOptions
}
type SubscribeToken struct {
// UserID tells an ID of subscribing user.
UserID string
// Channel client wants to subscribe. Will be compared with channel in
// subscribe command.
Channel string
// Client is a deprecated claim for compatibility with Centrifugo v3.
Client string
// Options for subscription.
Options centrifuge.SubscribeOptions
}