Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct { KeyCache *lru.ARCCache KeyCacheTTL time.Duration HTTPClient *http.Client Limiter *rate.Limiter ServiceDID string PLCDirectory string }
func NewAuth ¶
func NewAuth( keyCacheSize int, keyCacheTTL time.Duration, plcDirectory string, requestsPerSecond int, serviceDID string, ) (*Auth, error)
NewAuth creates a new Auth instance with the given key cache size and TTL The PLC Directory URL is also required, as well as the DID of the service for JWT audience validation The key cache is used to cache the public keys of users for a given TTL The PLC Directory URL is used to fetch the public keys of users The service DID is used to validate the audience of JWTs The HTTP client is used to make requests to the PLC Directory A rate limiter is used to limit the number of requests to the PLC Directory
func (*Auth) AuthenticateGinRequestViaJWT ¶
func (*Auth) GetClaimsFromAuthHeader ¶
type KeyCacheEntry ¶
type PLCEntry ¶
type PLCEntry struct { Context []string `json:"@context"` ID string `json:"id"` AlsoKnownAs []string `json:"alsoKnownAs"` VerificationMethod []struct { ID string `json:"id"` Type string `json:"type"` Controller string `json:"controller"` PublicKeyMultibase string `json:"publicKeyMultibase"` } `json:"verificationMethod"` Service []struct { ID string `json:"id"` Type string `json:"type"` ServiceEndpoint string `json:"serviceEndpoint"` } `json:"service"` }
Click to show internal directories.
Click to hide internal directories.