Documentation
¶
Overview ¶
Package sts authenticates clients and Connect RPC handlers.
Index ¶
- func Authenticate() connect.ServerInterceptor
- func Configure(config Config)
- func GoogleIDToken(audience string) connect.ClientInterceptor
- func NewInterceptor(verifierToken string, permissions ...string) connect.ServerInterceptor
- func Require(permission string, permissions ...string) connect.ServerInterceptor
- func RequirePermissions(ctx context.Context, permissions ...string) error
- type Actor
- type ActorRule
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Authenticate ¶ added in v0.2.0
func Authenticate() connect.ServerInterceptor
Authenticate authenticates requests without requiring specific permissions. Call Configure first, and use RequirePermissions in handlers as needed.
func Configure ¶ added in v0.2.0
func Configure(config Config)
Configure sets application-wide authentication before interceptors are created. Interceptors share public key caches and retain the configuration they were created with. Invalid configuration panics; public keys are fetched on demand.
func GoogleIDToken ¶ added in v0.3.1
func GoogleIDToken(audience string) connect.ClientInterceptor
GoogleIDToken sends Google ID tokens using the application's default credentials and refreshes them as needed. Set audience to the receiving service's identifier, independently of the request path. Outside production, it sends local-token instead.
func NewInterceptor ¶
func NewInterceptor(verifierToken string, permissions ...string) connect.ServerInterceptor
NewInterceptor authenticates existing STS keys without app-wide configuration. Deprecated: use Configure followed by Require or Authenticate instead.
Types ¶
type Actor ¶ added in v0.2.0
Actor identifies the verified JWT caller by issuer and subject.
func ActorFromContext ¶ added in v0.2.0
ActorFromContext returns the verified JWT actor. It panics if the context has no actor.
type ActorRule ¶ added in v0.2.0
type ActorRule struct {
// contains filtered or unexported fields
}
ActorRule grants permissions to a Google account or a Convex deployment. Construct rules with GoogleSubject, GoogleServiceAccount, or ConvexApp. Matching grants are additive.
func ConvexApp ¶ added in v0.2.0
ConvexApp accepts every subject signed by the configured Convex app. Pass its full HTTPS issuer URL, including custom domains or regional hosts. Deployment names such as gentle-fox-123 expand to https://gentle-fox-123.convex.cloud.
func GoogleServiceAccount ¶ added in v0.2.1
GoogleServiceAccount accepts a service account by its verified email claim. Tokens must include email and email_verified. A recreated account with the same email is also accepted; use GoogleSubject to bind to a specific account ID.
func GoogleSubject ¶ added in v0.2.0
GoogleSubject accepts the stable Google sub claim of a service account or user. Pass the account's stable subject ID.
type Config ¶ added in v0.2.0
Config defines the credentials and actors accepted by the application. Audience must match the JWT audience and is required when Actors is nonempty. VerifierToken enables remote STS verification for existing opaque keys. Locally, only local-token is accepted and permission checks are skipped.