omniauth-booker 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 182955a4cdbbdb31051cb0d7c7264f2c0a4b07c0
4
+ data.tar.gz: a7bfb30bd3f4802b185afe8392ce0c343f1858de
5
+ SHA512:
6
+ metadata.gz: 2cd0176ba43e6a9f30ec9c139f05125dacaa389ad30114c157c6732ca2fde0294038291c41443741f1f9fce5c2ce05ea61ce050fad9d9028b17d194fbb840e80
7
+ data.tar.gz: bd4f0d56cfd3d853e85a62474215aee93337bda0e4b098a19cb7d9985f939393de04c193aa105079d8a9302e4b23f79825adb03f0d4bb4bd1ff9e2822402dbf1
@@ -0,0 +1 @@
1
+ require 'omniauth/strategies/booker'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Booker
3
+ VERSION = '1.0.0'
4
+ end
5
+ end
@@ -0,0 +1,33 @@
1
+ require 'omniauth-oauth2'
2
+ require 'jwt'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class Booker < OmniAuth::Strategies::OAuth2
7
+ option :name, :booker
8
+
9
+ option :client_options, {
10
+ site: ENV['BOOKER_OMNIAUTH_BASE_URL'] || 'https://apicurrent.identity.booker.ninja',
11
+ authorize_url: '/auth/connect/authorize',
12
+ token_url: '/auth/connect/token'
13
+ }
14
+
15
+ uid { raw_info['sub'].to_i }
16
+
17
+ info do
18
+ {
19
+ name: raw_info['name'],
20
+ location_id: raw_info['location_id'].to_i,
21
+ user_name: raw_info['user_name'],
22
+ account_name: raw_info['account_name'],
23
+ user_type: raw_info['user_type'].to_i,
24
+ roles: raw_info['roles']
25
+ }
26
+ end
27
+
28
+ def raw_info
29
+ @raw_info ||= JWT.decode(access_token.token, nil, false, verify_not_before: false)[0]
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'omniauth/booker/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.add_dependency 'omniauth-oauth2', '~> 1.1', '<= 1.3.1'
8
+ spec.add_dependency 'jwt', '~> 1.5.2'
9
+ spec.name = 'omniauth-booker'
10
+ spec.version = OmniAuth::Booker::VERSION
11
+ spec.date = '2017-01-01'
12
+ spec.summary = 'Booker OmniAuth Strategy'
13
+ spec.description = 'OmniAuth strategy for the Booker API using OAuth2'
14
+ spec.authors = ['Frederick']
15
+ spec.email = 'tech@hirefrederick.com'
16
+ spec.files = %w(omniauth-booker.gemspec)
17
+ spec.files += Dir.glob('lib/**/*.rb')
18
+ spec.homepage = 'https://github.com/hirefrederick/omniauth-booker'
19
+ spec.licenses = %w(MIT)
20
+
21
+ spec.required_ruby_version = '>= 2.0.0'
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.6'
24
+ spec.add_development_dependency 'rake'
25
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-booker
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Frederick
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-01-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth-oauth2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.1'
20
+ - - "<="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.3.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.1'
30
+ - - "<="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.3.1
33
+ - !ruby/object:Gem::Dependency
34
+ name: jwt
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: 1.5.2
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: 1.5.2
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.6'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.6'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rake
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ description: OmniAuth strategy for the Booker API using OAuth2
76
+ email: tech@hirefrederick.com
77
+ executables: []
78
+ extensions: []
79
+ extra_rdoc_files: []
80
+ files:
81
+ - lib/omniauth-booker.rb
82
+ - lib/omniauth/booker/version.rb
83
+ - lib/omniauth/strategies/booker.rb
84
+ - omniauth-booker.gemspec
85
+ homepage: https://github.com/hirefrederick/omniauth-booker
86
+ licenses:
87
+ - MIT
88
+ metadata: {}
89
+ post_install_message:
90
+ rdoc_options: []
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: 2.0.0
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubyforge_project:
105
+ rubygems_version: 2.5.1
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: Booker OmniAuth Strategy
109
+ test_files: []