Sha256: adc1f814737fbe2d9a6ea2739e8a4cad9199b0b42b6abcd6eaf7f64a338f6138
Contents?: true
Size: 1.57 KB
Versions: 3
Compression:
Stored size: 1.57 KB
Contents
#-- # Copyright (C) 2009 Brown Beagle Software # Copyright (C) 2009 Darcy Laycock <sutto@sutto.net> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. #++ module GitAuth class AuthSetupMiddleware def initialize(app) @app = app @files = Rack::File.new(GitAuth::BASE_DIR.join("public").to_s) end def call(env) dup._call(env) end def _call(env) @request = Rack::Request.new(env) if GitAuth::WebApp.has_auth? @app.call(env) elsif env["PATH_INFO"].include?("/gitauth.css") @files.call(env) else content = ERB.new(File.read(GitAuth::BASE_DIR.join("views", "auth_setup.erb"))).result(binding) headers = {"Content-Type" => "text/html", "Content-Length" => Rack::Utils.bytesize(content).to_s} [403, headers, [content]] end end def u(path) "#{@request.script_name}#{path}" end def request @request end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
gitauth-0.1.0 | lib/gitauth/auth_setup_middleware.rb |
mbbx6spp-gitauth-0.0.5.2 | lib/gitauth/auth_setup_middleware.rb |
gitauth-0.0.5.2 | lib/gitauth/auth_setup_middleware.rb |