Class: ActionMCP::GatewayIdentifiers::DeviseIdentifier

Inherits:
ActionMCP::GatewayIdentifier show all
Defined in:
lib/action_mcp/gateway_identifiers/devise_identifier.rb

Overview

Example Gateway identifier for direct Devise integration.

This identifier looks for the user directly in request.env which may be set by custom Devise middleware or helpers.

Examples:

Usage in ApplicationGateway

class ApplicationGateway < ActionMCP::Gateway
  identified_by ActionMCP::GatewayIdentifiers::DeviseIdentifier
end

Configuration

# config/mcp.yml
authentication_methods: ["devise"]

Custom Devise middleware setup

# In your application, you might set this in a before_action:
# request.env['devise.user'] = current_user if user_signed_in?

Instance Method Summary collapse

Methods inherited from ActionMCP::GatewayIdentifier

authenticates, identifier, #initialize

Constructor Details

This class inherits a constructor from ActionMCP::GatewayIdentifier

Instance Method Details

#resolveObject

Raises:



26
27
28
29
30
31
# File 'lib/action_mcp/gateway_identifiers/devise_identifier.rb', line 26

def resolve
  user = @request.env["devise.user"]
  raise Unauthorized, "Not authenticated" unless user

  user
end