Sha256: d898f0286a81c4633e88a6eeda97d02bf4d815b7d6587504b0602efec0fbfc8f

Contents?: true

Size: 884 Bytes

Versions: 16

Compression:

Stored size: 884 Bytes

Contents

$:.unshift( "../lib" )
require 'capcode'

module Capcode

  http_authentication( :type => :basic, :realm => "Private part", :routes => "/noauth/private" ) { 
    {
      "greg" => "toto",
      "mu" => "maia"
    }
  }

  class Index < Route '/admin'    
    def get
      # Basic HTTP Authentication
      http_authentication( :type => :basic, :realm => "Admin part" ) { 
        {
          "greg" => "toto",
          "mu" => "maia"
        }
      }
      render "Success !"
    end
  end 
  
  class Noauth < Route '/noauth'
    def get
      render "You don't need any special authorization here !"
    end
  end
  
  class Private < Route '/noauth/private'
    def get
      render "Welcome in the private part !"
    end
  end

  class Private2 < Route '/noauth/private/again'
    def get
      render "Welcome in the private/again part !"
    end
  end
  
end

Capcode.run( )

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
Capcode-1.0.0 examples/auth-basic.rb
Capcode-0.9.9 examples/auth-basic.rb
Capcode-0.9.8 examples/auth-basic.rb
Capcode-0.9.7 examples/auth-basic.rb
Capcode-0.9.6 examples/auth-basic.rb
Capcode-0.9.5 examples/auth-basic.rb
Capcode-0.9.4 examples/auth-basic.rb
Capcode-0.9.3 examples/auth-basic.rb
Capcode-0.9.2 examples/auth-basic.rb
Capcode-0.9.1 examples/auth-basic.rb
Capcode-0.9.0 examples/auth-basic.rb
Capcode-0.8.9 examples/auth-basic.rb
Capcode-0.8.8 examples/auth-basic.rb
Capcode-0.8.7 examples/auth-basic.rb
Capcode-0.8.6 examples/auth-basic.rb
Capcode-0.8.5 examples/auth-basic.rb