auth_client

package
v0.4.73 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthTokenErrorData

type AuthTokenErrorData struct {
	Error            string `json:"error"`
	ErrorDescription string `json:"error_description"`
}

type AuthTokenResponse

type AuthTokenResponse struct {
	Result *AuthTokenResponseData
	Error  *AuthTokenErrorData
}

type AuthTokenResponseData

type AuthTokenResponseData struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn    int    `json:"expires_in"`
	Scope        string `json:"scope"`
	IdToken      string `json:"id_token,omitempty"`
	TokenType    string `json:"token_type"`
}

type Client

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

func New

func New(
	authBaseUrl string,
	clientIdSecretMap map[string]string,
) *Client

func (*Client) GetAuthorizationEndpoint

func (c *Client) GetAuthorizationEndpoint(ctx context.Context) (string, error)

func (*Client) GetRefreshedAccessToken

func (c *Client) GetRefreshedAccessToken(
	ctx context.Context,
	clientId string,
	refreshToken string,
) (*AuthTokenResponse, error)

func (*Client) GetTokenEndpoint

func (c *Client) GetTokenEndpoint(ctx context.Context) (string, error)

func (*Client) GetTokenResponse

func (c *Client) GetTokenResponse(
	ctx context.Context,
	clientId string,
	code string,
	redirecturi string,
) (*AuthTokenResponse, error)

Uses Authorization Flow defined here: https://auth0.com/docs/api/authentication#authorization-code-flow47

func (*Client) GetUserInfo

func (c *Client) GetUserInfo(
	ctx context.Context,
	accessToken string,
) (*UserInfo, error)

type Interface

type Interface interface {
	GetTokenResponse(ctx context.Context, clientId string, code string, redirecturi string) (*AuthTokenResponse, error)
	GetRefreshedAccessToken(ctx context.Context, clientId string, refreshToken string) (*AuthTokenResponse, error)
	GetUserInfo(ctx context.Context, accessToken string) (*UserInfo, error)
	GetTokenEndpoint(ctx context.Context) (string, error)
	GetAuthorizationEndpoint(ctx context.Context) (string, error)
}

type MockInterface

type MockInterface struct {
	mock.Mock
}

MockInterface is an autogenerated mock type for the Interface type

func NewMockInterface

func NewMockInterface(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockInterface

NewMockInterface creates a new instance of MockInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockInterface) EXPECT

func (_m *MockInterface) EXPECT() *MockInterface_Expecter

func (*MockInterface) GetAuthorizationEndpoint

func (_m *MockInterface) GetAuthorizationEndpoint(ctx context.Context) (string, error)

GetAuthorizationEndpoint provides a mock function with given fields: ctx

func (*MockInterface) GetRefreshedAccessToken

func (_m *MockInterface) GetRefreshedAccessToken(ctx context.Context, clientId string, refreshToken string) (*AuthTokenResponse, error)

GetRefreshedAccessToken provides a mock function with given fields: ctx, clientId, refreshToken

func (*MockInterface) GetTokenEndpoint

func (_m *MockInterface) GetTokenEndpoint(ctx context.Context) (string, error)

GetTokenEndpoint provides a mock function with given fields: ctx

func (*MockInterface) GetTokenResponse

func (_m *MockInterface) GetTokenResponse(ctx context.Context, clientId string, code string, redirecturi string) (*AuthTokenResponse, error)

GetTokenResponse provides a mock function with given fields: ctx, clientId, code, redirecturi

func (*MockInterface) GetUserInfo

func (_m *MockInterface) GetUserInfo(ctx context.Context, accessToken string) (*UserInfo, error)

GetUserInfo provides a mock function with given fields: ctx, accessToken

type MockInterface_Expecter

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

func (*MockInterface_Expecter) GetAuthorizationEndpoint

func (_e *MockInterface_Expecter) GetAuthorizationEndpoint(ctx interface{}) *MockInterface_GetAuthorizationEndpoint_Call

GetAuthorizationEndpoint is a helper method to define mock.On call

  • ctx context.Context

func (*MockInterface_Expecter) GetRefreshedAccessToken

func (_e *MockInterface_Expecter) GetRefreshedAccessToken(ctx interface{}, clientId interface{}, refreshToken interface{}) *MockInterface_GetRefreshedAccessToken_Call

GetRefreshedAccessToken is a helper method to define mock.On call

  • ctx context.Context
  • clientId string
  • refreshToken string

func (*MockInterface_Expecter) GetTokenEndpoint

func (_e *MockInterface_Expecter) GetTokenEndpoint(ctx interface{}) *MockInterface_GetTokenEndpoint_Call

GetTokenEndpoint is a helper method to define mock.On call

  • ctx context.Context

func (*MockInterface_Expecter) GetTokenResponse

func (_e *MockInterface_Expecter) GetTokenResponse(ctx interface{}, clientId interface{}, code interface{}, redirecturi interface{}) *MockInterface_GetTokenResponse_Call

GetTokenResponse is a helper method to define mock.On call

  • ctx context.Context
  • clientId string
  • code string
  • redirecturi string

func (*MockInterface_Expecter) GetUserInfo

func (_e *MockInterface_Expecter) GetUserInfo(ctx interface{}, accessToken interface{}) *MockInterface_GetUserInfo_Call

GetUserInfo is a helper method to define mock.On call

  • ctx context.Context
  • accessToken string

type MockInterface_GetAuthorizationEndpoint_Call

type MockInterface_GetAuthorizationEndpoint_Call struct {
	*mock.Call
}

MockInterface_GetAuthorizationEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAuthorizationEndpoint'

func (*MockInterface_GetAuthorizationEndpoint_Call) Return

func (*MockInterface_GetAuthorizationEndpoint_Call) Run

func (*MockInterface_GetAuthorizationEndpoint_Call) RunAndReturn

type MockInterface_GetRefreshedAccessToken_Call

type MockInterface_GetRefreshedAccessToken_Call struct {
	*mock.Call
}

MockInterface_GetRefreshedAccessToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRefreshedAccessToken'

func (*MockInterface_GetRefreshedAccessToken_Call) Return

func (*MockInterface_GetRefreshedAccessToken_Call) Run

func (*MockInterface_GetRefreshedAccessToken_Call) RunAndReturn

type MockInterface_GetTokenEndpoint_Call

type MockInterface_GetTokenEndpoint_Call struct {
	*mock.Call
}

MockInterface_GetTokenEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTokenEndpoint'

func (*MockInterface_GetTokenEndpoint_Call) Return

func (*MockInterface_GetTokenEndpoint_Call) Run

func (*MockInterface_GetTokenEndpoint_Call) RunAndReturn

type MockInterface_GetTokenResponse_Call

type MockInterface_GetTokenResponse_Call struct {
	*mock.Call
}

MockInterface_GetTokenResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTokenResponse'

func (*MockInterface_GetTokenResponse_Call) Return

func (*MockInterface_GetTokenResponse_Call) Run

func (_c *MockInterface_GetTokenResponse_Call) Run(run func(ctx context.Context, clientId string, code string, redirecturi string)) *MockInterface_GetTokenResponse_Call

func (*MockInterface_GetTokenResponse_Call) RunAndReturn

type MockInterface_GetUserInfo_Call

type MockInterface_GetUserInfo_Call struct {
	*mock.Call
}

MockInterface_GetUserInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUserInfo'

func (*MockInterface_GetUserInfo_Call) Return

func (*MockInterface_GetUserInfo_Call) Run

func (*MockInterface_GetUserInfo_Call) RunAndReturn

type UserInfo

type UserInfo struct {
	Sub           string `json:"sub"`
	Nickname      string `json:"nickname"`
	Name          string `json:"name"`
	Picture       string `json:"picture"`
	UpdatedAt     string `json:"updated_at"`
	Email         string `json:"email"`
	EmailVerified bool   `json:"email_verified"`
}

Jump to

Keyboard shortcuts

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