Class: Otto::MCP::Auth::TokenAuth
- Inherits:
-
Object
- Object
- Otto::MCP::Auth::TokenAuth
- Defined in:
- lib/otto/mcp/auth/token.rb
Overview
Token-based authentication for MCP protocol endpoints
Instance Method Summary collapse
- #authenticate(env) ⇒ Object
-
#initialize(tokens) ⇒ TokenAuth
constructor
A new instance of TokenAuth.
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 |