lib/authlane/helper.rb
##
# Marks a route as the login route, that typically receives `POST` data from a `<form>`.
#
# The actual handling of the login logic and anything else the application
# requires is defined by creating the *Auth Strategy* using {Sinatra::AuthLane.create_auth_strategy create_auth_strategy}.
# the code block will be called within `authorize!` and - depending on the outcome (refer to
# {Sinatra::AuthLane.create_auth_strategy create_auth_strategy}'s documentation of its return value) - redirects
# to the `:failed_route` AuthLane setting or lets the user 'through' to access the route, which - in most cases - should
# be a redirect to the protected route.
#
# @example
#   get '/signin' do
#     mustache :signin
#   end
#
#   post '/signin' do
#     authorize!
#
#     redirect '/account'
#   end
#
# @return [void]
#
# @see Sinatra::AuthLane.create_auth_strategy create_auth_strategy
#
Marks a route as the login route, that typically receives `POST` data from a ``.
The actual handling of the login logic and anything else the application
requires is defined by creating the *Auth Strategy* using {Sinatra::AuthLane.create_auth_strategy create_auth_strategy}.
the code block will be called within `authorize!` and - depending on the outcome (refer to
{Sinatra::AuthLane.create_auth_strategy create_auth_strategy}'s documentation of its return value) - redirects
to the `:failed_route` AuthLane setting or lets the user 'through' to access the route, which - in most cases - should
be a redirect to the protected route.
Marks a route as the login route that typically receives ` POST ` data from a ` ` . The actual handling of the login logic and anything else the application requires is defined by creating the * Auth Strategy * using { Sinatra :: AuthLane . create_auth_strategy create_auth_strategy } . the code block will be called within ` authorize! ` and - depending on the outcome ( refer to { Sinatra :: AuthLane . create_auth_strategy create_auth_strategy } ' s documentation of its return value ) - redirects to the ` : failed_route ` AuthLane setting or lets the user ' through ' to access the route which - in most cases - should be a redirect to the protected route .
def authorize!
        strat = self.instance_exec &settings.authlane[:auth_strategy]
        unless strat
          redirect settings.authlane[:failed_route], 303
        end
        session[settings.authlane[:session_key]] = serialize_user(strat)
      end
def authorize! strat = self . instance_exec & settings . authlane [ :auth_strategy ] unless strat redirect settings . authlane [ :failed_route ] , 303 end session [ settings . authlane [ :session_key ] ] = serialize_user ( strat ) end
Marks a route as the login route, that typically receives `POST` data from a `<form>`.
Marks a route as the login route that typically receives ` POST ` data from a ` <form > ` .
None
void
example
get '/signin' do mustache :signin end post '/signin' do authorize. redirect '/account' end
get ' / signin ' do mustache : signin end post ' / signin ' do authorize . redirect ' / account ' end
see
None