authz

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetricsGroup         = "metrics"
	UnauthenticatedGroup = "unauthenticated"
)

Variables

This section is empty.

Functions

func CheckMCPIDAccess added in v0.24.0

func CheckMCPIDAccess(ctx context.Context, client kclient.Client, acrHelper *accesscontrolrule.Helper, user kuser.Info, mcpID string) (bool, error)

func CheckVMCPComponentAccess added in v0.26.0

func CheckVMCPComponentAccess(ctx context.Context, u kuser.Info, ownerID string, entry *v1.MCPServerCatalogEntry, helper *accesscontrolrule.Helper, userInfo func(context.Context, uint) (kuser.Info, error)) error

CheckVMCPComponentAccess restricts personal vMCP components to accessible entries.

func IsClaudeEnvironment added in v0.27.0

func IsClaudeEnvironment(u kuser.Info) bool

IsClaudeEnvironment reports whether the authenticated caller holds a server-issued Claude runner credential. Use authenticated groups only, never client-supplied headers or MCP client names.

func IsCompositeMCPRequest added in v0.28.0

func IsCompositeMCPRequest(caller kuser.Info, mcpID string) bool

IsCompositeMCPRequest reports whether an authenticated principal is an internal composite caller explicitly scoped to mcpID. It does not replace resource access or component membership checks.

func IsMCPRegistryRequest added in v0.28.0

func IsMCPRegistryRequest(req *http.Request) bool

IsMCPRegistryRequest reports whether a request targets the MCP Registry API.

func IsVMCPAdministrator added in v0.26.0

func IsVMCPAdministrator(u kuser.Info) bool

func MCPIDIsAuthorized added in v0.24.0

func MCPIDIsAuthorized(ctx context.Context, client kclient.Client, authorizedMCPServers []string, userID, mcpID string) (bool, error)

func UserCanConnectToMCP added in v0.26.0

func UserCanConnectToMCP(ctx context.Context, client kclient.Client, acrHelper *accesscontrolrule.Helper, user kuser.Info, mcpID string) (bool, error)

UserCanConnectToMCP applies the same current-user authorization used by the MCP gateway. API handlers that act on an MCP deployment without traversing /mcp-connect must call this rather than relying on management visibility.

func UserCanConnectVMCP added in v0.26.0

func UserCanConnectVMCP(u kuser.Info, vmcp *v1.VMCP) bool

func UserCanManageVMCP added in v0.26.0

func UserCanManageVMCP(u kuser.Info, vmcp *v1.VMCP) bool

func UserCanReadCatalogEntry added in v0.26.0

func UserCanReadCatalogEntry(ctx context.Context, u kuser.Info, entry *v1.MCPServerCatalogEntry, helper *accesscontrolrule.Helper) (bool, error)

UserCanReadCatalogEntry checks access using the entry's stored scope.

func UserCanReadVMCP added in v0.26.0

func UserCanReadVMCP(u kuser.Info, vmcp *v1.VMCP) bool

UserCanReadVMCP applies the VMCP visibility model. A personal VMCP is only visible to its owner. A shared VMCP is visible to users matching at least one profile; catalog access is intentionally irrelevant.

func UserCanReadVMCPInstance added in v0.26.0

func UserCanReadVMCPInstance(u kuser.Info, instance *v1.VMCPInstance, vmcp *v1.VMCP) bool

func ValidateVMCPToolSelection added in v0.26.0

func ValidateVMCPToolSelection(u kuser.Info, vmcp *v1.VMCP, selection map[string]types.VMCPComponentSet) error

ValidateVMCPToolSelection rejects explicit selections outside the profile union.

Types

type Authorizer

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

func NewAuthorizer

func NewAuthorizer(gatewayClient *client.Client, cache, uncached kclient.Client, devMode bool, acrHelper *accesscontrolrule.Helper, skillHelper *skillaccessrule.Helper, registrySettings RegistrySettingsReader) *Authorizer

func (*Authorizer) Authorize

func (a *Authorizer) Authorize(req *http.Request, userInfo user.Info) bool

type GetVar added in v0.7.0

type GetVar func(string) string

type RegistrySettingsReader added in v0.28.0

type RegistrySettingsReader interface {
	AnonymousRegistryAccessEnabled(context.Context) (bool, error)
}

RegistrySettingsReader supplies shared, request-time anonymous discovery policy.

type Resources added in v0.7.0

type Resources struct {
	MCPServerID             string
	MCPServerInstanceID     string
	MCPServerCatalogEntryID string
	VMCPComponentMCPID      string
	VMCPID                  string
	VMCPInstanceID          string
	// MCPID identifies a vMCP, vMCP instance, or migrated alias. Internal requests may identify component servers or instances.
	MCPID              string
	WorkspaceID        string
	SkillID            string
	DeviceScanID       string
	OAuthAuthRequestID string
	Authorizated       ResourcesAuthorized
}

type ResourcesAuthorized added in v0.7.0

type ResourcesAuthorized struct {
	MCPServer             *v1.MCPServer
	MCPServerInstance     *v1.MCPServerInstance
	MCPServerCatalogEntry *v1.MCPServerCatalogEntry
	VMCP                  *v1.VMCP
	VMCPInstance          *v1.VMCPInstance
	PowerUserWorkspace    *v1.PowerUserWorkspace
	Skill                 *v1.Skill
}

type User added in v0.23.0

type User struct {
	kuser.Info

	IsAdmin   bool
	IsAuditor bool
	IsOwner   bool
}

Jump to

Keyboard shortcuts

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