Documentation
¶
Overview ¶
Package httpserver provides HTTP API handlers for HTCondor operations.
Package httpserver provides HTTP API handlers for HTCondor operations.
Index ¶
- Variables
- func ConfigureSecurityForToken(token string) (*security.SecurityConfig, error)
- func ConfigureSecurityForTokenWithCache(token string, sessionCache *security.SessionCache) (*security.SecurityConfig, error)
- func ConfigureSecurityForTokenWithCacheAndFallback(token string, sessionCache *security.SessionCache, allowFSFallback bool) (*security.SecurityConfig, error)
- func DefaultIDPSession(username string) *openid.DefaultSession
- func DefaultOpenIDConnectSession(username string) *openid.DefaultSession
- func GenerateSigningKey() ([]byte, error)
- func GetScheddWithToken(ctx context.Context, schedd *htcondor.Schedd) (*htcondor.Schedd, error)
- func GetSecurityConfigFromToken(ctx context.Context) (*security.SecurityConfig, error)
- func GetTokenFromContext(ctx context.Context) (string, bool)
- func WithToken(ctx context.Context, token string) context.Context
- type AdvertiseRequest
- type AdvertiseResponse
- type CollectorAdsResponse
- type Config
- type DeviceAuthorizationResponse
- type DeviceCodeHandler
- func (h *DeviceCodeHandler) HandleDeviceAccessRequest(ctx context.Context, deviceCode string, session fosite.Session) (fosite.Requester, error)
- func (h *DeviceCodeHandler) HandleDeviceAuthorizationRequest(ctx context.Context, client fosite.Client, scopes []string) (*DeviceAuthorizationResponse, error)
- type ErrorResponse
- type Handler
- func (h *Handler) GetOAuth2Provider() *OAuth2Provider
- func (h *Handler) GetSchedd() *htcondor.Schedd
- func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (h *Handler) SetupRoutes(setupFunc func(*http.ServeMux))
- func (h *Handler) Start(ctx context.Context, ln net.Listener, protocol string) error
- func (h *Handler) Stop(ctx context.Context) error
- func (h *Handler) UpdateOAuth2RedirectURL(redirectURL string)
- func (h *Handler) UpdateSchedd(newAddress string)
- type HandlerConfig
- type HistoryListResponse
- type IDPProvider
- type IDPStorage
- func (s *IDPStorage) AuthenticateUser(ctx context.Context, username, password string) error
- func (s *IDPStorage) ClientAssertionJWTValid(ctx context.Context, jti string) error
- func (s *IDPStorage) Close() error
- func (s *IDPStorage) CreateAccessTokenSession(ctx context.Context, signature string, request fosite.Requester) error
- func (s *IDPStorage) CreateAuthorizeCodeSession(ctx context.Context, signature string, request fosite.Requester) error
- func (s *IDPStorage) CreateClient(ctx context.Context, client *fosite.DefaultClient) error
- func (s *IDPStorage) CreateOpenIDConnectSession(ctx context.Context, signature string, requester fosite.Requester) error
- func (s *IDPStorage) CreatePKCERequestSession(ctx context.Context, signature string, request fosite.Requester) error
- func (s *IDPStorage) CreateRefreshTokenSession(ctx context.Context, signature string, request fosite.Requester) error
- func (s *IDPStorage) CreateSession(ctx context.Context, username string) (string, error)
- func (s *IDPStorage) CreateUser(ctx context.Context, username, password, state string) error
- func (s *IDPStorage) DeleteAccessTokenSession(ctx context.Context, signature string) error
- func (s *IDPStorage) DeleteOpenIDConnectSession(ctx context.Context, signature string) error
- func (s *IDPStorage) DeletePKCERequestSession(ctx context.Context, signature string) error
- func (s *IDPStorage) DeleteRefreshTokenSession(ctx context.Context, signature string) error
- func (s *IDPStorage) DeleteSession(ctx context.Context, sessionID string) error
- func (s *IDPStorage) GetAccessTokenSession(ctx context.Context, signature string, session fosite.Session) (fosite.Requester, error)
- func (s *IDPStorage) GetAuthorizeCodeSession(ctx context.Context, signature string, session fosite.Session) (fosite.Requester, error)
- func (s *IDPStorage) GetClient(ctx context.Context, clientID string) (fosite.Client, error)
- func (s *IDPStorage) GetOpenIDConnectSession(ctx context.Context, signature string, requester fosite.Requester) (fosite.Requester, error)
- func (s *IDPStorage) GetPKCERequestSession(ctx context.Context, signature string, session fosite.Session) (fosite.Requester, error)
- func (s *IDPStorage) GetRefreshTokenSession(ctx context.Context, signature string, session fosite.Session) (fosite.Requester, error)
- func (s *IDPStorage) GetSession(ctx context.Context, sessionID string) (string, error)
- func (s *IDPStorage) GetUserState(ctx context.Context, username string) (string, error)
- func (s *IDPStorage) InvalidateAuthorizeCodeSession(ctx context.Context, signature string) error
- func (s *IDPStorage) LoadHMACSecret(ctx context.Context) ([]byte, error)
- func (s *IDPStorage) LoadRSAKey(ctx context.Context) (string, error)
- func (s *IDPStorage) RevokeAccessToken(ctx context.Context, requestID string) error
- func (s *IDPStorage) RevokeRefreshToken(ctx context.Context, requestID string) error
- func (s *IDPStorage) RevokeRefreshTokenMaybeGracePeriod(ctx context.Context, requestID string, _ string) error
- func (s *IDPStorage) SaveHMACSecret(ctx context.Context, secret []byte) error
- func (s *IDPStorage) SaveRSAKey(ctx context.Context, privateKeyPEM string) error
- func (s *IDPStorage) SetClientAssertionJWT(ctx context.Context, jti string, exp time.Time) error
- func (s *IDPStorage) UserExists(ctx context.Context, username string) (bool, error)
- type JobActionFunc
- type JobEditRequest
- type JobListResponse
- type JobSubmitRequest
- type JobSubmitResponse
- type LoginRateLimiter
- type OAuth2Provider
- func (p *OAuth2Provider) Close() error
- func (p *OAuth2Provider) GetProvider() fosite.OAuth2Provider
- func (p *OAuth2Provider) GetStorage() *OAuth2Storage
- func (p *OAuth2Provider) GetStrategy() *compose.CommonStrategy
- func (p *OAuth2Provider) IntrospectToken(ctx context.Context, token string) (fosite.Session, error)
- func (p *OAuth2Provider) UpdateIssuer(issuer string)
- type OAuth2StateEntry
- type OAuth2StateStore
- func (s *OAuth2StateStore) GenerateState() (string, error)
- func (s *OAuth2StateStore) Get(state string) (fosite.AuthorizeRequester, bool)
- func (s *OAuth2StateStore) GetWithURL(state string) (fosite.AuthorizeRequester, string, bool)
- func (s *OAuth2StateStore) GetWithUsername(state string) (fosite.AuthorizeRequester, string, bool)
- func (s *OAuth2StateStore) Remove(state string)
- func (s *OAuth2StateStore) Start(ctx context.Context)
- func (s *OAuth2StateStore) Store(state string, ar fosite.AuthorizeRequester)
- func (s *OAuth2StateStore) StoreWithURL(state string, ar fosite.AuthorizeRequester, originalURL string)
- func (s *OAuth2StateStore) StoreWithUsername(state string, ar fosite.AuthorizeRequester, originalURL, username string)
- func (s *OAuth2StateStore) Wait()
- type OAuth2Storage
- func (s *OAuth2Storage) ApproveDeviceCodeSession(ctx context.Context, userCode string, subject string, session fosite.Session) error
- func (s *OAuth2Storage) ClientAssertionJWTValid(ctx context.Context, jti string) error
- func (s *OAuth2Storage) Close() error
- func (s *OAuth2Storage) CreateAccessTokenSession(ctx context.Context, signature string, request fosite.Requester) error
- func (s *OAuth2Storage) CreateAuthorizeCodeSession(ctx context.Context, signature string, request fosite.Requester) error
- func (s *OAuth2Storage) CreateClient(ctx context.Context, client *fosite.DefaultClient) error
- func (s *OAuth2Storage) CreateDeviceCodeSession(ctx context.Context, deviceCode string, userCode string, ...) error
- func (s *OAuth2Storage) CreateOpenIDConnectSession(ctx context.Context, signature string, requester fosite.Requester) error
- func (s *OAuth2Storage) CreatePKCERequestSession(ctx context.Context, signature string, request fosite.Requester) error
- func (s *OAuth2Storage) CreateRefreshTokenSession(ctx context.Context, signature string, request fosite.Requester) error
- func (s *OAuth2Storage) DeleteAccessTokenSession(ctx context.Context, signature string) error
- func (s *OAuth2Storage) DeleteOpenIDConnectSession(ctx context.Context, signature string) error
- func (s *OAuth2Storage) DeletePKCERequestSession(ctx context.Context, signature string) error
- func (s *OAuth2Storage) DeleteRefreshTokenSession(ctx context.Context, signature string) error
- func (s *OAuth2Storage) DenyDeviceCodeSession(ctx context.Context, userCode string) error
- func (s *OAuth2Storage) GetAccessTokenSession(ctx context.Context, signature string, session fosite.Session) (fosite.Requester, error)
- func (s *OAuth2Storage) GetAuthorizeCodeSession(ctx context.Context, signature string, session fosite.Session) (fosite.Requester, error)
- func (s *OAuth2Storage) GetClient(ctx context.Context, clientID string) (fosite.Client, error)
- func (s *OAuth2Storage) GetDB() *sql.DB
- func (s *OAuth2Storage) GetDeviceCodeSession(ctx context.Context, deviceCode string, session fosite.Session) (fosite.Requester, error)
- func (s *OAuth2Storage) GetDeviceCodeSessionByUserCode(ctx context.Context, userCode string) (string, fosite.Requester, error)
- func (s *OAuth2Storage) GetOpenIDConnectSession(ctx context.Context, signature string, requester fosite.Requester) (fosite.Requester, error)
- func (s *OAuth2Storage) GetPKCERequestSession(ctx context.Context, signature string, session fosite.Session) (fosite.Requester, error)
- func (s *OAuth2Storage) GetRefreshTokenSession(ctx context.Context, signature string, session fosite.Session) (fosite.Requester, error)
- func (s *OAuth2Storage) InvalidateAuthorizeCodeSession(ctx context.Context, signature string) error
- func (s *OAuth2Storage) InvalidateDeviceCodeSession(ctx context.Context, deviceCode string) error
- func (s *OAuth2Storage) LoadHMACSecret(ctx context.Context) ([]byte, error)
- func (s *OAuth2Storage) LoadRSAKey(ctx context.Context) (string, error)
- func (s *OAuth2Storage) RevokeAccessToken(ctx context.Context, requestID string) error
- func (s *OAuth2Storage) RevokeRefreshToken(ctx context.Context, requestID string) error
- func (s *OAuth2Storage) RevokeRefreshTokenMaybeGracePeriod(ctx context.Context, requestID string, _ string) error
- func (s *OAuth2Storage) SaveHMACSecret(ctx context.Context, secret []byte) error
- func (s *OAuth2Storage) SaveRSAKey(ctx context.Context, privateKeyPEM string) error
- func (s *OAuth2Storage) SetClientAssertionJWT(ctx context.Context, jti string, exp time.Time) error
- func (s *OAuth2Storage) UpdateDeviceCodePolling(ctx context.Context, deviceCode string) error
- type PingResponse
- type Server
- type SessionData
- type SessionStore
- type TokenCache
- func (tc *TokenCache) Add(token string) (*TokenCacheEntry, error)
- func (tc *TokenCache) AddValidated(token, username string, expiration time.Time) (*TokenCacheEntry, error)
- func (tc *TokenCache) Get(token string) (*TokenCacheEntry, bool)
- func (tc *TokenCache) Remove(token string)
- func (tc *TokenCache) Size() int
- type TokenCacheEntry
- type UserInfo
- type WhoAmIResponse
Constants ¶
This section is empty.
Variables ¶
var ( ErrAuthorizationPending = &fosite.RFC6749Error{ ErrorField: "authorization_pending", DescriptionField: "The authorization request is still pending", CodeField: http.StatusBadRequest, } ErrSlowDown = &fosite.RFC6749Error{ ErrorField: "slow_down", DescriptionField: "Client is polling too frequently", CodeField: http.StatusBadRequest, } ErrExpiredToken = &fosite.RFC6749Error{ ErrorField: "expired_token", DescriptionField: "The device code has expired", CodeField: http.StatusBadRequest, } )
Device flow error codes (RFC 8628)
Functions ¶
func ConfigureSecurityForToken ¶
func ConfigureSecurityForToken(token string) (*security.SecurityConfig, error)
ConfigureSecurityForToken configures security settings to use the provided token This is a helper function to set up cedar's security configuration for TOKEN authentication
func ConfigureSecurityForTokenWithCache ¶ added in v0.0.3
func ConfigureSecurityForTokenWithCache(token string, sessionCache *security.SessionCache) (*security.SecurityConfig, error)
ConfigureSecurityForTokenWithCache configures security settings with an optional session cache If sessionCache is nil, the global cache will be used
func ConfigureSecurityForTokenWithCacheAndFallback ¶ added in v0.0.4
func ConfigureSecurityForTokenWithCacheAndFallback(token string, sessionCache *security.SessionCache, allowFSFallback bool) (*security.SecurityConfig, error)
ConfigureSecurityForTokenWithCacheAndFallback configures security settings with optional session cache and optional FS authentication fallback. If allowFSFallback is true, FS authentication will be added as a fallback method (used for user-header mode where tokens are generated but not validated by schedd). If allowFSFallback is false, only TOKEN authentication is used (for session-based authentication with properly signed and validated tokens).
func DefaultIDPSession ¶ added in v0.0.4
func DefaultIDPSession(username string) *openid.DefaultSession
DefaultIDPSession creates a default OpenID Connect session for IDP
func DefaultOpenIDConnectSession ¶ added in v0.0.3
func DefaultOpenIDConnectSession(username string) *openid.DefaultSession
DefaultOpenIDConnectSession creates a default OpenID Connect session
func GenerateSigningKey ¶
GenerateSigningKey generates a new signing key for token generation Returns the key content as bytes
func GetScheddWithToken ¶
GetScheddWithToken creates a schedd connection configured with token authentication This wraps the schedd to use token authentication from context
func GetSecurityConfigFromToken ¶
func GetSecurityConfigFromToken(ctx context.Context) (*security.SecurityConfig, error)
GetSecurityConfigFromToken retrieves the token from context and creates a SecurityConfig This is a convenience function for HTTP handlers to convert context token to SecurityConfig
func GetTokenFromContext ¶
GetTokenFromContext retrieves the token from the context
Types ¶
type AdvertiseRequest ¶ added in v0.0.4
type AdvertiseRequest struct {
Ad *classad.ClassAd `json:"ad,omitempty"` // Single ad (JSON body)
Command string `json:"command,omitempty"` // Optional UPDATE command (e.g., "UPDATE_STARTD_AD")
WithAck bool `json:"with_ack,omitempty"` // Request acknowledgment
}
AdvertiseRequest represents a request to advertise to the collector
type AdvertiseResponse ¶ added in v0.0.4
type AdvertiseResponse struct {
Success bool `json:"success"`
Message string `json:"message,omitempty"`
Succeeded int `json:"succeeded"` // Number of ads successfully advertised
Failed int `json:"failed"` // Number of ads that failed
Errors []string `json:"errors,omitempty"` // Error messages for failed ads
}
AdvertiseResponse represents the response from advertise
type CollectorAdsResponse ¶ added in v0.0.3
CollectorAdsResponse represents collector ads listing response
type Config ¶
type Config struct {
ListenAddr string // Address to listen on (e.g., ":8080")
ScheddName string // Schedd name
ScheddAddr string // Schedd address (e.g., "127.0.0.1:9618"). If empty, discovered from collector.
UserHeader string // HTTP header to extract username from (optional)
SigningKeyPath string // Path to token signing key (optional, for token generation)
TrustDomain string // Trust domain for token issuer (optional; only used if UserHeader is set)
UIDDomain string // UID domain for generated token username (optional; only used if UserHeader is set)
HTTPBaseURL string // Base URL for HTTP API (e.g., "http://localhost:8080") for generating file download links in MCP responses
TLSCertFile string // Path to TLS certificate file (optional, enables HTTPS)
TLSKeyFile string // Path to TLS key file (optional, enables HTTPS)
TLSCACertFile string // Path to TLS CA certificate file (optional, for trusting self-signed certs)
ReadTimeout time.Duration // HTTP read timeout (default: 30s)
WriteTimeout time.Duration // HTTP write timeout (default: 30s)
IdleTimeout time.Duration // HTTP idle timeout (default: 120s)
Collector *htcondor.Collector // Collector for metrics (optional)
EnableMetrics bool // Enable /metrics endpoint (default: true if Collector is set)
MetricsCacheTTL time.Duration // Metrics cache TTL (default: 10s)
Logger *logging.Logger // Logger instance (optional, creates default if nil)
EnableMCP bool // Enable MCP endpoints with OAuth2 (default: false)
OAuth2DBPath string // Path to OAuth2 SQLite database (default: LOCAL_DIR/oauth2.db or /var/lib/condor/oauth2.db). Can be configured via HTTP_API_OAUTH2_DB_PATH
OAuth2Issuer string // OAuth2 issuer URL (default: listen address)
OAuth2ClientID string // OAuth2 client ID for SSO (optional)
OAuth2ClientSecret string // OAuth2 client secret for SSO (optional)
OAuth2AuthURL string // OAuth2 authorization URL for SSO (optional)
OAuth2TokenURL string // OAuth2 token URL for SSO (optional)
OAuth2RedirectURL string // OAuth2 redirect URL for SSO (optional)
OAuth2UserInfoURL string // OAuth2 user info endpoint for SSO (optional)
OAuth2Scopes []string // OAuth2 scopes to request (default: ["openid", "profile", "email"])
OAuth2UsernameClaim string // Claim name for username in token (default: "sub")
OAuth2GroupsClaim string // Claim name for groups in user info (default: "groups")
MCPAccessGroup string // Group required for any MCP access (empty = all authenticated)
MCPReadGroup string // Group required for read operations (empty = all have read)
MCPWriteGroup string // Group required for write operations (empty = all have write)
EnableIDP bool // Enable built-in IDP (always enabled in demo mode)
IDPDBPath string // Path to IDP SQLite database (default: "idp.db")
IDPIssuer string // IDP issuer URL (default: listen address)
SessionTTL time.Duration // HTTP session TTL (default: 24h)
HTCondorConfig *config.Config // HTCondor configuration (optional, used for LOCAL_DIR default)
PingInterval time.Duration // Interval for periodic daemon pings (default: 1 minute, 0 = disabled)
StreamBufferSize int // Buffer size for streaming queries (default: 100)
StreamWriteTimeout time.Duration // Write timeout for streaming queries (default: 5s)
Token string // Token for daemon authentication (optional)
Credd htcondor.CreddClient // Optional credd client; defaults to in-memory implementation
}
Config holds server configuration
type DeviceAuthorizationResponse ¶ added in v0.0.4
type DeviceAuthorizationResponse struct {
DeviceCode string `json:"device_code"`
UserCode string `json:"user_code"`
VerificationURI string `json:"verification_uri"`
VerificationURIComplete string `json:"verification_uri_complete,omitempty"`
ExpiresIn int `json:"expires_in"`
Interval int `json:"interval,omitempty"`
}
DeviceAuthorizationResponse represents the response from device authorization endpoint
type DeviceCodeHandler ¶ added in v0.0.4
type DeviceCodeHandler struct {
// contains filtered or unexported fields
}
DeviceCodeHandler implements the OAuth 2.0 Device Authorization Grant (RFC 8628)
func NewDeviceCodeHandler ¶ added in v0.0.4
func NewDeviceCodeHandler(storage *OAuth2Storage, config *fosite.Config) *DeviceCodeHandler
NewDeviceCodeHandler creates a new device code handler
func (*DeviceCodeHandler) HandleDeviceAccessRequest ¶ added in v0.0.4
func (h *DeviceCodeHandler) HandleDeviceAccessRequest(ctx context.Context, deviceCode string, session fosite.Session) (fosite.Requester, error)
HandleDeviceAccessRequest handles token requests with device_code grant type
func (*DeviceCodeHandler) HandleDeviceAuthorizationRequest ¶ added in v0.0.4
func (h *DeviceCodeHandler) HandleDeviceAuthorizationRequest(ctx context.Context, client fosite.Client, scopes []string) (*DeviceAuthorizationResponse, error)
HandleDeviceAuthorizationRequest handles the device authorization endpoint
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
Message string `json:"message,omitempty"`
Code int `json:"code"`
}
ErrorResponse represents an error response body
type Handler ¶ added in v0.0.7
type Handler struct {
// contains filtered or unexported fields
}
Handler represents the HTTP API handler that can be embedded in any HTTP server
func NewHandler ¶ added in v0.0.7
func NewHandler(cfg HandlerConfig) (*Handler, error)
NewHandler creates a new HTTP API handler that can be embedded in any HTTP server
func (*Handler) GetOAuth2Provider ¶ added in v0.0.7
func (h *Handler) GetOAuth2Provider() *OAuth2Provider
GetOAuth2Provider returns the OAuth2 provider (for testing)
func (*Handler) GetSchedd ¶ added in v0.0.7
GetSchedd returns the current schedd instance (thread-safe)
func (*Handler) ServeHTTP ¶ added in v0.0.7
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler interface
func (*Handler) SetupRoutes ¶ added in v0.0.7
SetupRoutes sets up the HTTP routes on the handler's multiplexer This should be called by Server.NewServer or by users who create a Handler directly
func (*Handler) Start ¶ added in v0.0.7
Start initializes the handler and starts background goroutines. The provided context controls the handler's lifetime - when the context is cancelled, the handler will gracefully shut down all background goroutines.
This method should be called by Server.Start() or Server.StartTLS() before serving requests.
func (*Handler) Stop ¶ added in v0.0.7
Stop gracefully stops all background goroutines and closes providers. This method is called when the handler's context is cancelled (via Server.Shutdown). The background goroutines are responsible for watching their context and exiting when done.
func (*Handler) UpdateOAuth2RedirectURL ¶ added in v0.0.7
UpdateOAuth2RedirectURL updates the OAuth2 redirect URL for SSO integration
func (*Handler) UpdateSchedd ¶ added in v0.0.7
UpdateSchedd updates the schedd instance with a new address (thread-safe)
type HandlerConfig ¶ added in v0.0.7
type HandlerConfig struct {
ScheddName string // Schedd name
ScheddAddr string // Schedd address (e.g., "127.0.0.1:9618"). If empty, discovered from collector.
UserHeader string // HTTP header to extract username from (optional)
SigningKeyPath string // Path to token signing key (optional, for token generation)
TrustDomain string // Trust domain for token issuer (optional; only used if UserHeader is set)
UIDDomain string // UID domain for generated token username (optional; only used if UserHeader is set)
HTTPBaseURL string // Base URL for HTTP API (e.g., "http://localhost:8080") for generating file download links in MCP responses
TLSCACertFile string // Path to TLS CA certificate file (optional, for trusting self-signed certs)
Collector *htcondor.Collector // Collector for metrics (optional)
EnableMetrics bool // Enable /metrics endpoint (default: true if Collector is set)
MetricsCacheTTL time.Duration // Metrics cache TTL (default: 10s)
Logger *logging.Logger // Logger instance (optional, creates default if nil)
EnableMCP bool // Enable MCP endpoints with OAuth2 (default: false)
OAuth2DBPath string // Path to OAuth2 SQLite database (default: LOCAL_DIR/oauth2.db or /var/lib/condor/oauth2.db). Can be configured via HTTP_API_OAUTH2_DB_PATH
OAuth2Issuer string // OAuth2 issuer URL (default: listen address)
OAuth2ClientID string // OAuth2 client ID for SSO (optional)
OAuth2ClientSecret string // OAuth2 client secret for SSO (optional)
OAuth2AuthURL string // OAuth2 authorization URL for SSO (optional)
OAuth2TokenURL string // OAuth2 token URL for SSO (optional)
OAuth2RedirectURL string // OAuth2 redirect URL for SSO (optional)
OAuth2UserInfoURL string // OAuth2 user info endpoint for SSO (optional)
OAuth2Scopes []string // OAuth2 scopes to request (default: ["openid", "profile", "email"])
OAuth2UsernameClaim string // Claim name for username in token (default: "sub")
OAuth2GroupsClaim string // Claim name for groups in user info (default: "groups")
MCPAccessGroup string // Group required for any MCP access (empty = all authenticated)
MCPReadGroup string // Group required for read operations (empty = all have read)
MCPWriteGroup string // Group required for write operations (empty = all have write)
EnableIDP bool // Enable built-in IDP (always enabled in demo mode)
IDPDBPath string // Path to IDP SQLite database (default: "idp.db")
IDPIssuer string // IDP issuer URL (default: listen address)
SessionTTL time.Duration // HTTP session TTL (default: 24h)
HTCondorConfig *config.Config // HTCondor configuration (optional, used for LOCAL_DIR default)
PingInterval time.Duration // Interval for periodic daemon pings (default: 1 minute, 0 = disabled)
StreamBufferSize int // Buffer size for streaming queries (default: 100)
StreamWriteTimeout time.Duration // Write timeout for streaming queries (default: 5s)
Token string // Token for daemon authentication (optional)
Credd htcondor.CreddClient // Optional credd client; defaults to in-memory implementation
}
HandlerConfig holds handler configuration
type HistoryListResponse ¶ added in v0.0.4
HistoryListResponse represents a history listing response
type IDPProvider ¶ added in v0.0.4
type IDPProvider struct {
// contains filtered or unexported fields
}
IDPProvider manages OAuth2 operations for the built-in IDP
func NewIDPProvider ¶ added in v0.0.4
func NewIDPProvider(dbPath string, issuer string) (*IDPProvider, error)
NewIDPProvider creates a new IDP provider with SQLite storage
func (*IDPProvider) Close ¶ added in v0.0.4
func (p *IDPProvider) Close() error
Close closes the IDP provider and its storage
func (*IDPProvider) GetProvider ¶ added in v0.0.4
func (p *IDPProvider) GetProvider() fosite.OAuth2Provider
GetProvider returns the underlying fosite OAuth2Provider
func (*IDPProvider) GetStorage ¶ added in v0.0.4
func (p *IDPProvider) GetStorage() *IDPStorage
GetStorage returns the IDP storage
func (*IDPProvider) GetStrategy ¶ added in v0.0.4
func (p *IDPProvider) GetStrategy() *compose.CommonStrategy
GetStrategy returns the OAuth2 strategy
func (*IDPProvider) UpdateIssuer ¶ added in v0.0.4
func (p *IDPProvider) UpdateIssuer(issuer string)
UpdateIssuer updates the issuer URL in the OAuth2 config
type IDPStorage ¶ added in v0.0.4
type IDPStorage struct {
// contains filtered or unexported fields
}
IDPStorage implements fosite storage interfaces using SQLite for the built-in IDP It uses separate tables from the MCP OAuth2 storage
func NewIDPStorage ¶ added in v0.0.4
func NewIDPStorage(dbPath string) (*IDPStorage, error)
NewIDPStorage creates a new IDP storage backed by SQLite
func (*IDPStorage) AuthenticateUser ¶ added in v0.0.4
func (s *IDPStorage) AuthenticateUser(ctx context.Context, username, password string) error
AuthenticateUser verifies username and password
func (*IDPStorage) ClientAssertionJWTValid ¶ added in v0.0.4
func (s *IDPStorage) ClientAssertionJWTValid(ctx context.Context, jti string) error
ClientAssertionJWTValid implements fosite.ClientAssertionJWTValid interface
func (*IDPStorage) Close ¶ added in v0.0.4
func (s *IDPStorage) Close() error
Close closes the database connection
func (*IDPStorage) CreateAccessTokenSession ¶ added in v0.0.4
func (s *IDPStorage) CreateAccessTokenSession(ctx context.Context, signature string, request fosite.Requester) error
CreateAccessTokenSession stores an access token session
func (*IDPStorage) CreateAuthorizeCodeSession ¶ added in v0.0.4
func (s *IDPStorage) CreateAuthorizeCodeSession(ctx context.Context, signature string, request fosite.Requester) error
CreateAuthorizeCodeSession stores an authorization code session
func (*IDPStorage) CreateClient ¶ added in v0.0.4
func (s *IDPStorage) CreateClient(ctx context.Context, client *fosite.DefaultClient) error
CreateClient creates a new OAuth2 client
func (*IDPStorage) CreateOpenIDConnectSession ¶ added in v0.0.4
func (s *IDPStorage) CreateOpenIDConnectSession(ctx context.Context, signature string, requester fosite.Requester) error
CreateOpenIDConnectSession implements openid.OpenIDConnectRequestStorage interface
func (*IDPStorage) CreatePKCERequestSession ¶ added in v0.0.4
func (s *IDPStorage) CreatePKCERequestSession(ctx context.Context, signature string, request fosite.Requester) error
CreatePKCERequestSession stores a PKCE request session
func (*IDPStorage) CreateRefreshTokenSession ¶ added in v0.0.4
func (s *IDPStorage) CreateRefreshTokenSession(ctx context.Context, signature string, request fosite.Requester) error
CreateRefreshTokenSession stores a refresh token session
func (*IDPStorage) CreateSession ¶ added in v0.0.4
CreateSession creates a new session for the given username
func (*IDPStorage) CreateUser ¶ added in v0.0.4
func (s *IDPStorage) CreateUser(ctx context.Context, username, password, state string) error
CreateUser creates a new user with hashed password and specified state
func (*IDPStorage) DeleteAccessTokenSession ¶ added in v0.0.4
func (s *IDPStorage) DeleteAccessTokenSession(ctx context.Context, signature string) error
DeleteAccessTokenSession deletes an access token session
func (*IDPStorage) DeleteOpenIDConnectSession ¶ added in v0.0.4
func (s *IDPStorage) DeleteOpenIDConnectSession(ctx context.Context, signature string) error
DeleteOpenIDConnectSession implements openid.OpenIDConnectRequestStorage interface
func (*IDPStorage) DeletePKCERequestSession ¶ added in v0.0.4
func (s *IDPStorage) DeletePKCERequestSession(ctx context.Context, signature string) error
DeletePKCERequestSession deletes a PKCE request session
func (*IDPStorage) DeleteRefreshTokenSession ¶ added in v0.0.4
func (s *IDPStorage) DeleteRefreshTokenSession(ctx context.Context, signature string) error
DeleteRefreshTokenSession deletes a refresh token session
func (*IDPStorage) DeleteSession ¶ added in v0.0.4
func (s *IDPStorage) DeleteSession(ctx context.Context, sessionID string) error
DeleteSession deletes a session
func (*IDPStorage) GetAccessTokenSession ¶ added in v0.0.4
func (s *IDPStorage) GetAccessTokenSession(ctx context.Context, signature string, session fosite.Session) (fosite.Requester, error)
GetAccessTokenSession retrieves an access token session
func (*IDPStorage) GetAuthorizeCodeSession ¶ added in v0.0.4
func (s *IDPStorage) GetAuthorizeCodeSession(ctx context.Context, signature string, session fosite.Session) (fosite.Requester, error)
GetAuthorizeCodeSession retrieves an authorization code session
func (*IDPStorage) GetOpenIDConnectSession ¶ added in v0.0.4
func (s *IDPStorage) GetOpenIDConnectSession(ctx context.Context, signature string, requester fosite.Requester) (fosite.Requester, error)
GetOpenIDConnectSession implements openid.OpenIDConnectRequestStorage interface
func (*IDPStorage) GetPKCERequestSession ¶ added in v0.0.4
func (s *IDPStorage) GetPKCERequestSession(ctx context.Context, signature string, session fosite.Session) (fosite.Requester, error)
GetPKCERequestSession retrieves a PKCE request session
func (*IDPStorage) GetRefreshTokenSession ¶ added in v0.0.4
func (s *IDPStorage) GetRefreshTokenSession(ctx context.Context, signature string, session fosite.Session) (fosite.Requester, error)
GetRefreshTokenSession retrieves a refresh token session
func (*IDPStorage) GetSession ¶ added in v0.0.4
GetSession retrieves the username for a given session ID
func (*IDPStorage) GetUserState ¶ added in v0.0.4
GetUserState retrieves the state of a user
func (*IDPStorage) InvalidateAuthorizeCodeSession ¶ added in v0.0.4
func (s *IDPStorage) InvalidateAuthorizeCodeSession(ctx context.Context, signature string) error
InvalidateAuthorizeCodeSession invalidates an authorization code
func (*IDPStorage) LoadHMACSecret ¶ added in v0.0.4
func (s *IDPStorage) LoadHMACSecret(ctx context.Context) ([]byte, error)
LoadHMACSecret loads the HMAC secret
func (*IDPStorage) LoadRSAKey ¶ added in v0.0.4
func (s *IDPStorage) LoadRSAKey(ctx context.Context) (string, error)
LoadRSAKey loads the RSA private key in PEM format
func (*IDPStorage) RevokeAccessToken ¶ added in v0.0.4
func (s *IDPStorage) RevokeAccessToken(ctx context.Context, requestID string) error
RevokeAccessToken revokes an access token
func (*IDPStorage) RevokeRefreshToken ¶ added in v0.0.4
func (s *IDPStorage) RevokeRefreshToken(ctx context.Context, requestID string) error
RevokeRefreshToken revokes a refresh token
func (*IDPStorage) RevokeRefreshTokenMaybeGracePeriod ¶ added in v0.0.4
func (s *IDPStorage) RevokeRefreshTokenMaybeGracePeriod(ctx context.Context, requestID string, _ string) error
RevokeRefreshTokenMaybeGracePeriod implements fosite.TokenRevocationStorage interface
func (*IDPStorage) SaveHMACSecret ¶ added in v0.0.4
func (s *IDPStorage) SaveHMACSecret(ctx context.Context, secret []byte) error
SaveHMACSecret stores the HMAC secret
func (*IDPStorage) SaveRSAKey ¶ added in v0.0.4
func (s *IDPStorage) SaveRSAKey(ctx context.Context, privateKeyPEM string) error
SaveRSAKey stores the RSA private key in PEM format
func (*IDPStorage) SetClientAssertionJWT ¶ added in v0.0.4
SetClientAssertionJWT implements fosite.SetClientAssertionJWT interface
func (*IDPStorage) UserExists ¶ added in v0.0.4
UserExists checks if a user exists
type JobActionFunc ¶ added in v0.0.3
type JobActionFunc func(ctx context.Context, constraint, reason string) (*htcondor.JobActionResults, error)
JobActionFunc is a function that performs a job action (hold, release, etc.)
type JobEditRequest ¶ added in v0.0.4
type JobEditRequest struct {
Attributes map[string]interface{} `json:"attributes"` // Attributes to update
}
JobEditRequest represents a job edit request
type JobListResponse ¶
JobListResponse represents a job listing response
type JobSubmitRequest ¶
type JobSubmitRequest struct {
SubmitFile string `json:"submit_file"` // Submit file content
}
JobSubmitRequest represents a job submission request
type JobSubmitResponse ¶
type JobSubmitResponse struct {
ClusterID int `json:"cluster_id"`
JobIDs []string `json:"job_ids"` // Array of "cluster.proc" strings
}
JobSubmitResponse represents a job submission response
type LoginRateLimiter ¶ added in v0.0.4
type LoginRateLimiter struct {
// contains filtered or unexported fields
}
LoginRateLimiter manages rate limiting for login attempts per IP address
func NewLoginRateLimiter ¶ added in v0.0.4
func NewLoginRateLimiter(r rate.Limit, b int) *LoginRateLimiter
NewLoginRateLimiter creates a new login rate limiter rate: maximum requests per second per IP burst: maximum burst size per IP
func (*LoginRateLimiter) Allow ¶ added in v0.0.4
func (l *LoginRateLimiter) Allow(ip string) bool
Allow checks if a login attempt from the given IP is allowed
type OAuth2Provider ¶ added in v0.0.3
type OAuth2Provider struct {
// contains filtered or unexported fields
}
OAuth2Provider manages OAuth2 operations
func NewOAuth2Provider ¶ added in v0.0.3
func NewOAuth2Provider(dbPath string, issuer string) (*OAuth2Provider, error)
NewOAuth2Provider creates a new OAuth2 provider with SQLite storage
func (*OAuth2Provider) Close ¶ added in v0.0.3
func (p *OAuth2Provider) Close() error
Close closes the OAuth2 provider and its storage
func (*OAuth2Provider) GetProvider ¶ added in v0.0.3
func (p *OAuth2Provider) GetProvider() fosite.OAuth2Provider
GetProvider returns the underlying fosite OAuth2Provider
func (*OAuth2Provider) GetStorage ¶ added in v0.0.3
func (p *OAuth2Provider) GetStorage() *OAuth2Storage
GetStorage returns the OAuth2 storage
func (*OAuth2Provider) GetStrategy ¶ added in v0.0.4
func (p *OAuth2Provider) GetStrategy() *compose.CommonStrategy
GetStrategy returns the OAuth2 strategy
func (*OAuth2Provider) IntrospectToken ¶ added in v0.0.4
IntrospectToken validates an access token and returns the session
func (*OAuth2Provider) UpdateIssuer ¶ added in v0.0.4
func (p *OAuth2Provider) UpdateIssuer(issuer string)
UpdateIssuer updates the issuer URL in the configuration This is useful when using port 0 and getting the actual port after server start
type OAuth2StateEntry ¶ added in v0.0.3
type OAuth2StateEntry struct {
AuthorizeRequest fosite.AuthorizeRequester
Timestamp time.Time
OriginalURL string // Original URL to redirect back to after authentication
Username string // Authenticated username for consent flow
}
OAuth2StateEntry represents a stored OAuth2 authorization state
type OAuth2StateStore ¶ added in v0.0.3
type OAuth2StateStore struct {
// contains filtered or unexported fields
}
OAuth2StateStore manages OAuth2 state parameters for the authorization flow
func NewOAuth2StateStore ¶ added in v0.0.3
func NewOAuth2StateStore() *OAuth2StateStore
NewOAuth2StateStore creates a new OAuth2 state store Call Start() to begin the cleanup goroutine
func (*OAuth2StateStore) GenerateState ¶ added in v0.0.3
func (s *OAuth2StateStore) GenerateState() (string, error)
GenerateState generates a secure random state parameter
func (*OAuth2StateStore) Get ¶ added in v0.0.3
func (s *OAuth2StateStore) Get(state string) (fosite.AuthorizeRequester, bool)
Get retrieves and removes an authorize request for the given state
func (*OAuth2StateStore) GetWithURL ¶ added in v0.0.4
func (s *OAuth2StateStore) GetWithURL(state string) (fosite.AuthorizeRequester, string, bool)
GetWithURL retrieves and removes an authorize request for the given state along with the original URL
func (*OAuth2StateStore) GetWithUsername ¶ added in v0.0.4
func (s *OAuth2StateStore) GetWithUsername(state string) (fosite.AuthorizeRequester, string, bool)
GetWithUsername retrieves an authorize request for the given state along with username (without removing)
func (*OAuth2StateStore) Remove ¶ added in v0.0.4
func (s *OAuth2StateStore) Remove(state string)
Remove removes an entry for the given state
func (*OAuth2StateStore) Start ¶ added in v0.0.7
func (s *OAuth2StateStore) Start(ctx context.Context)
Start begins the cleanup goroutine
func (*OAuth2StateStore) Store ¶ added in v0.0.3
func (s *OAuth2StateStore) Store(state string, ar fosite.AuthorizeRequester)
Store stores an authorize request with the given state
func (*OAuth2StateStore) StoreWithURL ¶ added in v0.0.4
func (s *OAuth2StateStore) StoreWithURL(state string, ar fosite.AuthorizeRequester, originalURL string)
StoreWithURL stores an authorize request with the given state and original URL
func (*OAuth2StateStore) StoreWithUsername ¶ added in v0.0.4
func (s *OAuth2StateStore) StoreWithUsername(state string, ar fosite.AuthorizeRequester, originalURL, username string)
StoreWithUsername stores an authorize request with the given state, original URL, and username
func (*OAuth2StateStore) Wait ¶ added in v0.0.7
func (s *OAuth2StateStore) Wait()
Wait waits for the cleanup goroutine to finish
type OAuth2Storage ¶ added in v0.0.3
type OAuth2Storage struct {
// contains filtered or unexported fields
}
OAuth2Storage implements fosite storage interfaces using SQLite
func NewOAuth2Storage ¶ added in v0.0.3
func NewOAuth2Storage(dbPath string) (*OAuth2Storage, error)
NewOAuth2Storage creates a new OAuth2 storage backed by SQLite
func (*OAuth2Storage) ApproveDeviceCodeSession ¶ added in v0.0.4
func (s *OAuth2Storage) ApproveDeviceCodeSession(ctx context.Context, userCode string, subject string, session fosite.Session) error
ApproveDeviceCodeSession approves a device code (user authorized the device)
func (*OAuth2Storage) ClientAssertionJWTValid ¶ added in v0.0.3
func (s *OAuth2Storage) ClientAssertionJWTValid(ctx context.Context, jti string) error
ClientAssertionJWTValid implements fosite.ClientAssertionJWTValid interface This checks if a JWT ID (JTI) has already been used to prevent replay attacks
func (*OAuth2Storage) Close ¶ added in v0.0.3
func (s *OAuth2Storage) Close() error
Close closes the database connection
func (*OAuth2Storage) CreateAccessTokenSession ¶ added in v0.0.3
func (s *OAuth2Storage) CreateAccessTokenSession(ctx context.Context, signature string, request fosite.Requester) error
CreateAccessTokenSession stores an access token session
func (*OAuth2Storage) CreateAuthorizeCodeSession ¶ added in v0.0.3
func (s *OAuth2Storage) CreateAuthorizeCodeSession(ctx context.Context, signature string, request fosite.Requester) error
CreateAuthorizeCodeSession stores an authorization code session
func (*OAuth2Storage) CreateClient ¶ added in v0.0.3
func (s *OAuth2Storage) CreateClient(ctx context.Context, client *fosite.DefaultClient) error
CreateClient creates a new OAuth2 client
func (*OAuth2Storage) CreateDeviceCodeSession ¶ added in v0.0.4
func (s *OAuth2Storage) CreateDeviceCodeSession(ctx context.Context, deviceCode string, userCode string, request fosite.Requester, expiresAt time.Time) error
CreateDeviceCodeSession creates a new device code session
func (*OAuth2Storage) CreateOpenIDConnectSession ¶ added in v0.0.3
func (s *OAuth2Storage) CreateOpenIDConnectSession(ctx context.Context, signature string, requester fosite.Requester) error
CreateOpenIDConnectSession implements openid.OpenIDConnectRequestStorage interface
func (*OAuth2Storage) CreatePKCERequestSession ¶ added in v0.0.4
func (s *OAuth2Storage) CreatePKCERequestSession(ctx context.Context, signature string, request fosite.Requester) error
CreatePKCERequestSession stores a PKCE request session
func (*OAuth2Storage) CreateRefreshTokenSession ¶ added in v0.0.3
func (s *OAuth2Storage) CreateRefreshTokenSession(ctx context.Context, signature string, request fosite.Requester) error
CreateRefreshTokenSession stores a refresh token session
func (*OAuth2Storage) DeleteAccessTokenSession ¶ added in v0.0.3
func (s *OAuth2Storage) DeleteAccessTokenSession(ctx context.Context, signature string) error
DeleteAccessTokenSession deletes an access token session
func (*OAuth2Storage) DeleteOpenIDConnectSession ¶ added in v0.0.3
func (s *OAuth2Storage) DeleteOpenIDConnectSession(ctx context.Context, signature string) error
DeleteOpenIDConnectSession implements openid.OpenIDConnectRequestStorage interface
func (*OAuth2Storage) DeletePKCERequestSession ¶ added in v0.0.4
func (s *OAuth2Storage) DeletePKCERequestSession(ctx context.Context, signature string) error
DeletePKCERequestSession deletes a PKCE request session
func (*OAuth2Storage) DeleteRefreshTokenSession ¶ added in v0.0.3
func (s *OAuth2Storage) DeleteRefreshTokenSession(ctx context.Context, signature string) error
DeleteRefreshTokenSession deletes a refresh token session
func (*OAuth2Storage) DenyDeviceCodeSession ¶ added in v0.0.4
func (s *OAuth2Storage) DenyDeviceCodeSession(ctx context.Context, userCode string) error
DenyDeviceCodeSession denies a device code (user rejected the device)
func (*OAuth2Storage) GetAccessTokenSession ¶ added in v0.0.3
func (s *OAuth2Storage) GetAccessTokenSession(ctx context.Context, signature string, session fosite.Session) (fosite.Requester, error)
GetAccessTokenSession retrieves an access token session
func (*OAuth2Storage) GetAuthorizeCodeSession ¶ added in v0.0.3
func (s *OAuth2Storage) GetAuthorizeCodeSession(ctx context.Context, signature string, session fosite.Session) (fosite.Requester, error)
GetAuthorizeCodeSession retrieves an authorization code session
func (*OAuth2Storage) GetDB ¶ added in v0.0.4
func (s *OAuth2Storage) GetDB() *sql.DB
GetDB returns the underlying database connection This allows sharing the database connection with other components like SessionStore
func (*OAuth2Storage) GetDeviceCodeSession ¶ added in v0.0.4
func (s *OAuth2Storage) GetDeviceCodeSession(ctx context.Context, deviceCode string, session fosite.Session) (fosite.Requester, error)
GetDeviceCodeSession retrieves a device code session by device code
func (*OAuth2Storage) GetDeviceCodeSessionByUserCode ¶ added in v0.0.4
func (s *OAuth2Storage) GetDeviceCodeSessionByUserCode(ctx context.Context, userCode string) (string, fosite.Requester, error)
GetDeviceCodeSessionByUserCode retrieves a device code session by user code
func (*OAuth2Storage) GetOpenIDConnectSession ¶ added in v0.0.3
func (s *OAuth2Storage) GetOpenIDConnectSession(ctx context.Context, signature string, requester fosite.Requester) (fosite.Requester, error)
GetOpenIDConnectSession implements openid.OpenIDConnectRequestStorage interface
func (*OAuth2Storage) GetPKCERequestSession ¶ added in v0.0.4
func (s *OAuth2Storage) GetPKCERequestSession(ctx context.Context, signature string, session fosite.Session) (fosite.Requester, error)
GetPKCERequestSession retrieves a PKCE request session
func (*OAuth2Storage) GetRefreshTokenSession ¶ added in v0.0.3
func (s *OAuth2Storage) GetRefreshTokenSession(ctx context.Context, signature string, session fosite.Session) (fosite.Requester, error)
GetRefreshTokenSession retrieves a refresh token session
func (*OAuth2Storage) InvalidateAuthorizeCodeSession ¶ added in v0.0.3
func (s *OAuth2Storage) InvalidateAuthorizeCodeSession(ctx context.Context, signature string) error
InvalidateAuthorizeCodeSession invalidates an authorization code
func (*OAuth2Storage) InvalidateDeviceCodeSession ¶ added in v0.0.4
func (s *OAuth2Storage) InvalidateDeviceCodeSession(ctx context.Context, deviceCode string) error
InvalidateDeviceCodeSession invalidates a device code after it's been used
func (*OAuth2Storage) LoadHMACSecret ¶ added in v0.0.3
func (s *OAuth2Storage) LoadHMACSecret(ctx context.Context) ([]byte, error)
LoadHMACSecret loads the HMAC secret
func (*OAuth2Storage) LoadRSAKey ¶ added in v0.0.3
func (s *OAuth2Storage) LoadRSAKey(ctx context.Context) (string, error)
LoadRSAKey loads the RSA private key in PEM format
func (*OAuth2Storage) RevokeAccessToken ¶ added in v0.0.3
func (s *OAuth2Storage) RevokeAccessToken(ctx context.Context, requestID string) error
RevokeAccessToken revokes an access token
func (*OAuth2Storage) RevokeRefreshToken ¶ added in v0.0.3
func (s *OAuth2Storage) RevokeRefreshToken(ctx context.Context, requestID string) error
RevokeRefreshToken revokes a refresh token
func (*OAuth2Storage) RevokeRefreshTokenMaybeGracePeriod ¶ added in v0.0.3
func (s *OAuth2Storage) RevokeRefreshTokenMaybeGracePeriod(ctx context.Context, requestID string, _ string) error
RevokeRefreshTokenMaybeGracePeriod implements fosite.TokenRevocationStorage interface This handles refresh token revocation. The signature parameter allows for grace period implementation but for simplicity we immediately revoke the token by request ID
func (*OAuth2Storage) SaveHMACSecret ¶ added in v0.0.3
func (s *OAuth2Storage) SaveHMACSecret(ctx context.Context, secret []byte) error
SaveHMACSecret stores the HMAC secret
func (*OAuth2Storage) SaveRSAKey ¶ added in v0.0.3
func (s *OAuth2Storage) SaveRSAKey(ctx context.Context, privateKeyPEM string) error
SaveRSAKey stores the RSA private key in PEM format
func (*OAuth2Storage) SetClientAssertionJWT ¶ added in v0.0.3
SetClientAssertionJWT implements fosite.SetClientAssertionJWT interface This stores the JTI (JWT ID) with expiration to prevent replay attacks
func (*OAuth2Storage) UpdateDeviceCodePolling ¶ added in v0.0.4
func (s *OAuth2Storage) UpdateDeviceCodePolling(ctx context.Context, deviceCode string) error
UpdateDeviceCodePolling updates the last polled timestamp for rate limiting
type PingResponse ¶ added in v0.0.4
type PingResponse struct {
Daemon string `json:"daemon"` // "collector" or "schedd"
AuthMethod string `json:"auth_method"` // Authentication method used
User string `json:"user"` // Authenticated username
SessionID string `json:"session_id"` // Session identifier
ValidCommands string `json:"valid_commands"` // Commands authorized
Encryption bool `json:"encryption"` // Whether encryption is enabled
Authentication bool `json:"authentication"` // Whether authentication is enabled
Authorized bool `json:"authorized,omitempty"` // Whether authorized for requested permission (if permission checked)
Permission string `json:"permission,omitempty"` // Permission level checked (if any)
}
PingResponse represents a ping response for a daemon
type Server ¶
type Server struct {
*Handler // Embedded handler for business logic
// contains filtered or unexported fields
}
Server represents the HTTP API server
func (*Server) GetAddr ¶ added in v0.0.3
GetAddr returns the actual listening address of the server. Returns empty string if the server hasn't started yet.
type SessionData ¶ added in v0.0.4
type SessionData struct {
Username string // Authenticated username
CreatedAt time.Time // When the session was created
ExpiresAt time.Time // When the session expires
Token string // HTCondor token for this session (optional)
}
SessionData represents the data stored in a session
type SessionStore ¶ added in v0.0.4
type SessionStore struct {
// contains filtered or unexported fields
}
SessionStore manages HTTP sessions with SQLite persistence
func NewSessionStore ¶ added in v0.0.4
NewSessionStore creates a new session store with database persistence The db parameter should be the same database connection used by OAuth2Storage
func (*SessionStore) Cleanup ¶ added in v0.0.4
func (s *SessionStore) Cleanup()
Cleanup removes expired sessions
func (*SessionStore) Create ¶ added in v0.0.4
func (s *SessionStore) Create(username string) (string, *SessionData, error)
Create creates a new session for the given username
func (*SessionStore) Delete ¶ added in v0.0.4
func (s *SessionStore) Delete(sessionID string)
Delete removes a session
func (*SessionStore) Get ¶ added in v0.0.4
func (s *SessionStore) Get(sessionID string) *SessionData
Get retrieves a session by ID Returns nil if session doesn't exist or has expired
func (*SessionStore) Size ¶ added in v0.0.4
func (s *SessionStore) Size() int
Size returns the number of active sessions
type TokenCache ¶ added in v0.0.3
type TokenCache struct {
// contains filtered or unexported fields
}
TokenCache manages validated tokens and their associated session caches
func NewTokenCache ¶ added in v0.0.3
func NewTokenCache() *TokenCache
NewTokenCache creates a new token cache
func (*TokenCache) Add ¶ added in v0.0.3
func (tc *TokenCache) Add(token string) (*TokenCacheEntry, error)
Add adds a validated token to the cache with a session cache If the token is already in the cache, returns the existing entry Automatically schedules cleanup when the token expires
func (*TokenCache) AddValidated ¶ added in v0.0.4
func (tc *TokenCache) AddValidated(token, username string, expiration time.Time) (*TokenCacheEntry, error)
AddValidated adds a pre-validated token (e.g. opaque token) to the cache
func (*TokenCache) Get ¶ added in v0.0.3
func (tc *TokenCache) Get(token string) (*TokenCacheEntry, bool)
Get retrieves a token cache entry if it exists and is not expired
func (*TokenCache) Remove ¶ added in v0.0.3
func (tc *TokenCache) Remove(token string)
Remove removes a token from the cache and cancels its cleanup timer
func (*TokenCache) Size ¶ added in v0.0.3
func (tc *TokenCache) Size() int
Size returns the number of cached tokens
type TokenCacheEntry ¶ added in v0.0.3
type TokenCacheEntry struct {
Token string
Username string // Username extracted from JWT (for rate limiting)
Expiration time.Time
SessionCache *security.SessionCache
// contains filtered or unexported fields
}
TokenCacheEntry represents a cached token with its expiration and associated session cache
type UserInfo ¶ added in v0.0.3
type UserInfo struct {
Subject string `json:"sub"`
Email string `json:"email"`
Name string `json:"name"`
Groups interface{} `json:"groups"` // Can be []string or string
Claims map[string]interface{} // Additional claims
}
UserInfo represents user information from the IDP
type WhoAmIResponse ¶ added in v0.0.4
type WhoAmIResponse struct {
Authenticated bool `json:"authenticated"`
User string `json:"user,omitempty"` // Omit if not authenticated
}
WhoAmIResponse represents a whoami response