grpc

package
v1.3.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package grpc contains IAM authentication interceptors for gRPC servers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BearerToken

func BearerToken(ctx context.Context) (string, bool)

BearerToken extracts authorization: Bearer token from incoming metadata.

func RequireAALStream added in v1.1.0

func RequireAALStream(min int) googlegrpc.StreamServerInterceptor

RequireAALStream is the streaming counterpart of RequireAALUnary.

func RequireAALUnary added in v1.1.0

func RequireAALUnary(min int) googlegrpc.UnaryServerInterceptor

RequireAALUnary admits a unary call only when the principal's assurance level is at least min (e.g. RequireAALUnary(2) demands a step-up/MFA session).

func RequireAnyScopeStream added in v1.1.0

func RequireAnyScopeStream(scopes ...string) googlegrpc.StreamServerInterceptor

RequireAnyScopeStream is the streaming counterpart of RequireAnyScopeUnary.

func RequireAnyScopeUnary added in v1.1.0

func RequireAnyScopeUnary(scopes ...string) googlegrpc.UnaryServerInterceptor

RequireAnyScopeUnary admits a unary call when the principal holds at least one of the listed scopes.

func RequireScopesStream added in v1.1.0

func RequireScopesStream(scopes ...string) googlegrpc.StreamServerInterceptor

RequireScopesStream is the streaming counterpart of RequireScopesUnary.

func RequireScopesUnary added in v1.1.0

func RequireScopesUnary(scopes ...string) googlegrpc.UnaryServerInterceptor

RequireScopesUnary admits a unary call only when the principal holds every listed scope. Chain after UnaryServerInterceptor.

func StreamServerInterceptor

func StreamServerInterceptor(auth sdk.Authenticator, opts ...Option) googlegrpc.StreamServerInterceptor

StreamServerInterceptor authenticates streaming gRPC calls and stores Principal in the stream context.

func UnaryServerInterceptor

func UnaryServerInterceptor(auth sdk.Authenticator, opts ...Option) googlegrpc.UnaryServerInterceptor

UnaryServerInterceptor authenticates unary gRPC calls and stores Principal in the handler context.

Types

type Option

type Option func(*options)

Option customizes gRPC interceptors.

func WithTokenExtractor

func WithTokenExtractor(extractor TokenExtractor) Option

WithTokenExtractor overrides the default authorization metadata extractor.

type TokenExtractor

type TokenExtractor func(context.Context) (string, bool)

TokenExtractor extracts a bearer token from an incoming gRPC context.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL