omniauth-pls 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +54 -0
- data/LICENSE +22 -0
- data/README.md +37 -0
- data/Rakefile +7 -0
- data/lib/omniauth/pls/version.rb +5 -0
- data/lib/omniauth/pls.rb +2 -0
- data/lib/omniauth/strategies/pls.rb +36 -0
- data/lib/omniauth-pls.rb +1 -0
- data/omniauth-pls.gemspec +24 -0
- data/spec/omniauth/strategies/pls_spec.rb +17 -0
- data/spec/shared_examples.rb +38 -0
- data/spec/spec_helper.rb +8 -0
- metadata +118 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c9ff4935af85fe1b58b1cb7320d033fb2b401a3b
|
4
|
+
data.tar.gz: 451b4ca658fc28cd1140447c4b76252a889a2fa1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ba5d07671c1d16e55811fa7038a1755f7553fcee46638b1c983781896615052a5445467e00ceb0e268ef622ab5cb3cdf923e070ab1143ea6d6b097f797c67407
|
7
|
+
data.tar.gz: 056765b0868f1516f512723efde6dafef8bafe31c2703fa5b80c65868a6d568bc835f8f557ec112c9267d7975b84d2c0e5cb31a15a6d350bc1543f8642d76287
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
.idea
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
omniauth-pls (0.0.1)
|
5
|
+
multi_json
|
6
|
+
omniauth-oauth2
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
diff-lcs (1.2.5)
|
12
|
+
faraday (0.9.1)
|
13
|
+
multipart-post (>= 1.2, < 3)
|
14
|
+
hashie (3.4.0)
|
15
|
+
jwt (1.4.1)
|
16
|
+
multi_json (1.11.0)
|
17
|
+
multi_xml (0.5.5)
|
18
|
+
multipart-post (2.0.0)
|
19
|
+
oauth2 (1.0.0)
|
20
|
+
faraday (>= 0.8, < 0.10)
|
21
|
+
jwt (~> 1.0)
|
22
|
+
multi_json (~> 1.3)
|
23
|
+
multi_xml (~> 0.5)
|
24
|
+
rack (~> 1.2)
|
25
|
+
omniauth (1.2.2)
|
26
|
+
hashie (>= 1.2, < 4)
|
27
|
+
rack (~> 1.0)
|
28
|
+
omniauth-oauth2 (1.2.0)
|
29
|
+
faraday (>= 0.8, < 0.10)
|
30
|
+
multi_json (~> 1.3)
|
31
|
+
oauth2 (~> 1.0)
|
32
|
+
omniauth (~> 1.2)
|
33
|
+
rack (1.6.0)
|
34
|
+
rake (10.3.2)
|
35
|
+
rspec (3.1.0)
|
36
|
+
rspec-core (~> 3.1.0)
|
37
|
+
rspec-expectations (~> 3.1.0)
|
38
|
+
rspec-mocks (~> 3.1.0)
|
39
|
+
rspec-core (3.1.7)
|
40
|
+
rspec-support (~> 3.1.0)
|
41
|
+
rspec-expectations (3.1.2)
|
42
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
+
rspec-support (~> 3.1.0)
|
44
|
+
rspec-mocks (3.1.3)
|
45
|
+
rspec-support (~> 3.1.0)
|
46
|
+
rspec-support (3.1.2)
|
47
|
+
|
48
|
+
PLATFORMS
|
49
|
+
ruby
|
50
|
+
|
51
|
+
DEPENDENCIES
|
52
|
+
omniauth-pls!
|
53
|
+
rake
|
54
|
+
rspec
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Cru
|
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,37 @@
|
|
1
|
+
# Omniauth::PLS
|
2
|
+
|
3
|
+
http://www.myletterservice.org/ strategy for OmniAuth 2.0
|
4
|
+
|
5
|
+
Based on [omniauth-prayer-letters](https://github.com/CruGlobal/omniauth-prayer-letters)
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'omniauth-pls'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install omniauth-pls
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
27
|
+
provider :pls, ENV['PLS_CLIENT_ID'], ENV['PLS_CLIENT_SECRET']
|
28
|
+
end
|
29
|
+
```
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
1. Fork it
|
34
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
35
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
36
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
37
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/lib/omniauth/pls.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
require 'multi_json'
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
class Pls < OmniAuth::Strategies::OAuth2
|
7
|
+
option :name, 'pls'
|
8
|
+
|
9
|
+
option :client_options, {
|
10
|
+
site: 'https://www.myletterservice.org',
|
11
|
+
authorize_url: '/oauth/authorize',
|
12
|
+
token_url: '/oauth/token'
|
13
|
+
}
|
14
|
+
|
15
|
+
uid { raw_info['id'] }
|
16
|
+
|
17
|
+
info do
|
18
|
+
{}
|
19
|
+
end
|
20
|
+
|
21
|
+
extra do
|
22
|
+
{ 'raw_info' => raw_info }
|
23
|
+
end
|
24
|
+
|
25
|
+
def raw_info
|
26
|
+
@raw_info ||= {}
|
27
|
+
end
|
28
|
+
|
29
|
+
def request_phase
|
30
|
+
options.request_params ||= {}
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/omniauth-pls.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'omniauth/pls'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/omniauth/pls/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Josh Starcher", "David Raffensperger"]
|
6
|
+
gem.email = ["josh.starcher@gmail.com", "draff8660@gmail.com"]
|
7
|
+
gem.description = %q{PLS strategy for omniauth}
|
8
|
+
gem.summary = %q{PLS for omniauth}
|
9
|
+
gem.homepage = 'https://github.com/CruGlobal/omniauth-pls'
|
10
|
+
gem.license = 'MIT'
|
11
|
+
|
12
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
13
|
+
gem.files = `git ls-files`.split("\n")
|
14
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
15
|
+
gem.name = "omniauth-pls"
|
16
|
+
gem.require_paths = ["lib"]
|
17
|
+
gem.version = OmniAuth::Pls::VERSION
|
18
|
+
|
19
|
+
gem.add_runtime_dependency 'omniauth-oauth2', '~> 1.2'
|
20
|
+
gem.add_runtime_dependency 'multi_json', '~> 1.11'
|
21
|
+
|
22
|
+
gem.add_development_dependency 'rspec', '~> 3.1'
|
23
|
+
gem.add_development_dependency 'rake', '~> 10.3'
|
24
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'omniauth-pls'
|
3
|
+
|
4
|
+
describe OmniAuth::Strategies::Pls do
|
5
|
+
let(:app) { lambda { [200, {}, ["Hello."]] } }
|
6
|
+
let(:subject) { OmniAuth::Strategies::Pls.new(app, 'test_client_id', 'test_client_secret', @options) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
OmniAuth.config.test_mode = true
|
10
|
+
end
|
11
|
+
|
12
|
+
after do
|
13
|
+
OmniAuth.config.test_mode = false
|
14
|
+
end
|
15
|
+
|
16
|
+
it_should_behave_like 'an oauth2 strategy'
|
17
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# NOTE it would be useful if this lived in omniauth-oauth2 eventually
|
2
|
+
shared_examples 'an oauth2 strategy' do
|
3
|
+
describe '#client' do
|
4
|
+
it 'should be initialized with symbolized client_options' do
|
5
|
+
@options = { :client_options => { 'authorize_url' => 'https://example.com' } }
|
6
|
+
subject.client.options[:authorize_url].should == 'https://example.com'
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#authorize_params' do
|
11
|
+
it 'should include any authorize params passed in the :authorize_params option' do
|
12
|
+
@options = { :authorize_params => { :foo => 'bar', :baz => 'zip' } }
|
13
|
+
subject.authorize_params['foo'].should eq('bar')
|
14
|
+
subject.authorize_params['baz'].should eq('zip')
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should include top-level options that are marked as :authorize_options' do
|
18
|
+
@options = { :authorize_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
|
19
|
+
subject.authorize_params['scope'].should eq('bar')
|
20
|
+
subject.authorize_params['foo'].should eq('baz')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#token_params' do
|
25
|
+
it 'should include any authorize params passed in the :authorize_params option' do
|
26
|
+
@options = { :token_params => { :foo => 'bar', :baz => 'zip' } }
|
27
|
+
subject.token_params['foo'].should eq('bar')
|
28
|
+
subject.token_params['baz'].should eq('zip')
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should include top-level options that are marked as :authorize_options' do
|
32
|
+
@options = { :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
|
33
|
+
subject.token_params['scope'].should eq('bar')
|
34
|
+
subject.token_params['foo'].should eq('baz')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-pls
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Josh Starcher
|
8
|
+
- David Raffensperger
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-08-03 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: omniauth-oauth2
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.2'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.2'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: multi_json
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.11'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.11'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rspec
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '3.1'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '3.1'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rake
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '10.3'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '10.3'
|
70
|
+
description: PLS strategy for omniauth
|
71
|
+
email:
|
72
|
+
- josh.starcher@gmail.com
|
73
|
+
- draff8660@gmail.com
|
74
|
+
executables: []
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- ".gitignore"
|
79
|
+
- CHANGELOG.md
|
80
|
+
- Gemfile
|
81
|
+
- Gemfile.lock
|
82
|
+
- LICENSE
|
83
|
+
- README.md
|
84
|
+
- Rakefile
|
85
|
+
- lib/omniauth-pls.rb
|
86
|
+
- lib/omniauth/pls.rb
|
87
|
+
- lib/omniauth/pls/version.rb
|
88
|
+
- lib/omniauth/strategies/pls.rb
|
89
|
+
- omniauth-pls.gemspec
|
90
|
+
- spec/omniauth/strategies/pls_spec.rb
|
91
|
+
- spec/shared_examples.rb
|
92
|
+
- spec/spec_helper.rb
|
93
|
+
homepage: https://github.com/CruGlobal/omniauth-pls
|
94
|
+
licenses:
|
95
|
+
- MIT
|
96
|
+
metadata: {}
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
requirements: []
|
112
|
+
rubyforge_project:
|
113
|
+
rubygems_version: 2.4.3
|
114
|
+
signing_key:
|
115
|
+
specification_version: 4
|
116
|
+
summary: PLS for omniauth
|
117
|
+
test_files: []
|
118
|
+
has_rdoc:
|