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.



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

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

Instance Method Details

#cookiesObject



124
125
126
# File 'app/channels/mbeditor/channel_authentication.rb', line 124

def cookies
  @request.cookie_jar
end

#denied?Boolean

Returns:

  • (Boolean)


152
153
154
# File 'app/channels/mbeditor/channel_authentication.rb', line 152

def denied?
  @denied
end

#headObject



144
145
146
# File 'app/channels/mbeditor/channel_authentication.rb', line 144

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

#paramsObject



132
133
134
# File 'app/channels/mbeditor/channel_authentication.rb', line 132

def params
  @request.params
end

#performed?Boolean

Returns:

  • (Boolean)


148
149
150
# File 'app/channels/mbeditor/channel_authentication.rb', line 148

def performed?
  @denied
end

#redirect_toObject



136
137
138
# File 'app/channels/mbeditor/channel_authentication.rb', line 136

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

#renderObject



140
141
142
# File 'app/channels/mbeditor/channel_authentication.rb', line 140

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

#requestObject



128
129
130
# File 'app/channels/mbeditor/channel_authentication.rb', line 128

def request
  @request
end

#sessionObject



120
121
122
# File 'app/channels/mbeditor/channel_authentication.rb', line 120

def session
  @request.session
end