Sha256: 4edd34f6a412ef44961700a8320ae6498ddbc2a0bd6d819ee07476df2205540c

Contents?: true

Size: 1016 Bytes

Versions: 1

Compression:

Stored size: 1016 Bytes

Contents

module Merb::Test::Fixtures::Controllers
  
  class Testing < Merb::Controller
    self._template_root = File.dirname(__FILE__) / "views"
  end

  class BasicAuthentication < Testing

    before :authenticate, :only => :index

    def index
      "authenticated"
    end
    
    protected
  
    def authenticate
      basic_authentication { |u, p| u == "Fred" && p == "secret" }
    end
    
  end
  
  class BasicAuthenticationWithRealm < BasicAuthentication
    def authenticate
      basic_authentication("My Super App") { |u, p| u == "Fred" && p == "secret" }
    end
  end
  
  class AuthenticateBasicAuthentication < Testing
    def index
      basic_authentication.authenticate { |u, p| "Fred:secret" }
    end
  end
  
  class RequestBasicAuthentication < BasicAuthentication
    def authenticate
      basic_authentication.request
    end
  end
  
  class RequestBasicAuthenticationWithRealm < BasicAuthentication
    def authenticate
      basic_authentication("My SuperApp").request
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
merb-core-0.9.3 spec/public/controller/controllers/authentication.rb