Class: Mbeditor::ChannelAuthentication::AuthProbe

Inherits:
Object
  • Object
show all
Defined in:
app/channels/mbeditor/channel_authentication.rb

Overview

Minimal controller-like context for evaluating authenticate_with off the cable connection. Any render/redirect/head marks the request as denied, mirroring a controller's performed? halt semantics.

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ AuthProbe

Returns a new instance of AuthProbe.



52
53
54
55
# File 'app/channels/mbeditor/channel_authentication.rb', line 52

def initialize(env)
  @request = ActionDispatch::Request.new(env || {})
  @denied = false
end

Instance Method Details

#cookiesObject



61
62
63
# File 'app/channels/mbeditor/channel_authentication.rb', line 61

def cookies
  @request.cookie_jar
end

#denied?Boolean

Returns:

  • (Boolean)


89
90
91
# File 'app/channels/mbeditor/channel_authentication.rb', line 89

def denied?
  @denied
end

#headObject



81
82
83
# File 'app/channels/mbeditor/channel_authentication.rb', line 81

def head(*, **)
  @denied = true
end

#paramsObject



69
70
71
# File 'app/channels/mbeditor/channel_authentication.rb', line 69

def params
  @request.params
end

#performed?Boolean

Returns:

  • (Boolean)


85
86
87
# File 'app/channels/mbeditor/channel_authentication.rb', line 85

def performed?
  @denied
end

#redirect_toObject



73
74
75
# File 'app/channels/mbeditor/channel_authentication.rb', line 73

def redirect_to(*, **)
  @denied = true
end

#renderObject



77
78
79
# File 'app/channels/mbeditor/channel_authentication.rb', line 77

def render(*, **)
  @denied = true
end

#requestObject



65
66
67
# File 'app/channels/mbeditor/channel_authentication.rb', line 65

def request
  @request
end

#sessionObject



57
58
59
# File 'app/channels/mbeditor/channel_authentication.rb', line 57

def session
  @request.session
end