common

package
v1.0.0-helm Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package common is a generated GoMock package.

Index

Constants

View Source
const (
	AuthHeader string = "Authorization"
)

Variables

This section is empty.

Functions

func ExtractBearerToken added in v0.6.0

func ExtractBearerToken(r *http.Request) (string, error)

func IsPublicAuthEndpoint added in v1.0.0

func IsPublicAuthEndpoint(path string) bool

IsPublicAuthEndpoint checks if the given path is a public auth endpoint that doesn't require authentication or org validation. Only includes endpoints served by the main API server. OIDC/OAuth2 endpoints (authorize, token, jwks, etc.) are served by the PAM issuer on a separate server and are not included here.

Types

type AuthNMiddleware added in v1.0.0

type AuthNMiddleware interface {
	GetAuthToken(r *http.Request) (string, error)
	ValidateToken(ctx context.Context, token string) error
	GetIdentity(ctx context.Context, token string) (Identity, error)
	GetAuthConfig() *v1beta1.AuthConfig
	IsEnabled() bool
}

type AuthOrganizationsConfig added in v0.10.0

type AuthOrganizationsConfig struct {
	Enabled bool
	// OrganizationAssignment defines how users are assigned to organizations
	OrganizationAssignment *v1beta1.AuthOrganizationAssignment
}

type BaseIdentity added in v0.10.0

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

func NewBaseIdentity added in v0.10.0

func NewBaseIdentity(username string, uID string, organizations []ReportedOrganization) *BaseIdentity

func NewBaseIdentityWithIssuer added in v1.0.0

func NewBaseIdentityWithIssuer(username string, uID string, organizations []ReportedOrganization, issuer *identity.Issuer) *BaseIdentity

func (*BaseIdentity) GetIssuer added in v1.0.0

func (i *BaseIdentity) GetIssuer() *identity.Issuer

func (*BaseIdentity) GetOrganizations added in v1.0.0

func (i *BaseIdentity) GetOrganizations() []ReportedOrganization

func (*BaseIdentity) GetUID added in v0.10.0

func (i *BaseIdentity) GetUID() string

func (*BaseIdentity) GetUsername added in v0.10.0

func (i *BaseIdentity) GetUsername() string

func (*BaseIdentity) IsSuperAdmin added in v1.0.0

func (i *BaseIdentity) IsSuperAdmin() bool

func (*BaseIdentity) SetIssuer added in v1.0.0

func (i *BaseIdentity) SetIssuer(issuer *identity.Issuer)

func (*BaseIdentity) SetOrganizations added in v1.0.0

func (i *BaseIdentity) SetOrganizations(organizations []ReportedOrganization)

func (*BaseIdentity) SetSuperAdmin added in v1.0.0

func (i *BaseIdentity) SetSuperAdmin(superAdmin bool)

func (*BaseIdentity) SetUID added in v0.10.0

func (i *BaseIdentity) SetUID(uID string)

func (*BaseIdentity) SetUsername added in v0.10.0

func (i *BaseIdentity) SetUsername(username string)

type ContextKey added in v1.0.0

type ContextKey string

ContextKey is a custom type for context keys to avoid collisions

type Identity added in v0.4.0

type Identity interface {
	GetUsername() string
	GetUID() string
	GetOrganizations() []ReportedOrganization
	GetIssuer() *identity.Issuer
	IsSuperAdmin() bool
	SetSuperAdmin(bool)
}

func GetIdentity added in v0.4.0

func GetIdentity(ctx context.Context) (Identity, error)

type K8sIdentity added in v1.0.0

type K8sIdentity struct {
	*BaseIdentity
	// contains filtered or unexported fields
}

K8sIdentity extends BaseIdentity with K8s control plane URL and RBAC namespace

func NewK8sIdentity added in v1.0.0

func NewK8sIdentity(username string, uID string, organizations []ReportedOrganization, issuer *identity.Issuer, controlPlaneUrl string, rbacNs string) *K8sIdentity

func (*K8sIdentity) GetControlPlaneUrl added in v1.0.0

func (i *K8sIdentity) GetControlPlaneUrl() string

func (*K8sIdentity) GetRbacNs added in v1.0.0

func (i *K8sIdentity) GetRbacNs() string

type K8sIdentityProvider added in v1.0.0

type K8sIdentityProvider interface {
	Identity
	GetControlPlaneUrl() string
}

K8sIdentityProvider extends Identity with control plane URL for K8s-based auth

type MockAuthNMiddleware added in v1.0.0

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

MockAuthNMiddleware is a mock of AuthNMiddleware interface.

func NewMockAuthNMiddleware added in v1.0.0

func NewMockAuthNMiddleware(ctrl *gomock.Controller) *MockAuthNMiddleware

NewMockAuthNMiddleware creates a new mock instance.

func (*MockAuthNMiddleware) EXPECT added in v1.0.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockAuthNMiddleware) GetAuthConfig added in v1.0.0

func (m *MockAuthNMiddleware) GetAuthConfig() *api.AuthConfig

GetAuthConfig mocks base method.

func (*MockAuthNMiddleware) GetAuthToken added in v1.0.0

func (m *MockAuthNMiddleware) GetAuthToken(r *http.Request) (string, error)

GetAuthToken mocks base method.

func (*MockAuthNMiddleware) GetIdentity added in v1.0.0

func (m *MockAuthNMiddleware) GetIdentity(ctx context.Context, token string) (Identity, error)

GetIdentity mocks base method.

func (*MockAuthNMiddleware) IsEnabled added in v1.0.0

func (m *MockAuthNMiddleware) IsEnabled() bool

IsEnabled mocks base method.

func (*MockAuthNMiddleware) ValidateToken added in v1.0.0

func (m *MockAuthNMiddleware) ValidateToken(ctx context.Context, token string) error

ValidateToken mocks base method.

type MockAuthNMiddlewareMockRecorder added in v1.0.0

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

MockAuthNMiddlewareMockRecorder is the mock recorder for MockAuthNMiddleware.

func (*MockAuthNMiddlewareMockRecorder) GetAuthConfig added in v1.0.0

func (mr *MockAuthNMiddlewareMockRecorder) GetAuthConfig() *gomock.Call

IsEnabled indicates an expected call of IsEnabled. GetAuthConfig indicates an expected call of GetAuthConfig.

func (*MockAuthNMiddlewareMockRecorder) GetAuthToken added in v1.0.0

func (mr *MockAuthNMiddlewareMockRecorder) GetAuthToken(r any) *gomock.Call

GetAuthToken indicates an expected call of GetAuthToken.

func (*MockAuthNMiddlewareMockRecorder) GetIdentity added in v1.0.0

func (mr *MockAuthNMiddlewareMockRecorder) GetIdentity(ctx, token any) *gomock.Call

GetIdentity indicates an expected call of GetIdentity.

func (*MockAuthNMiddlewareMockRecorder) ValidateToken added in v1.0.0

func (mr *MockAuthNMiddlewareMockRecorder) ValidateToken(ctx, token any) *gomock.Call

ValidateToken indicates an expected call of ValidateToken.

type MockIdentity added in v1.0.0

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

MockIdentity is a mock of Identity interface.

func NewMockIdentity added in v1.0.0

func NewMockIdentity(ctrl *gomock.Controller) *MockIdentity

NewMockIdentity creates a new mock instance.

func (*MockIdentity) EXPECT added in v1.0.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockIdentity) GetIssuer added in v1.0.0

func (m *MockIdentity) GetIssuer() *identity.Issuer

GetIssuer mocks base method.

func (*MockIdentity) GetOrganizations added in v1.0.0

func (m *MockIdentity) GetOrganizations() []ReportedOrganization

GetOrganizations mocks base method.

func (*MockIdentity) GetRoles

func (m *MockIdentity) GetRoles() []string

GetRoles mocks base method.

func (*MockIdentity) GetUID added in v1.0.0

func (m *MockIdentity) GetUID() string

GetUID mocks base method.

func (*MockIdentity) GetUsername added in v1.0.0

func (m *MockIdentity) GetUsername() string

GetUsername mocks base method.

type MockIdentityMockRecorder added in v1.0.0

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

MockIdentityMockRecorder is the mock recorder for MockIdentity.

func (*MockIdentityMockRecorder) GetIssuer added in v1.0.0

func (mr *MockIdentityMockRecorder) GetIssuer() *gomock.Call

GetIssuer indicates an expected call of GetIssuer.

func (*MockIdentityMockRecorder) GetOrganizations added in v1.0.0

func (mr *MockIdentityMockRecorder) GetOrganizations() *gomock.Call

GetOrganizations indicates an expected call of GetOrganizations.

func (*MockIdentityMockRecorder) GetRoles

func (mr *MockIdentityMockRecorder) GetRoles() *gomock.Call

GetRoles indicates an expected call of GetRoles.

func (*MockIdentityMockRecorder) GetUID added in v1.0.0

func (mr *MockIdentityMockRecorder) GetUID() *gomock.Call

GetUID indicates an expected call of GetUID.

func (*MockIdentityMockRecorder) GetUsername added in v1.0.0

func (mr *MockIdentityMockRecorder) GetUsername() *gomock.Call

GetUsername indicates an expected call of GetUsername.

type OpenShiftIdentity added in v1.0.0

type OpenShiftIdentity struct {
	*BaseIdentity
	// contains filtered or unexported fields
}

OpenShiftIdentity extends BaseIdentity with OpenShift control plane URL

func NewOpenShiftIdentity added in v1.0.0

func NewOpenShiftIdentity(username string, uID string, organizations []ReportedOrganization, issuer *identity.Issuer, controlPlaneUrl string) *OpenShiftIdentity

func (*OpenShiftIdentity) GetControlPlaneUrl added in v1.0.0

func (i *OpenShiftIdentity) GetControlPlaneUrl() string

type ReportedOrganization added in v1.0.0

type ReportedOrganization struct {
	Name         string
	IsInternalID bool
	ID           string
	Roles        []string
}

func BuildReportedOrganizations added in v1.0.0

func BuildReportedOrganizations(organizations []string, orgRoles map[string][]string, isInternalID bool) ([]ReportedOrganization, bool)

BuildReportedOrganizations creates ReportedOrganization list from organizations and their roles It handles: - Extracting global roles (from "*" key in orgRoles map) - Detecting flightctl-admin role and setting super admin flag - Filtering out flightctl-admin from both global and org-specific roles (it's only used for super admin flag) - Distributing remaining global roles to all organizations - Combining org-specific and global roles for each organization

Jump to

Keyboard shortcuts

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