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.



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

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

Instance Method Details

#cookiesObject



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

def cookies
  @request.cookie_jar
end

#denied?Boolean

Returns:

  • (Boolean)


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

def denied?
  @denied
end

#headObject



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

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

#paramsObject



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

def params
  @request.params
end

#performed?Boolean

Returns:

  • (Boolean)


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

def performed?
  @denied
end

#redirect_toObject



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

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

#renderObject



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

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

#requestObject



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

def request
  @request
end

#sessionObject



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

def session
  @request.session
end