oauth

package
v0.22.3 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BrowserOpener

type BrowserOpener func(string) error

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type MockOAuthService

type MockOAuthService struct {
	mock.Mock
}

MockOAuthService is a mock implementation of the OAuthServicer interface

func (*MockOAuthService) GetValidToken

func (m *MockOAuthService) GetValidToken() (string, error)

GetValidToken mocks the GetValidToken method

func (*MockOAuthService) IsTokenExpired

func (m *MockOAuthService) IsTokenExpired(expiryTime int64) bool

IsTokenExpired mocks the IsTokenExpired method

func (*MockOAuthService) RefreshToken

func (m *MockOAuthService) RefreshToken(refreshToken string) (*TokenResponse, error)

RefreshToken mocks the RefreshToken method

func (*MockOAuthService) StartOAuthServer

func (m *MockOAuthService) StartOAuthServer() (*TokenResponse, error)

StartOAuthServer mocks the StartOAuthServer method

type OAuthService

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

func DefaultOAuthService

func DefaultOAuthService() *OAuthService

func NewOAuthService

func NewOAuthService(httpClient HTTPClient, timeProvider timeprovider.TimeProvider, browserOpener BrowserOpener, randReader io.Reader) *OAuthService

func (*OAuthService) GetValidToken

func (s *OAuthService) GetValidToken() (string, error)

func (*OAuthService) IsTokenExpired

func (s *OAuthService) IsTokenExpired(expiryTime int64) bool

func (*OAuthService) RefreshToken

func (s *OAuthService) RefreshToken(refreshToken string) (*TokenResponse, error)

func (*OAuthService) StartOAuthServer

func (s *OAuthService) StartOAuthServer() (*TokenResponse, error)

type OAuthServicer

type OAuthServicer interface {
	IsTokenExpired(expiryTime int64) bool
	RefreshToken(refreshToken string) (*TokenResponse, error)
	GetValidToken() (string, error)
}

type TokenResponse

type TokenResponse struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	IDToken      string `json:"id_token"`
	ExpiresIn    int    `json:"expires_in"`
	ExpiryTime   int64  `json:"-"`
}

Jump to

Keyboard shortcuts

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