client

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(auth AuthInterceptor, addr string) (proto.TokenClient, func(), error)

Types

type AuthInterceptor

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

GRPC Authentication Interceptor

Inspired by the following tutorial https://dev.to/techschoolguru/use-grpc-interceptor-for-authorization-with-jwt-1c5h

func NewAuthInterceptor

func NewAuthInterceptor(accessTokenFnc func() string) *AuthInterceptor

func (*AuthInterceptor) Stream

func (interceptor *AuthInterceptor) Stream() grpc.StreamClientInterceptor

func (*AuthInterceptor) Unary

func (interceptor *AuthInterceptor) Unary() grpc.UnaryClientInterceptor

type Config

type Config struct {
	Ctx            context.Context
	InstallationId string
	User           string
	Addr           string
	*OAuth2Config
	AuthInterceptor
}

func (*Config) RetrieveToken

func (c *Config) RetrieveToken() (*oauth2.Token, error)

func (*Config) RevokeToken

func (c *Config) RevokeToken() error

func (*Config) StoreToken

func (c *Config) StoreToken(token *oauth2.Token) error

func (*Config) TokenSource

func (c *Config) TokenSource(ctx context.Context, t *oauth2.Token) oauth2.TokenSource

func (*Config) TokenSourceFrom

func (c *Config) TokenSourceFrom(ctx context.Context) oauth2.TokenSource

type DuneBotTokenSource

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

func (*DuneBotTokenSource) Token

func (t *DuneBotTokenSource) Token() (*oauth2.Token, error)

type Endpoint

type Endpoint = oauth2.Endpoint

type MockOAuth2Server

type MockOAuth2Server struct {
	*httptest.Server
}

func NewMockOAuth2Server

func NewMockOAuth2Server() *MockOAuth2Server

func (*MockOAuth2Server) Close

func (m *MockOAuth2Server) Close()

func (*MockOAuth2Server) Endpoint

func (m *MockOAuth2Server) Endpoint() oauth2.Endpoint

type OAuth2Config

type OAuth2Config = oauth2.Config

Jump to

Keyboard shortcuts

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