Roda::RodaPlugins::Auth::

ClassMethods module

Roda Plugin API – declare methods added to Roda classes

Public Instance Methods

on_auth( method_name=nil, &block )

Set the default authentication success callback.

    # File lib/roda/plugins/auth.rb
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.

    # File lib/roda/plugins/auth.rb
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.

    # File lib/roda/plugins/auth.rb
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.

    # File lib/roda/plugins/auth.rb
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
realm( new_realm )

Set the default realm to use for authentication headers.

    # File lib/roda/plugins/auth.rb
120 def realm( new_realm )
121     self.opts[ OPTIONS_KEY ][ :realm ] = new_realm
122 end
scheme( mapping )
Alias for: schemes
schemes( mapping )

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.

    # File lib/roda/plugins/auth.rb
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
Also aliased as: scheme