auth

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticationProvider

type AuthenticationProvider interface {
	ValidateAuth(ctx context.Context) error

	// GetAuthenticatedMattermostClient returns an authenticated Mattermost client
	GetAuthenticatedMattermostClient(ctx context.Context) (*model.Client4, error)
}

AuthenticationProvider handles authentication for MCP requests

type ContextKey

type ContextKey string

Context keys for passing data through context

const (
	// AuthTokenContextKey is used to store the validated auth token in context
	AuthTokenContextKey ContextKey = "auth_token"
)

type OAuthAuthenticationProvider

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

OAuthAuthenticationProvider provides OAuth authentication for HTTP transport As a resource server, we only need to validate tokens using Mattermost's API

func NewOAuthAuthenticationProvider

func NewOAuthAuthenticationProvider(externalURL, internalURL, issuer string, logger mlog.LoggerIFace) *OAuthAuthenticationProvider

NewOAuthAuthenticationProvider creates a new OAuth authentication provider for resource server Uses internalURL for API communication if provided, otherwise falls back to externalURL

func (*OAuthAuthenticationProvider) GetAuthenticatedMattermostClient

func (p *OAuthAuthenticationProvider) GetAuthenticatedMattermostClient(ctx context.Context) (*model.Client4, error)

GetAuthenticatedMattermostClient returns an OAuth-authenticated Mattermost client

func (*OAuthAuthenticationProvider) ValidateAuth

func (p *OAuthAuthenticationProvider) ValidateAuth(ctx context.Context) error

ValidateAuth validates OAuth authentication from context

type TokenAuthenticationProvider

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

TokenAuthenticationProvider provides PAT token authentication for STDIO transport

func NewTokenAuthenticationProvider

func NewTokenAuthenticationProvider(externalURL, internalURL, token string, logger mlog.LoggerIFace) *TokenAuthenticationProvider

NewTokenAuthenticationProvider creates a new PAT token authentication provider for STDIO transport Uses internalURL for API communication if provided, otherwise falls back to externalURL

func (*TokenAuthenticationProvider) GetAuthenticatedMattermostClient

func (p *TokenAuthenticationProvider) GetAuthenticatedMattermostClient(ctx context.Context) (*model.Client4, error)

GetAuthenticatedMattermostClient returns an authenticated Mattermost client

func (*TokenAuthenticationProvider) ValidateAuth

func (p *TokenAuthenticationProvider) ValidateAuth(ctx context.Context) error

ValidateAuth validates authentication

Jump to

Keyboard shortcuts

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