[DRE-commits] [ruby-omniauth-remote-user] 01/09: Imported Upstream version 0.1.2

Thiago Ribeiro thiagovsk-guest at moszumanska.debian.org
Sun Mar 6 20:47:11 UTC 2016


This is an automated email from the git hooks/post-receive script.

thiagovsk-guest pushed a commit to branch master
in repository ruby-omniauth-remote-user.

commit 1dd814d7d9746d635457dc1a8b23408422fb1d99
Author: Thiago Ribeiro <thiagitosouza at gmail.com>
Date:   Sat Mar 5 13:51:12 2016 -0300

    Imported Upstream version 0.1.2
---
 LICENSE.md                                   |   4 +-
 debian/changelog                             |   5 ++
 debian/compat                                |   1 +
 debian/control                               |  24 +++++
 debian/copyright                             |  35 ++++++++
 debian/ruby-omniauth-remote-user.docs        |   1 +
 debian/rules                                 |  18 ++++
 debian/source/format                         |   1 +
 debian/tests/control.ex                      |  13 +++
 debian/watch                                 |   2 +
 lib/omniauth-remote-user/version.rb          |   2 +-
 metadata.yml                                 |  81 -----------------
 omniauth-remote-user.gemspec                 |   2 +-
 spec/omniauth/strategies/remote_user_spec.rb | 125 +++++++++++++++++++++++++++
 spec/spec_helper.rb                          |  26 ++++++
 15 files changed, 255 insertions(+), 85 deletions(-)

diff --git a/LICENSE.md b/LICENSE.md
index ce47779..25700d6 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -1,6 +1,6 @@
-Copyright (c) 2015 Antonio Terceiro
+Copyright © Lucas Kanashiro, Thiago Ribeiro, Rodrigo Siqueira, Macartur Sousa, Antonio Terceiro
 
-MIT License
+Expat (aka MIT) License
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..6ffb92c
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+ruby-omniauth-remote-user (0.1-1) UNRELEASED; urgency=medium
+
+  * Initial release (Closes: #nnnn)
+
+ -- Thiago Ribeiro <thiagitosouza at gmail.com>  Tue, 18 Aug 2015 17:21:34 -0300
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..7f8f011
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+7
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..133305f
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,24 @@
+Source: ruby-omniauth-remote-user
+Section: ruby
+Priority: optional
+Maintainer: Debian Ruby Extras Maintainers <pkg-ruby-extras-maintainers at lists.alioth.debian.org>
+Uploaders: Thiago Ribeiro <thiagitosouza at gmail.com>
+Build-Depends: debhelper (>= 7.0.50~),
+               gem2deb,
+               ruby-omniauth (>= 1.0)
+Standards-Version: 3.9.6
+Vcs-Git: git://anonscm.debian.org/pkg-ruby-extras/ruby-omniauth-remote-user.git
+Vcs-Browser: https://anonscm.debian.org/cgit/pkg-ruby-extras/ruby-omniauth-remote-user.git
+Homepage: http://beta.softwarepublico.gov.br/gitlab/softwarepublico/omniauth-remote-user
+Testsuite: autopkgtest-pkg-ruby
+XS-Ruby-Versions: all
+
+Package: ruby-omniauth-remote-user
+Architecture: all
+XB-Ruby-Versions: ${ruby:Versions}
+Depends: ruby | ruby-interpreter,
+         ruby-omniauth (>= 1.0),
+         ${misc:Depends},
+         ${shlibs:Depends}
+Description: Authentication with HTTP Remote User
+ Authentication with Remote-User HTTP header for Omniauth.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..d309fc9
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,35 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: omniauth-remote-user
+Source: FIXME <http://example.com/>
+
+Files: *
+Copyright: <years> <put author's name and email here>
+           <years> <likewise for another author>
+License: GPL-2+ (FIXME)
+
+Files: debian/*
+Copyright: 2015 Thiago Ribeiro <thiagitosouza at gmail.com>
+License: GPL-2+ (FIXME)
+Comment: the Debian packaging is licensed under the same terms as the original package.
+
+License: GPL-2+ (FIXME)
+ This program is free software; you can redistribute it
+ and/or modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 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 General Public License for more
+ details.
+ .
+ You should have received a copy of the GNU General Public
+ License along with this package; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ Boston, MA  02110-1301 USA
+ .
+ On Debian systems, the full text of the GNU General Public
+ License version 2 can be found in the file
+ `/usr/share/common-licenses/GPL-2'.
diff --git a/debian/ruby-omniauth-remote-user.docs b/debian/ruby-omniauth-remote-user.docs
new file mode 100644
index 0000000..b43bf86
--- /dev/null
+++ b/debian/ruby-omniauth-remote-user.docs
@@ -0,0 +1 @@
+README.md
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..acfc5fe
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,18 @@
+#!/usr/bin/make -f
+#export DH_VERBOSE=1
+#
+# Uncomment to ignore all test failures (but the tests will run anyway)
+#export DH_RUBY_IGNORE_TESTS=all
+#
+# Uncomment to ignore some test failures (but the tests will run anyway).
+# Valid values:
+#export DH_RUBY_IGNORE_TESTS=ruby2.1 ruby2.2
+#
+# If you need to specify the .gemspec (eg there is more than one)
+#export DH_RUBY_GEMSPEC=gem.gemspec
+#
+# Uncomment to check dependencies during build:
+# export GEM2DEB_TEST_RUNNER = --check-dependencies
+
+%:
+	dh $@ --buildsystem=ruby --with ruby
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/tests/control.ex b/debian/tests/control.ex
new file mode 100644
index 0000000..d604201
--- /dev/null
+++ b/debian/tests/control.ex
@@ -0,0 +1,13 @@
+# AUTOGENERATED FILE
+#
+# As of autopkgtest 3.5, Ruby packages that use gem2deb are automatically
+# detected, and if debian/tests/control does not exist the contents below will
+# be assumed (with the exception of gem2deb being filtered out from
+# @builddeps@):
+
+Test-Command: gem2deb-test-runner --autopkgtest --check-dependencies 2>&1
+Depends: @, @builddeps@, gem2deb-test-runner
+
+# if you would need to change something to the above, to that and rename this
+# file to `control`. Otherwise, you should probably delete this file
+# (recommended).
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..a304f02
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,2 @@
+version=3
+http://pkg-ruby-extras.alioth.debian.org/cgi-bin/gemwatch/omniauth-remote-user .*/omniauth-remote-user-(.*).tar.gz
diff --git a/lib/omniauth-remote-user/version.rb b/lib/omniauth-remote-user/version.rb
index be4bcd5..44d264a 100644
--- a/lib/omniauth-remote-user/version.rb
+++ b/lib/omniauth-remote-user/version.rb
@@ -1,5 +1,5 @@
 module Omniauth
   module RemoteUser
-    VERSION = '0.1'
+    VERSION = '0.1.2'
   end
 end
diff --git a/metadata.yml b/metadata.yml
deleted file mode 100644
index ed6b59d..0000000
--- a/metadata.yml
+++ /dev/null
@@ -1,81 +0,0 @@
---- !ruby/object:Gem::Specification
-name: omniauth-remote-user
-version: !ruby/object:Gem::Version
-  version: '0.1'
-platform: ruby
-authors:
-- Lucas Kanashiro
-- Thiago Ribeiro
-- Rodrigo Siqueira
-- Macartur Sousa
-- Antonio Terceiro
-autorequire: 
-bindir: bin
-cert_chain: []
-date: 2015-08-18 00:00:00.000000000 Z
-dependencies:
-- !ruby/object:Gem::Dependency
-  name: omniauth
-  requirement: !ruby/object:Gem::Requirement
-    requirements:
-    - - "~>"
-      - !ruby/object:Gem::Version
-        version: '1.0'
-  type: :runtime
-  prerelease: false
-  version_requirements: !ruby/object:Gem::Requirement
-    requirements:
-    - - "~>"
-      - !ruby/object:Gem::Version
-        version: '1.0'
-description: Authentication with Remote-User HTTP header for Omniauth.
-email:
-- kanashiro.duarte at gmail.com
-- thiagitosouza at gmail.com
-- rodrigosiqueiramelo at gmail.com
-- macartur.sc at gmail.com
-- terceiro at softwarelivre.org
-executables: []
-extensions: []
-extra_rdoc_files: []
-files:
-- ".gitignore"
-- ".rspec"
-- Gemfile
-- LICENSE.md
-- README.md
-- Rakefile
-- config.ru
-- lib/omniauth-remote-user.rb
-- lib/omniauth-remote-user/version.rb
-- lib/omniauth/remote-user.rb
-- lib/omniauth/strategies/remote_user.rb
-- omniauth-remote-user.gemspec
-- references/teste.rb
-- test_notes.txt
-homepage: http://beta.softwarepublico.gov.br/gitlab/softwarepublico/omniauth-remote-user
-licenses:
-- Expat
-metadata: {}
-post_install_message: 
-rdoc_options: []
-require_paths:
-- lib
-required_ruby_version: !ruby/object:Gem::Requirement
-  requirements:
-  - - ">="
-    - !ruby/object:Gem::Version
-      version: '0'
-required_rubygems_version: !ruby/object:Gem::Requirement
-  requirements:
-  - - ">="
-    - !ruby/object:Gem::Version
-      version: 1.3.5
-requirements: []
-rubyforge_project: 
-rubygems_version: 2.4.5
-signing_key: 
-specification_version: 4
-summary: Authentication with HTTP Remote User
-test_files: []
-has_rdoc: 
diff --git a/omniauth-remote-user.gemspec b/omniauth-remote-user.gemspec
index f4ab4a1..d0b4b2c 100644
--- a/omniauth-remote-user.gemspec
+++ b/omniauth-remote-user.gemspec
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
   gem.homepage = 'http://beta.softwarepublico.gov.br/gitlab/softwarepublico/omniauth-remote-user'
   gem.authors = ['Lucas Kanashiro', 'Thiago Ribeiro', 'Rodrigo Siqueira','Macartur Sousa', 'Antonio Terceiro']
   gem.require_paths = %w(lib)
-  gem.files = `git ls-files -z`.split("\x0").reject {|f| f.start_with?('spec/')}
+  gem.files = `git ls-files -z`.split("\x0")
   gem.test_files = `git ls-files -- {test,spec,feature}/*`.split("\n")
   gem.license = "Expat"
   gem.required_rubygems_version = '>= 1.3.5'
diff --git a/spec/omniauth/strategies/remote_user_spec.rb b/spec/omniauth/strategies/remote_user_spec.rb
new file mode 100644
index 0000000..41bccf5
--- /dev/null
+++ b/spec/omniauth/strategies/remote_user_spec.rb
@@ -0,0 +1,125 @@
+require 'spec_helper'
+
+describe 'Test Strategy Remote_User' do
+  let(:app) do
+    Rack::Builder.new do |b|
+      b.use Rack::Session::Cookie, :secret => 'abc123'
+      b.use OmniAuth::Strategies::RemoteUser
+      b.run  lambda { |_env| [200, {}, ['My body']] }
+    end.to_app
+  end
+
+  context 'Without HTTP_REMOTE_USER and not logged in' do
+    before(:each){
+      get '/', {}, {}
+    }
+
+    it 'Do nothing' do
+      expect(last_response.status).to eq(200)
+      expect(last_request.cookies['_remote_user']).to eq(nil)
+    end
+  end
+
+  context 'Without HTTP_REMOTE_USER and logged in' do
+    before(:each){
+      clear_cookies
+      set_cookie "_remote_user=test"
+      get '/', {}, {}
+    }
+
+    it 'Logout curreent user' do
+      expect(last_request.cookies['_remote_user']).to eq('test')
+      expect(last_response.status).to eq(302)
+      expect(last_response['Set-Cookie']).to include("_remote_user=")
+      expect(last_response['Set-Cookie']).to include("path=")
+    end
+  end
+
+  context 'With HTTP_REMOTE_USER and not logged in' do
+    before(:each){
+      get '/', {}, { 'HTTP_REMOTE_USER' => 'foobar' }
+    }
+
+    it 'logs HTTP_REMOTE_USER in' do
+      expect(last_response.status).to eq(302)
+      expect(last_response['Set-Cookie']).to include('_remote_user=foobar')
+      expect(last_response['Set-Cookie']).to include('path=')
+    end
+  end
+
+  context 'With HTTP_REMOTE_USER, logged in and current user equals HTTP_REMOTE_USER' do
+    before(:each){
+      clear_cookies
+      set_cookie "_remote_user=foobar"
+      get '/', {}, { 'HTTP_REMOTE_USER' => 'foobar' }
+    }
+
+    it 'Do nothing' do
+      expect(last_request.cookies['_remote_user']).to eq('foobar')
+      expect(last_response.status).to eq(200)
+      expect(last_response['Set-Cookie']).to eq(nil)
+    end
+  end
+
+  context 'With HTTP_REMOTE_USER, logged in and current user not equals HTTP_REMOTE_USER' do
+    before(:each){
+      clear_cookies
+      set_cookie "_remote_user=foobar"
+      get '/', {}, { 'HTTP_REMOTE_USER' => 'foobar2' }
+    }
+
+    it 'Logout current user and login HTTP_REMOTE_USER' do
+      expect(last_request.cookies['_remote_user']).to eq('foobar')
+      expect(last_response.status).to eq(302)
+    end
+  end
+
+  context 'Verify omniauth hash with HTTP_REMOTE_USER_DATA' do
+    before(:each){
+      clear_cookies
+      set_cookie "_remote_user=foobar"
+      post '/auth/RemoteUser/callback', {}, { 'HTTP_REMOTE_USER' => 'foobar',
+                                              'HTTP_REMOTE_USER_DATA' => JSON.dump({'name' => 'foobar barfoo', 'email' => 'foobar at test.com'})}
+    }
+
+    it 'Verify uid' do
+      expect(last_request.env['omniauth.auth']['uid']).to eq('foobar')
+    end
+
+    it 'Verify info' do
+      expect(last_request.env['omniauth.auth']['info']['nickname']).to eq('foobar')
+      expect(last_request.env['omniauth.auth']['info']['email']).to eq('foobar at test.com')
+      expect(last_request.env['omniauth.auth']['info']['lastname']).to eq('barfoo')
+      expect(last_request.env['omniauth.auth']['info']['firstname']).to eq('foobar')
+    end
+  end
+
+  context 'Verify omniauth.auth info without HTTP_REMOTE_USER_DATA' do
+    before(:each){
+      clear_cookies
+      set_cookie "_remote_user=foobar"
+      post '/auth/RemoteUser/callback', {}, { 'HTTP_REMOTE_USER' => 'foobar' }
+    }
+
+    it 'Verify uid' do
+      expect(last_request.env['omniauth.auth']['uid']).to eq('foobar')
+    end
+
+    it 'Verify info' do
+      expect(last_request.env['omniauth.auth']['info']).to eq({})
+    end
+  end
+
+  context 'With HTTP_REMOTE_USER and ' do
+    before(:each){
+      set_cookie "_remote_user=foobar"
+      get "auth/RemoteUser", {}, { 'HTTP_REMOTE_USER' => 'foobar' }
+    }
+
+    it 'redirect for callback' do
+      expect(last_response.status).to eq(302)
+      expect(last_response.location).to eq("/auth/RemoteUser/callback")
+    end
+  end
+
+end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
new file mode 100644
index 0000000..68ae65c
--- /dev/null
+++ b/spec/spec_helper.rb
@@ -0,0 +1,26 @@
+if RUBY_VERSION >= '1.9'
+	require 'simplecov'
+	require 'coveralls'
+	SimpleCov.formatters = [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter]
+	SimpleCov.start do
+		add_filter '/spec'
+		#minimum_coverage(90)
+	end
+end
+require 'rubygems'
+require 'bundler'
+require 'rack/test'
+require 'rspec'
+require 'rack/test'
+require 'omniauth'
+require 'omniauth/test'
+
+Bundler.setup :default, :development, :test
+
+require 'rack/test'
+require 'omniauth/remote-user'
+
+RSpec.configure do |config|
+	config.include Rack::Test::Methods
+	config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
+end

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-omniauth-remote-user.git



More information about the Pkg-ruby-extras-commits mailing list