Documentation
¶
Overview ¶
Package common is a generated GoMock package.
Index ¶
- Constants
- func ExtractBearerToken(r *http.Request) (string, error)
- func IsPublicAuthEndpoint(path string) bool
- type AuthNMiddleware
- type AuthOrganizationsConfig
- type BaseIdentity
- func (i *BaseIdentity) GetIssuer() *identity.Issuer
- func (i *BaseIdentity) GetOrganizations() []ReportedOrganization
- func (i *BaseIdentity) GetUID() string
- func (i *BaseIdentity) GetUsername() string
- func (i *BaseIdentity) IsSuperAdmin() bool
- func (i *BaseIdentity) SetIssuer(issuer *identity.Issuer)
- func (i *BaseIdentity) SetOrganizations(organizations []ReportedOrganization)
- func (i *BaseIdentity) SetSuperAdmin(superAdmin bool)
- func (i *BaseIdentity) SetUID(uID string)
- func (i *BaseIdentity) SetUsername(username string)
- type ContextKey
- type Identity
- type K8sIdentity
- type K8sIdentityProvider
- type MockAuthNMiddleware
- func (m *MockAuthNMiddleware) EXPECT() *MockAuthNMiddlewareMockRecorder
- func (m *MockAuthNMiddleware) GetAuthConfig() *api.AuthConfig
- func (m *MockAuthNMiddleware) GetAuthToken(r *http.Request) (string, error)
- func (m *MockAuthNMiddleware) GetIdentity(ctx context.Context, token string) (Identity, error)
- func (m *MockAuthNMiddleware) IsEnabled() bool
- func (m *MockAuthNMiddleware) ValidateToken(ctx context.Context, token string) error
- type MockAuthNMiddlewareMockRecorder
- func (mr *MockAuthNMiddlewareMockRecorder) GetAuthConfig() *gomock.Call
- func (mr *MockAuthNMiddlewareMockRecorder) GetAuthToken(r any) *gomock.Call
- func (mr *MockAuthNMiddlewareMockRecorder) GetIdentity(ctx, token any) *gomock.Call
- func (mr *MockAuthNMiddlewareMockRecorder) ValidateToken(ctx, token any) *gomock.Call
- type MockIdentity
- func (m *MockIdentity) EXPECT() *MockIdentityMockRecorder
- func (m *MockIdentity) GetIssuer() *identity.Issuer
- func (m *MockIdentity) GetOrganizations() []ReportedOrganization
- func (m *MockIdentity) GetRoles() []string
- func (m *MockIdentity) GetUID() string
- func (m *MockIdentity) GetUsername() string
- type MockIdentityMockRecorder
- func (mr *MockIdentityMockRecorder) GetIssuer() *gomock.Call
- func (mr *MockIdentityMockRecorder) GetOrganizations() *gomock.Call
- func (mr *MockIdentityMockRecorder) GetRoles() *gomock.Call
- func (mr *MockIdentityMockRecorder) GetUID() *gomock.Call
- func (mr *MockIdentityMockRecorder) GetUsername() *gomock.Call
- type OpenShiftIdentity
- type ReportedOrganization
Constants ¶
const (
AuthHeader string = "Authorization"
)
Variables ¶
This section is empty.
Functions ¶
func IsPublicAuthEndpoint ¶ added in v1.0.0
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 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 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
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
func (m *MockAuthNMiddleware) EXPECT() *MockAuthNMiddlewareMockRecorder
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
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
func (m *MockIdentity) EXPECT() *MockIdentityMockRecorder
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
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