omniauth-passport 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omniauth-passport.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Tim Cooper
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # OmniAuth Passport
2
+
3
+ This gem contains the Everyday Hero Passport strategy for OmniAuth.
4
+
5
+ ## Experimental
6
+
7
+ This gem will only work if you have a copy of our OAuth2 server running locally on http://passport.edh.dev which probably isn't you. Once we sought out the URL structure I will make a 1.0.0 release.
8
+
9
+ ## How To Use It
10
+
11
+ Usage is as per any other OmniAuth 2.0 strategy. Add the strategy to your `Gemfile`:
12
+
13
+ gem 'omniauth-passport', '~> 0.0.1'
14
+
15
+ After adding the gem you will need to `bundle install` and create `config/initializers/omniauth.rb`.
16
+
17
+ Rails.application.config.middleware.use OmniAuth::Builder do
18
+ provider :passport, ENV['PASSPORT_KEY'], ENV['PASSPORT_SECRET']
19
+ end
20
+
21
+ The typical convention for key / secret pairs is storing them in an environment variable. Lots of tools (e.g. POW and Procfile) will source an environment file before loading which is a great place to put the environment variables.
22
+
23
+ Currently we are returning the users `name`, `email` and `uid`.
24
+
25
+ For more information on hooking up omniauth checkout the README at: https://github.com/intridea/omniauth
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,26 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Passport < OmniAuth::Strategies::OAuth2
6
+ option :name, 'passport'
7
+ option :client_options, {:site => 'http://passport.edh.dev'}
8
+
9
+ uid { raw_info['id'] }
10
+
11
+ info do
12
+ {
13
+ :email => raw_info['email'],
14
+ :name => raw_info['name']
15
+ }
16
+ end
17
+
18
+ def raw_info
19
+ @raw_info ||= begin
20
+ parsed = access_token.get('/api/v1/me').parsed
21
+ parsed.fetch 'user', Hash.new
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module Passport
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require 'omniauth-passport/version'
2
+ require 'omniauth/strategies/passport'
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/omniauth-passport/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Tim Cooper"]
6
+ gem.email = ["timc@everydayhero.com.au"]
7
+ gem.description = %q{OmniAuth strategy for Everyday Hero's Passport}
8
+ gem.summary = %q{OmniAuth strategy for Everyday Hero's Passport}
9
+ gem.homepage = ""
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "omniauth-passport"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Omniauth::Passport::VERSION
17
+
18
+ gem.add_runtime_dependency 'omniauth-oauth2', '~> 1.0.2'
19
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-passport
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Tim Cooper
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-06-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: omniauth-oauth2
16
+ requirement: &70186521212040 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.0.2
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70186521212040
25
+ description: OmniAuth strategy for Everyday Hero's Passport
26
+ email:
27
+ - timc@everydayhero.com.au
28
+ executables: []
29
+ extensions: []
30
+ extra_rdoc_files: []
31
+ files:
32
+ - .gitignore
33
+ - Gemfile
34
+ - LICENSE
35
+ - README.md
36
+ - Rakefile
37
+ - lib/omniauth-passport.rb
38
+ - lib/omniauth-passport/version.rb
39
+ - lib/omniauth/strategies/passport.rb
40
+ - omniauth-passport.gemspec
41
+ homepage: ''
42
+ licenses: []
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ none: false
49
+ requirements:
50
+ - - ! '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ! '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubyforge_project:
61
+ rubygems_version: 1.8.11
62
+ signing_key:
63
+ specification_version: 3
64
+ summary: OmniAuth strategy for Everyday Hero's Passport
65
+ test_files: []