omniauth-shuttlerock-oauth2 0.0.2
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.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +5 -0
- data/README.md +61 -0
- data/Rakefile +7 -0
- data/lib/omniauth-shuttlerock-oauth2.rb +1 -0
- data/lib/omniauth/shuttlerock_oauth2.rb +1 -0
- data/lib/omniauth/shuttlerock_oauth2/version.rb +5 -0
- data/lib/omniauth/strategies/shuttlerock_oauth2.rb +30 -0
- data/omniauth-shuttlerock-oauth2.gemspec +25 -0
- data/spec/omniauth/strategies/shuttlerock_oauth2_spec.rb +21 -0
- data/spec/spec_helper.rb +15 -0
- metadata +144 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f96599237511d76b27e47f08a6f3eb58bce62a5a
|
4
|
+
data.tar.gz: be8d3e20cbb861ccfa63b5811114b4367924064f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0ec68a6e888f9771a5f26ff12e6905dbac61d5b7abd004520299b00f3d73b536b609a5f1f3c0fe617fd14ae9d5319214781e659393633986d0f77f54669135ef
|
7
|
+
data.tar.gz: 83183ae343173bdba7107754539a721379e9a9dfda22879ccd432c35002e1a36984ca38aaec60f3f241916517ecd0769b1520f057abedc1d9f445bd768bcd098
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
.ruby-gemset
|
7
|
+
.ruby-version
|
8
|
+
.rvmrc
|
9
|
+
Gemfile.lock
|
10
|
+
InstalledFiles
|
11
|
+
_yardoc
|
12
|
+
coverage
|
13
|
+
doc/
|
14
|
+
lib/bundler/man
|
15
|
+
pkg
|
16
|
+
rdoc
|
17
|
+
spec/reports
|
18
|
+
test/tmp
|
19
|
+
test/version_tmp
|
20
|
+
tmp
|
21
|
+
.powenv
|
22
|
+
.idea/
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# OmniAuth Shuttlerock
|
2
|
+
|
3
|
+
This gem contains the Shuttlerock strategy for OmniAuth.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'omniauth-shuttlerock-oauth2', :git => 'https://github.com/Shuttlerock/omniauth-shuttlerock-oauth2.git'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
```sh
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
### Rails
|
23
|
+
|
24
|
+
If you're using Rails, you need to add the strategy to your `Gemfile`:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
gem 'omniauth-shuttlerock-oauth2'
|
28
|
+
```
|
29
|
+
|
30
|
+
Once you've added the gem to your project, you need to add the following to your `config/initializers/omniauth.rb`:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
34
|
+
provider :shuttlerock_oauth2, "client_id", "client_secret"
|
35
|
+
end
|
36
|
+
```
|
37
|
+
|
38
|
+
Enter your `client_id` and `client_secret`, which you receive when you register your application with Shuttlerock.
|
39
|
+
|
40
|
+
Now just follow the README at: https://github.com/intridea/omniauth
|
41
|
+
|
42
|
+
### Sinatra
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
require 'omniauth'
|
46
|
+
require 'omniauth-shuttlerock-oauth2'
|
47
|
+
|
48
|
+
use Rack::Session::Cookie
|
49
|
+
use OmniAuth::Builder do
|
50
|
+
provider :shuttlerock_oauth2, "client_id", "client_secret"
|
51
|
+
end
|
52
|
+
|
53
|
+
get '/auth/:provider/callback' do
|
54
|
+
# Do something with auth_hash
|
55
|
+
redirect to('/')
|
56
|
+
end
|
57
|
+
|
58
|
+
def auth_hash
|
59
|
+
request.env['omniauth.auth']
|
60
|
+
end
|
61
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require File.join('omniauth', 'shuttlerock_oauth2')
|
@@ -0,0 +1 @@
|
|
1
|
+
require File.join('omniauth', 'strategies', 'shuttlerock_oauth2')
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'multi_json'
|
2
|
+
require 'omniauth/strategies/oauth2'
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
class ShuttlerockOauth2 < OmniAuth::Strategies::OAuth2
|
7
|
+
option :name, 'shuttlerock_oauth2'
|
8
|
+
|
9
|
+
option :client_options, {
|
10
|
+
site: ENV['SHUTTLEROCK_OAUTH2_SITE'] || 'https://login.shuttlerock.com',
|
11
|
+
request_token_url: '/oauth/request_token',
|
12
|
+
authorize_url: '/oauth/authorize',
|
13
|
+
token_url: '/oauth/token',
|
14
|
+
}
|
15
|
+
|
16
|
+
uid { raw_info['uid'] }
|
17
|
+
|
18
|
+
info do
|
19
|
+
{
|
20
|
+
email: raw_info['email'],
|
21
|
+
roles: raw_info['roles'],
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def raw_info
|
26
|
+
@raw_info ||= MultiJson.decode(access_token.get('/api/v1/me').body)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path(File.join('..', 'lib', 'omniauth', 'shuttlerock_oauth2', 'version'), __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "omniauth-shuttlerock-oauth2"
|
6
|
+
s.version = OmniAuth::ShuttlerockOauth2::VERSION
|
7
|
+
s.authors = ['Alexey Vokhmin', 'Dave Perrett', 'Oleg Dashevskii']
|
8
|
+
s.email = ['avokhmin@gmail.com', 'dave@recurser.com', 'be9@be9.ru']
|
9
|
+
s.homepage = "https://github.com/Shuttlerock/omniauth-shuttlerock-oauth2"
|
10
|
+
s.summary = %q{OmniAuth strategy for Shuttlerock.}
|
11
|
+
s.description = %q{OmniAuth strategy for Shuttlerock.}
|
12
|
+
|
13
|
+
s.rubyforge_project = "omniauth-shuttlerock-oauth2"
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
|
19
|
+
s.add_runtime_dependency 'multi_json'
|
20
|
+
s.add_runtime_dependency 'omniauth-oauth2'
|
21
|
+
s.add_development_dependency 'rspec', '~> 2.7'
|
22
|
+
s.add_development_dependency 'rack-test'
|
23
|
+
s.add_development_dependency 'simplecov'
|
24
|
+
s.add_development_dependency 'webmock'
|
25
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe OmniAuth::Strategies::ShuttlerockOauth2 do
|
4
|
+
subject do
|
5
|
+
OmniAuth::Strategies::ShuttlerockOauth2.new({})
|
6
|
+
end
|
7
|
+
|
8
|
+
context "client options" do
|
9
|
+
it 'should have correct name' do
|
10
|
+
subject.options.name.should eq('shuttlerock_oauth2')
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should have correct site' do
|
14
|
+
subject.options.client_options.site.should eq('https://login.shuttlerock.com')
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should have correct authorize url' do
|
18
|
+
subject.options.client_options.authorize_url.should eq('/oauth/authorize')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
$:.unshift File.expand_path('..', __FILE__)
|
2
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
require 'simplecov'
|
4
|
+
SimpleCov.start
|
5
|
+
require 'rspec'
|
6
|
+
require 'rack/test'
|
7
|
+
require 'webmock/rspec'
|
8
|
+
require 'omniauth'
|
9
|
+
require 'omniauth-shuttlerock-oauth2'
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
config.include WebMock::API
|
13
|
+
config.include Rack::Test::Methods
|
14
|
+
config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-shuttlerock-oauth2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexey Vokhmin
|
8
|
+
- Dave Perrett
|
9
|
+
- Oleg Dashevskii
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2016-07-26 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: multi_json
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '0'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: omniauth-oauth2
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: rspec
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '2.7'
|
50
|
+
type: :development
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '2.7'
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: rack-test
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
type: :development
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: simplecov
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
type: :development
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: webmock
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
type: :development
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
description: OmniAuth strategy for Shuttlerock.
|
100
|
+
email:
|
101
|
+
- avokhmin@gmail.com
|
102
|
+
- dave@recurser.com
|
103
|
+
- be9@be9.ru
|
104
|
+
executables: []
|
105
|
+
extensions: []
|
106
|
+
extra_rdoc_files: []
|
107
|
+
files:
|
108
|
+
- ".gitignore"
|
109
|
+
- Gemfile
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- lib/omniauth-shuttlerock-oauth2.rb
|
113
|
+
- lib/omniauth/shuttlerock_oauth2.rb
|
114
|
+
- lib/omniauth/shuttlerock_oauth2/version.rb
|
115
|
+
- lib/omniauth/strategies/shuttlerock_oauth2.rb
|
116
|
+
- omniauth-shuttlerock-oauth2.gemspec
|
117
|
+
- spec/omniauth/strategies/shuttlerock_oauth2_spec.rb
|
118
|
+
- spec/spec_helper.rb
|
119
|
+
homepage: https://github.com/Shuttlerock/omniauth-shuttlerock-oauth2
|
120
|
+
licenses: []
|
121
|
+
metadata: {}
|
122
|
+
post_install_message:
|
123
|
+
rdoc_options: []
|
124
|
+
require_paths:
|
125
|
+
- lib
|
126
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
requirements: []
|
137
|
+
rubyforge_project: omniauth-shuttlerock-oauth2
|
138
|
+
rubygems_version: 2.5.1
|
139
|
+
signing_key:
|
140
|
+
specification_version: 4
|
141
|
+
summary: OmniAuth strategy for Shuttlerock.
|
142
|
+
test_files:
|
143
|
+
- spec/omniauth/strategies/shuttlerock_oauth2_spec.rb
|
144
|
+
- spec/spec_helper.rb
|