Class | Merb::Authentication |
In: |
lib/merb-auth-core/authentication.rb
lib/merb-auth-core/callbacks.rb lib/merb-auth-core/customizations.rb lib/merb-auth-core/errors.rb lib/merb-auth-core/responses.rb lib/merb-auth-core/strategy.rb |
Parent: | Object |
These are not intended to be used directly
body | [RW] | |
error_message | [W] | |
session | [RW] |
Activates a registered strategy by it‘s label. Intended for use with plugin authors. There is little need to register your own strategies. Just declare them and they will be active.
Use the after_authentication callbacks to setup things that should occur after the user is authenticated.
Pass in symbols, procs and or a block to the method to setup the callbacks. Callbacks are executed in the order they are added.
@params <*callbacks:[Symbol|Proc]> The callback.. Symbol == method on the user object
Proc will be passed the user, request and param objects
<&block> A block to check. The user, request and params will be passed into the block
To confirm that the user is still eligable to login, simply return the user from the method or block. To stop the user from being authenticated return false or nil
Merb::Authentication.after_authentication do |user,request,params| user.active? ? user : nil end
@api public
Adds any customizations just before the after_app_loads boot loader so that plugins can offer default customization. This will still allow for a user to overwrite any customizations if required in the after_app_loads block @plugin
Use this to set the default order of strategies if you need to in your application. You don‘t need to use all avaiable strategies in this array, but you may not include a strategy that has not yet been defined.
@params [Merb::Authentiation::Strategy,Merb::Authentication::Strategy]
@public
Keeps track of strategies by class or string When loading from string, strategies are loaded withing the Merb::Authentication::Strategies namespace When loaded by class, the class is stored directly @private
Maintains a list of keys to maintain when needing to keep some state in the face of session.abandon! You need to maintain this state yourself @public
Allows for the registration of strategies. @params <Symbol, String>
+label+ The label is the label to identify this strategy +path+ The path to the file containing the strategy. This must be an absolute path!
Registering a strategy does not add it to the list of strategies to use it simply makes it available through the Merb::Authentication.activate method
This is for plugin writers to make a strategy availalbe but this should not stop you from declaring your own strategies
@plugin
The workhorse of the framework. The authentiate! method is where the work is done. authenticate! will try each strategy in order either passed in, or in the default_strategy_order.
If a strategy returns some kind of user object, this will be stored in the session, otherwise a Merb::Controller::Unauthenticated exception is raised
@params Merb::Request, [List,Of,Strategies, optional_options_hash]
Pass in a list of strategy objects to have this list take precedence over the normal defaults
Use an options hash to provide an error message to be passed into the exception.
@return user object of the verified user. An exception is raised if no user is found
Returns true if there is an authenticated user attached to this session
@return <TrueClass|FalseClass>
A simple error message mechanism to provide general information. For more specific information
This message is the default message passed to the Merb::Controller::Unauthenticated exception during authentication.
This is a very simple mechanism for error messages. For more detailed control see Authenticaiton#errors
@api overwritable
Tells the framework how to reconstitute a user from the data stored by store_user.
You must overwrite this method for user in your projects. Slices and plugins may set this.
@api overwritable
Tells the framework how to store your user object into the session so that it can be re-created on the next login. You must overwrite this method for use in your projects. Slices and plugins may set this.
@api overwritable