Class: Otto::MCP::Auth::TokenAuth

Inherits:
Object
  • Object
show all
Defined in:
lib/otto/mcp/auth/token.rb

Overview

Token-based authentication for MCP protocol endpoints

Instance Method Summary collapse

Constructor Details

#initialize(tokens) ⇒ TokenAuth

Returns a new instance of TokenAuth.



15
16
17
# File 'lib/otto/mcp/auth/token.rb', line 15

def initialize(tokens)
  @tokens = Array(tokens).to_set
end

Instance Method Details

#authenticate(env) ⇒ Object



19
20
21
22
23
24
# File 'lib/otto/mcp/auth/token.rb', line 19

def authenticate(env)
  token = extract_token(env)
  return false unless token

  valid_token?(token)
end