Class: ActionMCP::Gateway

Inherits:
Object
  • Object
show all
Defined in:
lib/action_mcp/gateway.rb

Direct Known Subclasses

ApplicationGateway

Constant Summary collapse

ALLOWED_IDENTITY_KEYS =

Whitelist of allowed identity attribute names to prevent method shadowing and unauthorized attribute assignment. Extend this list if you use custom identifier names in your GatewayIdentifier implementations.

%w[user api_key jwt bearer token account session].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ Gateway

Returns a new instance of Gateway.



23
24
25
# File 'lib/action_mcp/gateway.rb', line 23

def initialize(request)
  @request = request
end

Class Method Details

.identified_by(*klasses) ⇒ Object

pluck in one or many GatewayIdentifier classes



14
15
16
# File 'lib/action_mcp/gateway.rb', line 14

def identified_by(*klasses)
  @identifier_classes = klasses.flatten
end

.identifier_classesObject



18
19
20
# File 'lib/action_mcp/gateway.rb', line 18

def identifier_classes
  @identifier_classes || []
end

Instance Method Details

#callObject

called by your rack/websocket layer



28
29
30
31
32
33
# File 'lib/action_mcp/gateway.rb', line 28

def call
  identities = authenticate!
  assign_identities(identities)
  apply_profile_from_authentication(identities)
  self
end