oauth

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package oauth provides OAuth callback server implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbackServer

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

CallbackServer implements the OAuth callback server.

func NewCallbackServer

func NewCallbackServer(port int) *CallbackServer

NewCallbackServer creates a new callback server.

func (*CallbackServer) GetRedirectURI

func (s *CallbackServer) GetRedirectURI() string

GetRedirectURI returns the redirect URI for OAuth.

func (*CallbackServer) Start

func (s *CallbackServer) Start() error

Start starts the callback server.

func (*CallbackServer) Stop

func (s *CallbackServer) Stop() error

Stop stops the callback server.

func (*CallbackServer) WaitForCallback

func (s *CallbackServer) WaitForCallback(ctx context.Context) (string, error)

WaitForCallback waits for the OAuth callback and returns the auth code.

type MockServer

type MockServer struct {
	Port                  int
	AuthCode              string
	StartCalled           bool
	StopCalled            bool
	WaitForCallbackCalled bool
	TimeoutAfter          time.Duration
}

MockServer is a mock implementation of OAuthServer for testing.

func NewMockServer

func NewMockServer(authCode string) *MockServer

NewMockServer creates a new MockServer.

func (*MockServer) GetRedirectURI

func (m *MockServer) GetRedirectURI() string

GetRedirectURI returns the redirect URI.

func (*MockServer) Start

func (m *MockServer) Start() error

Start starts the mock server.

func (*MockServer) Stop

func (m *MockServer) Stop() error

Stop stops the mock server.

func (*MockServer) WaitForCallback

func (m *MockServer) WaitForCallback(ctx context.Context) (string, error)

WaitForCallback waits for the OAuth callback.

Jump to

Keyboard shortcuts

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