Sha256: 31b7408af472b623b8dff4727c72c765b63bebedb14fbb18a842a36017cc6542
Contents?: true
Size: 1.41 KB
Versions: 7
Compression:
Stored size: 1.41 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) 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 headers = {"Content-Type" => "text/html", "Content-Length" => Rack::Utils.bytesize(content).to_s} [403, headers, [content]] end end end end
Version data entries
7 entries across 7 versions & 2 rubygems