Module: Pasaporte::Secure
- Defined in:
- lib/pasaporte.rb
Overview
Or a semblance thereof
Defined Under Namespace
Modules: CheckMethods Classes: FullStop, PleaseLogin, RedirectToPlain, RedirectToSSL, Throttled
Instance Method Summary collapse
Instance Method Details
#service(*a) ⇒ Object
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/pasaporte.rb', line 153 def service(*a) begin @ctr = self.class.to_s.split('::').pop super(*a) rescue FullStop return self rescue PleaseLogin LOGGER.info "#{env['REMOTE_ADDR']} - Redirecting to signon" redirect R(Pasaporte::Controllers::Signon, @nickname) return self rescue Throttled LOGGER.info "#{env['REMOTE_ADDR']} - Throttled user tried again" redirect R(Pasaporte::Controllers::ThrottledPage) return self rescue TokenBox::Invalid => i LOGGER.warn "Form token has been compromised on #{@env.REQUEST_URI} - #{i}" LOGGER.warn @state.token_box.inspect redirect R(Pasaporte::Controllers::FormExpired) rescue RedirectToSSL LOGGER.info "Forcing redirect to SSL page" the_uri = URI.parse(@env.REQUEST_URI) the_uri.host = @env.SERVER_NAME the_uri.scheme = 'https' the_uri.port = SSL_PORT unless SSL_PORT.to_i == 443 redirect the_uri.to_s return self rescue RedirectToPlain LOGGER.info "Forcing redirect to plain (non-SSL) page" the_uri = URI.parse(@env.REQUEST_URI) the_uri.host = @env.SERVER_NAME the_uri.scheme = 'http' the_uri.port = HTTP_PORT unless HTTP_PORT.to_i == 80 redirect the_uri.to_s return self end self end |
#token_box ⇒ Object
149 150 151 |
# File 'lib/pasaporte.rb', line 149 def token_box @state.token_box ||= TokenBox.new end |