Re: Authorization handler

Brian Johnson <[email protected]> Thu, 18 Aug 2005 00:42:48 -0400
Newsgroups gmane.comp.apache.mod-ruby
Message-ID <[email protected]>
A simple class to handle Access, Authentication, and Authorization
would be something like this

#myauth.rb
require 'singleton'
class MyAuth
      include Singleton

      #function called via RubyAccessHandler
      def check_access(req)
            return Apache::OK
      end

     #function called via RubyAuthenHandler
      def authenticate(req)
            return Apache::OK
      end

     #function called via RubyAuthzHandler
      def authorize(req)
            return Apache::OK
      end
end

Each one of those functions takes the Apache::Request object as a
parameter and then returns an Apache error code when finished usally
either OK for success or FORBIDDEN if the user isn't allowed access

Once you have your class written you should be able to install the
handlers in Apache by adding these lines into your httpd.conf file

RubyRequire myauth
RubyAccessHandler MyAuth.instance
RubyAuthenHandler MyAuth.instance
RubyAuthzHandler MyAuth.instance
AuthType <Type>
AuthName <Name>


Brian Johnson

On 8/16/05, Michal Koudelka <[email protected]> wrote:
> Hi,
> 
> Can anybody give me short example how to create authenhandler in mod_ruby? I found nothing in modruby wiki
> 
> Thank you
> 
> 
>