omniauth-emma 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 +23 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +37 -0
- data/Rakefile +8 -0
- data/lib/omniauth/emma/version.rb +5 -0
- data/lib/omniauth/emma.rb +2 -0
- data/lib/omniauth/strategies/emma.rb +18 -0
- data/lib/omniauth-emma.rb +1 -0
- data/omniauth-emma.gemspec +26 -0
- data/spec/omniauth/strategies/emma_spec.rb +39 -0
- data/spec/spec_helper.rb +6 -0
- data/spec/support/shared_examples.rb +38 -0
- metadata +116 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 67dcd4ed0f9e93761b70ce1636696263e3a75308
|
4
|
+
data.tar.gz: 677b26838c7d1334520f9efbffd69327413ed97b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e08610ffbe6592c2b59554f69718c4a7e05d90216bede8455f65d54d92fab28fe836288d65997efdc4803d1ef27cb840982162d13bb56e16133a8fc50c899e18
|
7
|
+
data.tar.gz: 712c923313bc890a0ceaea7ba3517488eb00d66e437a285e6279a7ac78e065d8582dbefa4cee430ce0f65faadc778693796fb36cbf4163fa61f48733e7dfca58
|
data/.gitignore
ADDED
@@ -0,0 +1,23 @@
|
|
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
|
18
|
+
.rvmrc
|
19
|
+
.rspec
|
20
|
+
.DS_store
|
21
|
+
.idea
|
22
|
+
.idea/*
|
23
|
+
*.iml
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Jason Bynum
|
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::Emma
|
2
|
+
|
3
|
+
An Omniauth strategy for Emma
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'omniauth-emma'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install omniauth-emma
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Add the following to your `config/initializers/omniauth.rb`:
|
22
|
+
|
23
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
24
|
+
provider :emma, "client_id", "client_secret"
|
25
|
+
end
|
26
|
+
|
27
|
+
You need to insert your key and secret, which you get when you register your app with Emma.
|
28
|
+
|
29
|
+
Now just follow the README at: https://github.com/intridea/omniauth
|
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 'Add some feature'`)
|
36
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
37
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'omniauth/strategies/oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Emma < OmniAuth::Strategies::OAuth2
|
6
|
+
option :name, "emma"
|
7
|
+
|
8
|
+
option :client_options, {
|
9
|
+
:site => "https://login.e2ma.net",
|
10
|
+
:authorize_url => '/oauth/authorize',
|
11
|
+
:request_token_url => "/oauth/token"
|
12
|
+
}
|
13
|
+
|
14
|
+
uid { access_token.params['emma_id'] }
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'omniauth/emma'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'omniauth/emma/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "omniauth-emma"
|
8
|
+
spec.version = Omniauth::Emma::VERSION
|
9
|
+
spec.authors = ["Jason Bynum"]
|
10
|
+
spec.email = ["jason.bynum@gmail.com"]
|
11
|
+
spec.description = %q{Omniauth strategy for Emma}
|
12
|
+
spec.summary = %q{Omniauth strategy for Emma}
|
13
|
+
spec.homepage = "https://github.com/jbynum/omniauth-emma"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency 'rspec', '~> 2.13.0'
|
24
|
+
|
25
|
+
spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.1.1'
|
26
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'omniauth-emma'
|
3
|
+
require 'openssl'
|
4
|
+
require 'base64'
|
5
|
+
|
6
|
+
describe OmniAuth::Strategies::Emma do
|
7
|
+
before :each do
|
8
|
+
@request = double('Request')
|
9
|
+
@request.stub(:params) { {} }
|
10
|
+
@request.stub(:cookies) { {} }
|
11
|
+
@request.stub(:env) { {} }
|
12
|
+
|
13
|
+
@client_id = '321'
|
14
|
+
@client_secret = 's3cr3tes'
|
15
|
+
end
|
16
|
+
|
17
|
+
subject do
|
18
|
+
args = [@client_id, @client_secret, @options].compact
|
19
|
+
OmniAuth::Strategies::Emma.new(nil, *args).tap do |strategy|
|
20
|
+
strategy.stub(:request) { @request }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
it_should_behave_like 'an oauth2 strategy'
|
25
|
+
|
26
|
+
describe '#client' do
|
27
|
+
it 'has correct Emma site' do
|
28
|
+
subject.client.site.should eq('https://login.e2ma.net')
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'has correct authorize url' do
|
32
|
+
subject.client.options[:authorize_url].should eq('/oauth/authorize')
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'has correct token url' do
|
36
|
+
subject.client.options[:token_url].should eq('/oauth/token')
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -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
|
+
# TODO -- Get these tests passing
|
12
|
+
it 'should include any authorize params passed in the :authorize_params option' do
|
13
|
+
@options = { :authorize_params => { :foo => 'bar', :baz => 'zip' } }
|
14
|
+
subject.options.authorize_params['foo'].should eq('bar')
|
15
|
+
subject.options.authorize_params['baz'].should eq('zip')
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should include top-level options that are marked as :authorize_options' do
|
19
|
+
@options = { :authorize_options => {:scope => 'bar', :foo => 'baz'} }
|
20
|
+
subject.options.authorize_options['scope'].should eq('bar')
|
21
|
+
subject.options.authorize_options['foo'].should eq('baz')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '#token_params' do
|
26
|
+
it 'should include any authorize params passed in the :authorize_params option' do
|
27
|
+
@options = { :token_params => { :foo => 'bar', :baz => 'zip' } }
|
28
|
+
subject.token_params['foo'].should eq('bar')
|
29
|
+
subject.token_params['baz'].should eq('zip')
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should include top-level options that are marked as :authorize_options' do
|
33
|
+
@options = { :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
|
34
|
+
subject.token_params['scope'].should eq('bar')
|
35
|
+
subject.token_params['foo'].should eq('baz')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-emma
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jason Bynum
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-06-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.13.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.13.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: omniauth-oauth2
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.1.1
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.1.1
|
69
|
+
description: Omniauth strategy for Emma
|
70
|
+
email:
|
71
|
+
- jason.bynum@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- .gitignore
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE.txt
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- lib/omniauth-emma.rb
|
82
|
+
- lib/omniauth/emma.rb
|
83
|
+
- lib/omniauth/emma/version.rb
|
84
|
+
- lib/omniauth/strategies/emma.rb
|
85
|
+
- omniauth-emma.gemspec
|
86
|
+
- spec/omniauth/strategies/emma_spec.rb
|
87
|
+
- spec/spec_helper.rb
|
88
|
+
- spec/support/shared_examples.rb
|
89
|
+
homepage: https://github.com/jbynum/omniauth-emma
|
90
|
+
licenses:
|
91
|
+
- MIT
|
92
|
+
metadata: {}
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
requirements: []
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 2.0.3
|
110
|
+
signing_key:
|
111
|
+
specification_version: 4
|
112
|
+
summary: Omniauth strategy for Emma
|
113
|
+
test_files:
|
114
|
+
- spec/omniauth/strategies/emma_spec.rb
|
115
|
+
- spec/spec_helper.rb
|
116
|
+
- spec/support/shared_examples.rb
|