Documentation ¶
Index ¶
- Constants
- Variables
- func PaginateMapValues[T any](req api.PaginatedRequest, m map[string]T, less func(a T, b T) bool, ...) (page []T, nbt string, err error)
- func PaginateSlice[T any](req api.PaginatedRequest, values []T, opts PaginationOpts) (page []T, npt string, err error)
- func PaginateStorage[T any](req api.PaginatedRequest, storage persistence.Storage, opts PaginationOpts, ...) (page []T, npt string, err error)
- func StartGRPCServer(jwksURL string, opts ...StartGRPCServerOption) (sock net.Listener, srv *grpc.Server, err error)
- type AuthConfig
- type AuthOption
- type Option
- type PaginationOpts
- type StartGRPCServerOption
Constants ¶
const AuthContextKey = authContextKeyType("token")
AuthContextKey is a key used in RPC context to retrieve the token info with using context.Value.
const DefaultJWKSURL = "http://localhost:8080/.well-known/jwks.json"
DefaultJWKSURL is the default JWKS url pointing to a local authentication server.
Variables ¶
var DefaultPaginationOpts = PaginationOpts{
DefaultPageSize: 50,
MaxPageSize: 1000,
}
DefaultPaginationOpts are sensible defaults for the pagination size.
Functions ¶
func PaginateMapValues ¶ added in v1.4.6
func PaginateMapValues[T any](req api.PaginatedRequest, m map[string]T, less func(a T, b T) bool, opts PaginationOpts) (page []T, nbt string, err error)
PaginateMapValues is a wrapper around PaginateSlice that uses maps.Values to determine the maps values and sorts them according to the specified less function, to return a deterministic result.
func PaginateSlice ¶ added in v1.4.6
func PaginateSlice[T any](req api.PaginatedRequest, values []T, opts PaginationOpts) (page []T, npt string, err error)
PaginateSlice is a helper function that helps to paginate a slice based on list requests. It parses the necessary informaton out if a paginated request, e.g. the page token and the desired page size and returns a sliced page as well as the next page token.
func PaginateStorage ¶ added in v1.4.6
func PaginateStorage[T any](req api.PaginatedRequest, storage persistence.Storage, opts PaginationOpts, conds ...interface{}) (page []T, npt string, err error)
PaginateStorage is a helper function that helps to paginate records in persisted storage based on list requests. It parses the necessary informaton out if a paginated request, e.g. the page token and the desired page size and returns a sliced page as well as the next page token.
func StartGRPCServer ¶
Types ¶
type AuthConfig ¶
type AuthConfig struct { // Jwks contains a JSON Web Key Set, that is used if JWKS support is enabled. Otherwise a // stored public key will be used Jwks *keyfunc.JWKS AuthFunc grpc_auth.AuthFunc // contains filtered or unexported fields }
func ConfigureAuth ¶
func ConfigureAuth(opts ...AuthOption) *AuthConfig
ConfigureAuth creates a new AuthConfig, which can be used in gRPC middleware to provide an authentication layer.
type AuthOption ¶
type AuthOption func(*AuthConfig)
AuthOption is a function-style option type to fine-tune authentication
func WithJWKSURL ¶
func WithJWKSURL(url string) AuthOption
WithJWKSURL is an option to provide a URL that contains a JSON Web Key Set (JWKS). The JWKS will be used to validate tokens coming from RPC clients against public keys contains in the JWKS.
func WithPublicKey ¶
func WithPublicKey(publicKey *ecdsa.PublicKey) AuthOption
WithPublicKey is an option to directly provide a ECDSA public key which is used to verify tokens coming from RPC clients.
type Option ¶ added in v1.4.11
type Option[T any] func(*T)
Option is a functional option type to configure services.
type PaginationOpts ¶ added in v1.4.6
type PaginationOpts struct { // DefaultPageSize is the page size that is used as a default if the request does not specify one DefaultPageSize int32 // MaxPageSize is the maximum page size that can be requested MaxPageSize int32 }
PaginationOpts can be used to fine-tune the pagination, especially with regards to the page sizes. This can be important if the messages within a page are extremly large and thus the page size needs to be decreased.
type StartGRPCServerOption ¶
func WithDiscovery ¶
func WithDiscovery(svc discovery.DiscoveryServer) StartGRPCServerOption
func WithEvidenceStore ¶
func WithEvidenceStore(svc evidence.EvidenceStoreServer) StartGRPCServerOption
func WithOrchestrator ¶
func WithOrchestrator(svc orchestrator.OrchestratorServer) StartGRPCServerOption