omniauth-brapp 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.rspec +1 -0
- data/Gemfile +12 -0
- data/Guardfile +10 -0
- data/LICENSE.txt +7 -0
- data/README.md +5 -0
- data/Rakefile +8 -0
- data/circle.yml +3 -0
- data/lib/omniauth-brapp.rb +2 -0
- data/lib/omniauth-brapp/version.rb +5 -0
- data/lib/omniauth/strategies/brapp.rb +51 -0
- data/omniauth-brapp.gemspec +27 -0
- data/spec/omniauth/strategies/brapp_spec.rb +69 -0
- data/spec/spec_helper.rb +18 -0
- metadata +150 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6c913757b2df67d319b7fb01f2e81de9efefe87c
|
4
|
+
data.tar.gz: d381d6fe2d980da47a4997ebef57a98bb0666de3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5e30b92c8159198ec14ac7061a6de8e0391b8d18f03c1fe7d829e3251a69e97b251b927fb8a7fade8240d6f99650592993d874d087f2c790de98648160172553
|
7
|
+
data.tar.gz: 639ad9df9775919250bc0bb472e8a5946bdb9059f1c53d1d6d3cf2a2d5467a8f4e3c1dae289b422e752057ec76169c484d0589756df4eef8a8efe218c94ca865
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/Gemfile
ADDED
data/Guardfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright (c) 2011 Michael Bleigh and Intridea, Inc.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
[![Circle CI](https://circleci.com/gh/brappmusic/omniauth-brapp/tree/master.svg?style=svg&circle-token=66bc23a7bab6610f1113639a4217932e40da081c)](https://circleci.com/gh/brappmusic/omniauth-brapp/tree/master)
|
2
|
+
|
3
|
+
# OmniAuth Brapp
|
4
|
+
|
5
|
+
This is the official OmniAuth strategy for authenticating to Brapp.
|
data/Rakefile
ADDED
data/circle.yml
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Brapp < OmniAuth::Strategies::OAuth2
|
6
|
+
option :name, :brapp
|
7
|
+
|
8
|
+
option :client_options, {
|
9
|
+
:site => 'https://api.brappmusic.com',
|
10
|
+
:authorize_url => '/oauth/authorize'
|
11
|
+
}
|
12
|
+
|
13
|
+
def request_phase
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
17
|
+
def authorize_params
|
18
|
+
super.tap do |params|
|
19
|
+
%w[scope client_options].each do |v|
|
20
|
+
if request.params[v]
|
21
|
+
params[v.to_sym] = request.params[v]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
uid { raw_info['data']['id'].to_s }
|
28
|
+
|
29
|
+
info do
|
30
|
+
{
|
31
|
+
'name' => raw_info['data']['full_name'],
|
32
|
+
'email' => raw_info['data']['email'],
|
33
|
+
'full_name' => raw_info['data']['full_name'],
|
34
|
+
'nickname' => raw_info['data']['username']
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
extra do
|
39
|
+
{
|
40
|
+
'admin' => raw_info['data']['admin']
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
def raw_info
|
45
|
+
@raw_info ||= access_token.get('/api/v1/users/me.json').parsed
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
OmniAuth.config.add_camelization 'github', 'Brapp'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/omniauth-brapp/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Levent Ali"]
|
6
|
+
gem.email = ["levent@purebreeze.com"]
|
7
|
+
gem.description = %q{OmniAuth strategy for Brapp.}
|
8
|
+
gem.summary = %q{OmniAuth strategy for Brapp.}
|
9
|
+
gem.homepage = "https://github.com/brappmusic/omniauth-brapp"
|
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-brapp"
|
16
|
+
gem.require_paths = ["lib"]
|
17
|
+
gem.version = OmniAuth::Brapp::VERSION
|
18
|
+
|
19
|
+
gem.add_dependency 'omniauth', '~> 1.0'
|
20
|
+
# Nothing lower than omniauth-oauth2 1.1.1
|
21
|
+
# http://www.rubysec.com/advisories/CVE-2012-6134/
|
22
|
+
gem.add_dependency 'omniauth-oauth2', '>= 1.1.1', '< 2.0'
|
23
|
+
gem.add_development_dependency 'rspec', '~> 2.7'
|
24
|
+
gem.add_development_dependency 'rack-test', '~> 0.6.3'
|
25
|
+
gem.add_development_dependency 'simplecov', '~> 0.9.2'
|
26
|
+
gem.add_development_dependency 'webmock', '~> 1.20'
|
27
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe OmniAuth::Strategies::Brapp do
|
4
|
+
let(:access_token) { stub('AccessToken', :options => {}) }
|
5
|
+
let(:parsed_response) {
|
6
|
+
{data:
|
7
|
+
{
|
8
|
+
email: 'levent@brappmusic.com',
|
9
|
+
admin: 'true',
|
10
|
+
nickname: 'lebreeze'
|
11
|
+
}
|
12
|
+
}
|
13
|
+
}
|
14
|
+
let(:response) { stub('Response', :parsed => parsed_response) }
|
15
|
+
|
16
|
+
let(:enterprise_site) { 'https://some.other.site.com/api/v3' }
|
17
|
+
let(:enterprise_authorize_url) { 'https://some.other.site.com/login/oauth/authorize' }
|
18
|
+
let(:enterprise_token_url) { 'https://some.other.site.com/login/oauth/access_token' }
|
19
|
+
let(:enterprise) do
|
20
|
+
OmniAuth::Strategies::Brapp.new('BRAPP_KEY', 'BRAPP_SECRET',
|
21
|
+
{
|
22
|
+
:client_options => {
|
23
|
+
:site => enterprise_site,
|
24
|
+
:authorize_url => enterprise_authorize_url,
|
25
|
+
:token_url => enterprise_token_url
|
26
|
+
}
|
27
|
+
}
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
subject do
|
32
|
+
OmniAuth::Strategies::Brapp.new({})
|
33
|
+
end
|
34
|
+
|
35
|
+
before(:each) do
|
36
|
+
subject.stub!(:access_token).and_return(access_token)
|
37
|
+
end
|
38
|
+
|
39
|
+
context "client options" do
|
40
|
+
it 'should have correct site' do
|
41
|
+
subject.options.client_options.site.should eq("https://api.brappmusic.com")
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should have correct authorize url' do
|
45
|
+
subject.options.client_options.authorize_url.should eq('/oauth/authorize')
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "should be overrideable" do
|
49
|
+
it "for site" do
|
50
|
+
enterprise.options.client_options.site.should eq(enterprise_site)
|
51
|
+
end
|
52
|
+
|
53
|
+
it "for authorize url" do
|
54
|
+
enterprise.options.client_options.authorize_url.should eq(enterprise_authorize_url)
|
55
|
+
end
|
56
|
+
|
57
|
+
it "for token url" do
|
58
|
+
enterprise.options.client_options.token_url.should eq(enterprise_token_url)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context "#raw_info" do
|
64
|
+
it "should use relative paths" do
|
65
|
+
access_token.should_receive(:get).with('/api/v1/users/me.json').and_return(response)
|
66
|
+
subject.raw_info.should eq(parsed_response)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
$:.unshift File.expand_path('..', __FILE__)
|
2
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
require 'simplecov'
|
4
|
+
SimpleCov.start do
|
5
|
+
add_filter 'vendor'
|
6
|
+
end
|
7
|
+
require 'rspec'
|
8
|
+
require 'rack/test'
|
9
|
+
require 'webmock/rspec'
|
10
|
+
require 'omniauth'
|
11
|
+
require 'omniauth-brapp'
|
12
|
+
|
13
|
+
RSpec.configure do |config|
|
14
|
+
config.include WebMock::API
|
15
|
+
config.include Rack::Test::Methods
|
16
|
+
config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
|
17
|
+
end
|
18
|
+
|
metadata
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-brapp
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.6
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Levent Ali
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: omniauth
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: omniauth-oauth2
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.1.1
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '2.0'
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.1.1
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '2.0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '2.7'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '2.7'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rack-test
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 0.6.3
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 0.6.3
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: simplecov
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: 0.9.2
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 0.9.2
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: webmock
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '1.20'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '1.20'
|
103
|
+
description: OmniAuth strategy for Brapp.
|
104
|
+
email:
|
105
|
+
- levent@purebreeze.com
|
106
|
+
executables: []
|
107
|
+
extensions: []
|
108
|
+
extra_rdoc_files: []
|
109
|
+
files:
|
110
|
+
- ".gitignore"
|
111
|
+
- ".rspec"
|
112
|
+
- Gemfile
|
113
|
+
- Guardfile
|
114
|
+
- LICENSE.txt
|
115
|
+
- README.md
|
116
|
+
- Rakefile
|
117
|
+
- circle.yml
|
118
|
+
- lib/omniauth-brapp.rb
|
119
|
+
- lib/omniauth-brapp/version.rb
|
120
|
+
- lib/omniauth/strategies/brapp.rb
|
121
|
+
- omniauth-brapp.gemspec
|
122
|
+
- spec/omniauth/strategies/brapp_spec.rb
|
123
|
+
- spec/spec_helper.rb
|
124
|
+
homepage: https://github.com/brappmusic/omniauth-brapp
|
125
|
+
licenses:
|
126
|
+
- MIT
|
127
|
+
metadata: {}
|
128
|
+
post_install_message:
|
129
|
+
rdoc_options: []
|
130
|
+
require_paths:
|
131
|
+
- lib
|
132
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
requirements: []
|
143
|
+
rubyforge_project:
|
144
|
+
rubygems_version: 2.4.5
|
145
|
+
signing_key:
|
146
|
+
specification_version: 4
|
147
|
+
summary: OmniAuth strategy for Brapp.
|
148
|
+
test_files:
|
149
|
+
- spec/omniauth/strategies/brapp_spec.rb
|
150
|
+
- spec/spec_helper.rb
|