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.



13
14
15
# File 'lib/otto/mcp/auth/token.rb', line 13

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

Instance Method Details

#authenticate(env) ⇒ Object



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

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

  valid_token?(token)
end