Roda::RodaPlugins::Auth::
ClassMethods
module
Roda
Plugin API – declare methods added to Roda
classes
on_auth( method_name=nil, &block )
Set the default authentication success callback.
126 def on_auth( method_name=nil, &block )
127 block = self.method( method_name ) if method_name
128 self.opts[ OPTIONS_KEY ][ :on_auth ] = block
129 end
on_auth_failure( method_name=nil, &block )
Set the default authentication failure callback.
140 def on_auth_failure( method_name=nil, &block )
141 block = self.method( method_name ) if method_name
142 self.opts[ OPTIONS_KEY ][ :on_auth_failure ] = block
143 end
on_authz( method_name=nil, &block )
Set the default authorization success callback.
133 def on_authz( method_name=nil, &block )
134 block = self.method( method_name ) if method_name
135 self.opts[ OPTIONS_KEY ][ :on_authz ] = block
136 end
on_authz_failure( method_name=nil, &block )
Set the default authorization failure handler.
147 def on_authz_failure( method_name=nil, &block )
148 block = self.method( method_name ) if method_name
149 self.opts[ OPTIONS_KEY ][ :on_authz_failure ] = block
150 end
Set the default realm to use for authentication headers.
120 def realm( new_realm )
121 self.opts[ OPTIONS_KEY ][ :realm ] = new_realm
122 end
Declare valid authentication schemes for the app via the given mapping
, which should be pairs of Symbol keys (scheme names) to (potentially empty) Hashes of auth parameters. If mapping
is a Symbol, it will be used as a scheme with no parameters.
110 def schemes( mapping )
111 mapping = Hash[ mapping ]
112
113 self.log.debug "Registering auth scheme/s: %p" % [ mapping ]
114 self.opts[ OPTIONS_KEY ][ :schemes ] = mapping
115 end