auth_interceptor

package
v0.0.0-...-7c152a1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Audience               = "hookd"
	GithubOIDCDiscoveryURL = "https://token.actions.githubusercontent.com/.well-known/jwks"
	Issuer                 = "https://token.actions.githubusercontent.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeyInterceptor

type APIKeyInterceptor struct {
	APIKey     []byte
	RequireTLS bool
	Team       string
}

func (*APIKeyInterceptor) GetRequestMetadata

func (c *APIKeyInterceptor) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error)

func (*APIKeyInterceptor) RequireTransportSecurity

func (t *APIKeyInterceptor) RequireTransportSecurity() bool

type ClientInterceptor

type ClientInterceptor interface {
	GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error)
	RequireTransportSecurity() bool
}

type GithubValidator

type GithubValidator struct {
	// contains filtered or unexported fields
}

func NewGithubValidator

func NewGithubValidator() (*GithubValidator, error)

func (*GithubValidator) Validate

func (g *GithubValidator) Validate(ctx context.Context, token string) (jwt.Token, error)

type JWTInterceptor

type JWTInterceptor struct {
	JWT        string
	RequireTLS bool
	Team       string
}

func (*JWTInterceptor) GetRequestMetadata

func (c *JWTInterceptor) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error)

func (*JWTInterceptor) RequireTransportSecurity

func (t *JWTInterceptor) RequireTransportSecurity() bool

type ServerInterceptor

type ServerInterceptor struct {
	APIKeyStore    database.ApiKeyStore
	TokenValidator TokenValidator
	TeamsClient    TeamsClient
}

func NewServerInterceptor

func NewServerInterceptor(apiKeyStore database.ApiKeyStore, tokenValidator TokenValidator, teamsClient TeamsClient) *ServerInterceptor

func (*ServerInterceptor) Stream

func (*ServerInterceptor) StreamServerInterceptor

func (s *ServerInterceptor) StreamServerInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error

func (*ServerInterceptor) Unary

func (*ServerInterceptor) UnaryServerInterceptor

func (s *ServerInterceptor) UnaryServerInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error)

type TeamsClient

type TeamsClient interface {
	IsAuthorized(ctx context.Context, repo, team string) (bool, error)
}

type TokenValidator

type TokenValidator interface {
	Validate(ctx context.Context, token string) (jwt.Token, error)
}

Jump to

Keyboard shortcuts

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