omniauth-dobt 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ae99e10629bf4ddac125f6a869aca8619b39160d
4
+ data.tar.gz: e003de9ea6671e428e7ff71c12bb17ba59e0ef1e
5
+ SHA512:
6
+ metadata.gz: c773f58fe4566fc3a6be5fa32f4155394ad0b3d50e0b1865dd6ce5da584220997192b14685d957f90865b6fe28b9efd83a352bb708386aadea78a523da2fee8b
7
+ data.tar.gz: d261c018d9c1e66e327e2a83e18045248db8cf4c426583c3b3e170f6ea17f6cb4761f6cbfd48a8351ff545a9997da73812131c5a89bf99bcd7f2ef0d480aca75
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,3 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
data/README.md ADDED
@@ -0,0 +1,5 @@
1
+ OmniAuth DOBT
2
+ ----
3
+
4
+ Internal OmniAuth strategy for authenticating with the [DOBT Platform](https://github.com/dobtco/platform).
5
+
@@ -0,0 +1,2 @@
1
+ require "omniauth-dobt/version"
2
+ require 'omniauth/strategies/dobt'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Dobt
3
+ VERSION = '0.0.2'
4
+ end
5
+ end
@@ -0,0 +1,55 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Dobt < OmniAuth::Strategies::OAuth2
6
+ option :name, :dobt
7
+
8
+ uid { raw_info['id'] }
9
+
10
+ info do
11
+ {
12
+ name: raw_info['name'] || raw_info['email'],
13
+ email: raw_info['email']
14
+ }
15
+ end
16
+
17
+ extra do
18
+ {
19
+ remember_me: raw_info['remember_me'],
20
+ two_factor_enabled: raw_info['two_factor_enabled'],
21
+ email_confirmed: raw_info['email_confirmed']
22
+ }
23
+ end
24
+
25
+ # Pass a few params to DOBT platform
26
+ def authorize_params
27
+ super.merge(
28
+ pick(
29
+ request.params,
30
+ :invited_email,
31
+ :invited_name,
32
+ :request_signup,
33
+ :use_previous_grant
34
+ )
35
+ )
36
+ end
37
+
38
+ def raw_info
39
+ @raw_info ||= access_token.get('/api/account.json?v=1').parsed
40
+ end
41
+
42
+ private
43
+
44
+ def pick(obj, *keys)
45
+ stringified_keys = keys.map(&:to_s)
46
+
47
+ {}.tap do |h|
48
+ obj.each do |key, value|
49
+ h[key.to_sym] = value if stringified_keys.include?(key.to_s)
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,22 @@
1
+ require File.expand_path('../lib/omniauth-dobt/version', __FILE__)
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.authors = ['Adam Becker']
5
+ gem.email = ['adam@dobt.co']
6
+ gem.description = %q{Internal OmniAuth strategy for the DOBT Platform.}
7
+ gem.summary = %q{Internal OmniAuth strategy for the DOBT Platform.}
8
+ gem.homepage = 'https://github.com/dobtco/omniauth-dobt'
9
+ gem.license = 'MIT'
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = "omniauth-dobt"
15
+ gem.require_paths = ['lib']
16
+ gem.version = OmniAuth::Dobt::VERSION
17
+
18
+ gem.add_dependency 'omniauth', '~> 1.0'
19
+
20
+ # https://github.com/intridea/omniauth-oauth2/issues/81
21
+ gem.add_dependency 'omniauth-oauth2', '1.3.1'
22
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-dobt
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Adam Becker
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-08-04 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.3.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.3.1
41
+ description: Internal OmniAuth strategy for the DOBT Platform.
42
+ email:
43
+ - adam@dobt.co
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - README.md
51
+ - lib/omniauth-dobt.rb
52
+ - lib/omniauth-dobt/version.rb
53
+ - lib/omniauth/strategies/dobt.rb
54
+ - omniauth-dobt.gemspec
55
+ homepage: https://github.com/dobtco/omniauth-dobt
56
+ licenses:
57
+ - MIT
58
+ metadata: {}
59
+ post_install_message:
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ requirements: []
74
+ rubyforge_project:
75
+ rubygems_version: 2.5.1
76
+ signing_key:
77
+ specification_version: 4
78
+ summary: Internal OmniAuth strategy for the DOBT Platform.
79
+ test_files: []
80
+ has_rdoc: