Documentation
¶
Overview ¶
Package auth is a generated GoMock package.
Index ¶
- Constants
- type AuthRouter
- type MockProvider
- func (m *MockProvider) AuthCodeURL(c *gin.Context, state string) (string, error)
- func (m *MockProvider) AuthURL() string
- func (m *MockProvider) Authorization(userid string) (bool, error)
- func (m *MockProvider) EXPECT() *MockProviderMockRecorder
- func (m *MockProvider) Exchange(c *gin.Context, state string) (*oauth2.Token, error)
- func (m *MockProvider) GetUserID(ctx context.Context, token *oauth2.Token) (string, error)
- func (m *MockProvider) Name() string
- func (m *MockProvider) RedirectURL() string
- func (m *MockProvider) Type() string
- type MockProviderMockRecorder
- func (mr *MockProviderMockRecorder) AuthCodeURL(c, state any) *gomock.Call
- func (mr *MockProviderMockRecorder) AuthURL() *gomock.Call
- func (mr *MockProviderMockRecorder) Authorization(userid any) *gomock.Call
- func (mr *MockProviderMockRecorder) Exchange(c, state any) *gomock.Call
- func (mr *MockProviderMockRecorder) GetUserID(ctx, token any) *gomock.Call
- func (mr *MockProviderMockRecorder) Name() *gomock.Call
- func (mr *MockProviderMockRecorder) RedirectURL() *gomock.Call
- func (mr *MockProviderMockRecorder) Type() *gomock.Call
- type Provider
- func NewGithubProvider(clientID, clientSecret, externalURL string, allowedUsers []string) (Provider, error)
- func NewGoogleProvider(externalURL, clientID, clientSecret string, allowedUsers []string) (Provider, error)
- func NewOIDCProvider(configurationURL string, scopes []string, userIDField string, ...) (Provider, error)
Constants ¶
const ( LoginEndpoint = "/.auth/login" LogoutEndpoint = "/.auth/logout" GoogleAuthEndpoint = "/.auth/google" GoogleCallbackEndpoint = "/.auth/google/callback" GitHubAuthEndpoint = "/.auth/github" GitHubCallbackEndpoint = "/.auth/github/callback" OIDCAuthEndpoint = "/.auth/oidc" OIDCCallbackEndpoint = "/.auth/oidc/callback" PasswordProvider = "password" PasswordUserID = "password_user" SessionKeyProvider = "provider" SessionKeyUserID = "user_id" SessionKeyRedirectURL = "redirect_url" SessionKeyOAuthState = "oauth_state" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthRouter ¶
type AuthRouter struct {
// contains filtered or unexported fields
}
func NewAuthRouter ¶
func NewAuthRouter(passwordHash []string, providers ...Provider) (*AuthRouter, error)
func (*AuthRouter) RequireAuth ¶
func (a *AuthRouter) RequireAuth() gin.HandlerFunc
func (*AuthRouter) SetupRoutes ¶
func (a *AuthRouter) SetupRoutes(router gin.IRouter)
type MockProvider ¶ added in v1.2.3
type MockProvider struct {
// contains filtered or unexported fields
}
MockProvider is a mock of Provider interface.
func NewMockProvider ¶ added in v1.2.3
func NewMockProvider(ctrl *gomock.Controller) *MockProvider
NewMockProvider creates a new mock instance.
func (*MockProvider) AuthCodeURL ¶ added in v1.2.3
AuthCodeURL mocks base method.
func (*MockProvider) AuthURL ¶ added in v1.2.3
func (m *MockProvider) AuthURL() string
AuthURL mocks base method.
func (*MockProvider) Authorization ¶ added in v1.2.3
func (m *MockProvider) Authorization(userid string) (bool, error)
Authorization mocks base method.
func (*MockProvider) EXPECT ¶ added in v1.2.3
func (m *MockProvider) EXPECT() *MockProviderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockProvider) Name ¶ added in v1.2.3
func (m *MockProvider) Name() string
Name mocks base method.
func (*MockProvider) RedirectURL ¶ added in v1.2.3
func (m *MockProvider) RedirectURL() string
RedirectURL mocks base method.
func (*MockProvider) Type ¶ added in v1.3.0
func (m *MockProvider) Type() string
Type mocks base method.
type MockProviderMockRecorder ¶ added in v1.2.3
type MockProviderMockRecorder struct {
// contains filtered or unexported fields
}
MockProviderMockRecorder is the mock recorder for MockProvider.
func (*MockProviderMockRecorder) AuthCodeURL ¶ added in v1.2.3
func (mr *MockProviderMockRecorder) AuthCodeURL(c, state any) *gomock.Call
AuthCodeURL indicates an expected call of AuthCodeURL.
func (*MockProviderMockRecorder) AuthURL ¶ added in v1.2.3
func (mr *MockProviderMockRecorder) AuthURL() *gomock.Call
AuthURL indicates an expected call of AuthURL.
func (*MockProviderMockRecorder) Authorization ¶ added in v1.2.3
func (mr *MockProviderMockRecorder) Authorization(userid any) *gomock.Call
Authorization indicates an expected call of Authorization.
func (*MockProviderMockRecorder) Exchange ¶ added in v1.2.3
func (mr *MockProviderMockRecorder) Exchange(c, state any) *gomock.Call
Exchange indicates an expected call of Exchange.
func (*MockProviderMockRecorder) GetUserID ¶ added in v1.2.3
func (mr *MockProviderMockRecorder) GetUserID(ctx, token any) *gomock.Call
GetUserID indicates an expected call of GetUserID.
func (*MockProviderMockRecorder) Name ¶ added in v1.2.3
func (mr *MockProviderMockRecorder) Name() *gomock.Call
Name indicates an expected call of Name.
func (*MockProviderMockRecorder) RedirectURL ¶ added in v1.2.3
func (mr *MockProviderMockRecorder) RedirectURL() *gomock.Call
RedirectURL indicates an expected call of RedirectURL.
func (*MockProviderMockRecorder) Type ¶ added in v1.3.0
func (mr *MockProviderMockRecorder) Type() *gomock.Call
Type indicates an expected call of Type.
type Provider ¶
type Provider interface {
Name() string
Type() string
RedirectURL() string
AuthURL() string
AuthCodeURL(c *gin.Context, state string) (string, error)
Exchange(c *gin.Context, state string) (*oauth2.Token, error)
GetUserID(ctx context.Context, token *oauth2.Token) (string, error)
Authorization(userid string) (bool, error)
}