client

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthClientHandler

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

AuthClientHandler handles HTTP requests for OAuth client authentication flows. It manages the callback handling for various OAuth providers.

func NewAuthClientHandler

func NewAuthClientHandler(ctx context.Context, cfg authConfig.Config, providerStore ProviderLookup, federationBroker *federation.Broker, codeIssuer CodeIssuer, organizationResolver OrganizationResolver) (*AuthClientHandler, error)

NewAuthClientHandler creates a new AuthClientHandler with the provided configuration. It initializes the provider store with the server context, and sets up structured logging.

func (*AuthClientHandler) SetupRoutes

func (h *AuthClientHandler) SetupRoutes(mux *http.ServeMux)

SetupRoutes registers the OAuth authentication routes with the provided HTTP mux. It sets up GET /users/auth/{provider}/callback for handling OAuth callbacks.

type CodeIssuer

type CodeIssuer interface {
	IssueFromFederationSession(ctx context.Context, w http.ResponseWriter, session *federation.Session, userInfo identity.UserInfo, additionalParams map[string]string) error
}

CodeIssuer is the slice of *issuer.Issuer the callback handler uses. Defining it as an interface lets tests substitute a fake without spinning up a full fosite provider.

type OrganizationResolver

type OrganizationResolver interface {
	GetOrganizationID(ctx context.Context, provider, providerUserID, email string) (int, error)
}

type ProviderLookup

type ProviderLookup interface {
	GetProvider(name string) (providers.Provider, bool)
}

ProviderLookup is the subset of ProviderStore the callback handler needs.

type ProviderStore

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

ProviderStore manages a registry of OAuth providers and acts as a factory for creating and retrieving provider instances.

func NewProviderStore

func NewProviderStore(ctx context.Context, cfg config.Config, logger *logrus.Entry) *ProviderStore

NewProviderStore creates a new ProviderStore with the provided configuration. It initializes OAuth providers based on the configuration.

func (*ProviderStore) GetProvider

func (s *ProviderStore) GetProvider(name string) (providers.Provider, bool)

GetProvider retrieves a provider by name from the store. It returns the provider and a boolean indicating whether the provider exists.

type TopologyClient

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

TopologyClient abstracts calls to GitLab topology service. The topology service is responsible for routing users to the correct cell and organization. Currently returns a default organization ID as the routing service is not yet available.

func NewTopologyClient

func NewTopologyClient(logger *logrus.Entry) *TopologyClient

NewTopologyClient creates a new TopologyClient with the provided logger.

func (*TopologyClient) GetOrganizationID

func (c *TopologyClient) GetOrganizationID(ctx context.Context, provider, providerUserID, email string) (int, error)

GetOrganizationID determines the organization ID for a user based on their provider information. Currently returns 1 as a stub implementation until the topology service is available.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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