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.



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

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

Instance Method Details

#cookiesObject



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

def cookies
  @request.cookie_jar
end

#denied?Boolean

Returns:

  • (Boolean)


118
119
120
# File 'app/channels/mbeditor/channel_authentication.rb', line 118

def denied?
  @denied
end

#headObject



110
111
112
# File 'app/channels/mbeditor/channel_authentication.rb', line 110

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

#paramsObject



98
99
100
# File 'app/channels/mbeditor/channel_authentication.rb', line 98

def params
  @request.params
end

#performed?Boolean

Returns:

  • (Boolean)


114
115
116
# File 'app/channels/mbeditor/channel_authentication.rb', line 114

def performed?
  @denied
end

#redirect_toObject



102
103
104
# File 'app/channels/mbeditor/channel_authentication.rb', line 102

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

#renderObject



106
107
108
# File 'app/channels/mbeditor/channel_authentication.rb', line 106

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

#requestObject



94
95
96
# File 'app/channels/mbeditor/channel_authentication.rb', line 94

def request
  @request
end

#sessionObject



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

def session
  @request.session
end