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.



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

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

Instance Method Details

#authenticate(env) ⇒ Object



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

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

  @tokens.include?(token)
end