Class: Amp::Servers::HTTPAuthorizedServer
- Inherits:
-
HTTPServer
- Object
- Sinatra::Base
- HTTPServer
- Amp::Servers::HTTPAuthorizedServer
- Defined in:
- lib/amp/server/http_server.rb
Overview
HTTPAuthorizedServer
General HTTP Server that has some form of authentication. Implements user-logic methods, as every subclass will have the same interface for adding/removing users. Note: this server only provides methods for dealing with Mercurial clients. It is not a full-blown web server with a web interface to the repository. The users you add to an HTTPAuthorizedServer are the credentials a user must provide when pushing to a repository (for example), or checking out a private repository.
It is worth noting that one may serve many repositories using one server using this class. Spiffy, eh?
Direct Known Subclasses
Class Method Summary collapse
-
.set_authentication ⇒ Object
Sets whether to use digest or basic authentication.
- .set_permission(style, *args) ⇒ Object
-
.set_storage(*args) ⇒ Object
since you can only set the storage once…
Instance Method Summary collapse
Class Method Details
.set_authentication ⇒ Object
Sets whether to use digest or basic authentication. May only be called once, for now.
71 72 73 74 75 76 77 78 79 |
# File 'lib/amp/server/http_server.rb', line 71 def self.set_authentication(manner, opts={}) case manner.to_sym when :basic helpers Sinatra::BasicAuthorization when :digest helpers Sinatra::DigestAuthorization end def self.set_authentication; end end |
.set_permission(style, *args) ⇒ Object
55 56 57 58 59 60 61 62 63 64 |
# File 'lib/amp/server/http_server.rb', line 55 def self.(style, *args) case style when :writer set_writer *args when :reader set_reader *args else raise ArgumentError.new("Unknown permission level: #{style.to_s.inspect}") end end |
.set_storage(*args) ⇒ Object
since you can only set the storage once…
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/amp/server/http_server.rb', line 52 def self.set_storage(manner, opts={}) manner = manner.to_sym case manner when :sequel set :user_db_name, (opts[:user_db_name] || "users") extend RepoUserManagement::SequelSQLite3 when :memory extend RepoUserManagement::Memory else raise "Unknown storage manner #{manner.inspect}" end # since you can only set the storage once... def self.set_storage(*args); end # this will redefine this method to do nothing end |