oauth

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthMiddleware

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

AuthMiddleware handles OAuth authentication for HTTP requests

func NewAuthMiddleware

func NewAuthMiddleware(provider *AzureOAuthProvider, serverURL string) *AuthMiddleware

NewAuthMiddleware creates a new authentication middleware

func (*AuthMiddleware) Middleware

func (m *AuthMiddleware) Middleware(next http.Handler) http.Handler

Middleware returns an HTTP middleware function for OAuth authentication

type AzureADMetadata

type AzureADMetadata struct {
	Issuer                            string   `json:"issuer"`
	AuthorizationEndpoint             string   `json:"authorization_endpoint"`
	TokenEndpoint                     string   `json:"token_endpoint"`
	RegistrationEndpoint              string   `json:"registration_endpoint,omitempty"`
	JWKSUri                           string   `json:"jwks_uri"`
	ScopesSupported                   []string `json:"scopes_supported"`
	ResponseTypesSupported            []string `json:"response_types_supported"`
	GrantTypesSupported               []string `json:"grant_types_supported"`
	SubjectTypesSupported             []string `json:"subject_types_supported"`
	TokenEndpointAuthMethodsSupported []string `json:"token_endpoint_auth_methods_supported"`
	CodeChallengeMethodsSupported     []string `json:"code_challenge_methods_supported"`
}

AzureADMetadata represents Azure AD OAuth metadata

type AzureOAuthProvider

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

AzureOAuthProvider implements OAuth authentication for Azure AD

func NewAzureOAuthProvider

func NewAzureOAuthProvider(config *auth.OAuthConfig) (*AzureOAuthProvider, error)

NewAzureOAuthProvider creates a new Azure OAuth provider

func (*AzureOAuthProvider) GetAuthorizationServerMetadata

func (p *AzureOAuthProvider) GetAuthorizationServerMetadata(serverURL string) (*AzureADMetadata, error)

GetAuthorizationServerMetadata returns OAuth 2.0 Authorization Server Metadata (RFC 8414)

func (*AzureOAuthProvider) GetProtectedResourceMetadata

func (p *AzureOAuthProvider) GetProtectedResourceMetadata(serverURL string) (*ProtectedResourceMetadata, error)

GetProtectedResourceMetadata returns OAuth 2.0 Protected Resource Metadata (RFC 9728)

func (*AzureOAuthProvider) ValidateToken

func (p *AzureOAuthProvider) ValidateToken(ctx context.Context, tokenString string) (*auth.TokenInfo, error)

ValidateToken validates an OAuth access token

type ClientRegistrationRequest

type ClientRegistrationRequest struct {
	RedirectURIs            []string `json:"redirect_uris"`
	TokenEndpointAuthMethod string   `json:"token_endpoint_auth_method"`
	GrantTypes              []string `json:"grant_types"`
	ResponseTypes           []string `json:"response_types"`
	ClientName              string   `json:"client_name"`
	ClientURI               string   `json:"client_uri"`
	Scope                   string   `json:"scope"`
}

ClientRegistrationRequest represents OAuth 2.0 Dynamic Client Registration request (RFC 7591)

type EndpointManager

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

EndpointManager manages OAuth-related HTTP endpoints

func NewEndpointManager

func NewEndpointManager(provider *AzureOAuthProvider, cfg *config.ConfigData) *EndpointManager

NewEndpointManager creates a new OAuth endpoint manager

func (*EndpointManager) RegisterEndpoints

func (em *EndpointManager) RegisterEndpoints(mux *http.ServeMux)

RegisterEndpoints registers OAuth endpoints with the provided HTTP mux

type ProtectedResourceMetadata

type ProtectedResourceMetadata struct {
	AuthorizationServers []string `json:"authorization_servers"`
	Resource             string   `json:"resource"`
	ScopesSupported      []string `json:"scopes_supported"`
}

ProtectedResourceMetadata represents MCP protected resource metadata (RFC 9728 compliant)

type TokenResponse

type TokenResponse struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token,omitempty"`
	Scope        string `json:"scope,omitempty"`
}

TokenResponse represents the response from token exchange

Jump to

Keyboard shortcuts

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