omniauth-cronofy 0.9.0 → 0.13.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3e0e7501a9711c3f3d141dda702bfbf5c37ee617
4
- data.tar.gz: 92784956009981fc95d5f9b3e45eaf13ebab8932
2
+ SHA256:
3
+ metadata.gz: e54d280eec4667dd471cbc22a0f1337a90f22b0c21c9e1184e925d2cada4863f
4
+ data.tar.gz: 412089c2ca691390b92daf19ecca95f83f27af8c0eae7cb2788bcda6fa17a411
5
5
  SHA512:
6
- metadata.gz: 943321f4df579cd5a26c705a9c954d0380c0936ec1d938391763076c9aad57eda56e4e2beaf59ffbc33971b44a5b723c2118618705e3645d38584ce798f5aac3
7
- data.tar.gz: 488e4b202f99f511e9a911a9ecba76470642bbb92faa12deff3cd4e1e5fcc8b1f8d8b620d2269227b116cb4753d054551bfeb8452926e3ad9b5adbcef117ed50
6
+ metadata.gz: bd170be5d85f86659d53944817d1f4b3083b14db4c51fa415c52f803e268a3a530fe4047c8afb962139bc9c20e13a179d6af768f3dca0e69077eeeda1bc085c7
7
+ data.tar.gz: 585bd786ffc043fe284037b57930a5485b9ebec08fcbc1cef4182336fa643504a4ec0ed55b8357ebf2da48159833cf3683f185ee29977fdfeee4119c3b35d6c1
@@ -0,0 +1,5 @@
1
+ ## [0.13.1]
2
+
3
+ * Loosen dependencies for OmniAuth 2.x
4
+
5
+ [0.13.1]: https://github.com/cronofy/omniauth-cronofy/releases/tag/v0.13.1
data/README.md CHANGED
@@ -41,6 +41,29 @@ end
41
41
 
42
42
  Then to auth with Cronofy you would navigate to `/auth/cronofy`.
43
43
 
44
+ #### Explicit Linking
45
+
46
+ Cronofy supports [explicit linking of calendar accounts](https://docs.cronofy.com/developers/api-alpha/explicit-linking/) by passing a `link_token` to the auth flow. This strategy supports that token be passed as a query string parameter to the auth redirect.
47
+
48
+ ```
49
+ /auth/cronofy?link_token=hga672376....
50
+ ```
51
+ #### Avoid Linking
52
+
53
+ Cronofy supports [to avoid profiles to be linked](https://docs.cronofy.com/developers/api/authorization/request-authorization/#avoid_linking) by passing an `avoid_linking` param with `true` value to the auth flow.
54
+
55
+ ```
56
+ /auth/cronofy?avoid_linking=true
57
+ ```
58
+
59
+ #### Provider Name
60
+
61
+ Cronofy allows the [pre-selection of a calendar provider](https://docs.cronofy.com/developers/api/authorization/request-authorization/#provider_name) in the auth flow using the `provider_name` param with one of the documented values.
62
+
63
+ ```
64
+ /auth/cronofy?provider_name=office365
65
+ ```
66
+
44
67
  ### Configuration
45
68
 
46
69
  Configurable options
@@ -115,6 +138,7 @@ Configurable options
115
138
  :provider => "cronofy_service_account",
116
139
  :uid => "ser_382374827234",
117
140
  :info => {
141
+ :common_name => "company.com",
118
142
  :domain => "company.com"
119
143
  },
120
144
  :credentials => {
@@ -133,6 +157,8 @@ Configurable options
133
157
  }
134
158
  ```
135
159
 
160
+ The `info` element may contain different elements, `domain` and/or `email` depending on the calendar service being integrated with. `common_name` is always returned.
161
+
136
162
  ## Contributing
137
163
 
138
164
  1. Fork it ( https://github.com/[my-github-username]/omniauth-cronofy/fork )
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Cronofy
3
- VERSION = '0.9.0'.freeze
3
+ VERSION = '0.13.1'.freeze
4
4
  end
5
5
  end
@@ -1,6 +1,12 @@
1
1
  module OmniAuth
2
2
  module Strategies
3
3
  class Cronofy < CronofyBase
4
+ WHITELISTED_AUTHORIZE_PARAMS = %w{
5
+ avoid_linking
6
+ link_token
7
+ provider_name
8
+ }
9
+
4
10
  option :name, "cronofy"
5
11
 
6
12
  uid { raw_info['account_id'] }
@@ -26,6 +32,24 @@ module OmniAuth
26
32
  def raw_info
27
33
  @raw_info ||= access_token.get("#{client_options[:api_url]}/v1/account").parsed['account']
28
34
  end
35
+
36
+ def request_phase
37
+ session_params = session['omniauth.params']
38
+ params = {}
39
+
40
+ WHITELISTED_AUTHORIZE_PARAMS.each do |param|
41
+ next unless session_params[param]
42
+ params[param] = session_params[param]
43
+ end
44
+
45
+ if options[:authorize_params]
46
+ options[:authorize_params].merge!(params)
47
+ else
48
+ options[:authorize_params] = params
49
+ end
50
+
51
+ super
52
+ end
29
53
  end
30
54
  end
31
55
  end
@@ -15,9 +15,12 @@ module OmniAuth
15
15
  uid { raw_info['sub'] }
16
16
 
17
17
  info do
18
- {
19
- :domain => raw_info['cronofy.service_account.domain'],
18
+ data = {
19
+ :common_name => raw_info['cronofy.service_account.domain'] || raw_info['cronofy.service_account.email']
20
20
  }
21
+ data[:domain] = raw_info['cronofy.service_account.domain'] if raw_info['cronofy.service_account.domain']
22
+ data[:email] = raw_info['cronofy.service_account.email'] if raw_info['cronofy.service_account.email']
23
+ data
21
24
  end
22
25
 
23
26
  def callback_url
@@ -19,8 +19,9 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_dependency "omniauth", "~> 1.2"
22
+ spec.add_dependency "omniauth", "> 1.2", "< 3"
23
23
  spec.add_dependency "omniauth-oauth2", "~> 1.3"
24
- spec.add_development_dependency "bundler", "~> 1.8"
24
+ spec.add_development_dependency "bundler", "> 1.8"
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "> 3"
26
27
  end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-cronofy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Bird
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-11 00:00:00.000000000 Z
11
+ date: 2021-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.2'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '3'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">"
25
28
  - !ruby/object:Gem::Version
26
29
  version: '1.2'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '3'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: omniauth-oauth2
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -42,14 +48,14 @@ dependencies:
42
48
  name: bundler
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - "~>"
51
+ - - ">"
46
52
  - !ruby/object:Gem::Version
47
53
  version: '1.8'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
- - - "~>"
58
+ - - ">"
53
59
  - !ruby/object:Gem::Version
54
60
  version: '1.8'
55
61
  - !ruby/object:Gem::Dependency
@@ -66,6 +72,20 @@ dependencies:
66
72
  - - "~>"
67
73
  - !ruby/object:Gem::Version
68
74
  version: '10.0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rspec
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">"
80
+ - !ruby/object:Gem::Version
81
+ version: '3'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">"
87
+ - !ruby/object:Gem::Version
88
+ version: '3'
69
89
  description: OmniAuth strategy for authenticating with Cronofy
70
90
  email:
71
91
  - support@cronofy.com
@@ -77,6 +97,7 @@ files:
77
97
  - ".gitignore"
78
98
  - ".rspec"
79
99
  - ".travis.yml"
100
+ - CHANGELOG.md
80
101
  - CODE_OF_CONDUCT.md
81
102
  - Gemfile
82
103
  - LICENSE.txt
@@ -95,7 +116,7 @@ homepage: https://github.com/cronofy/omniauth-cronofy
95
116
  licenses:
96
117
  - MIT
97
118
  metadata: {}
98
- post_install_message:
119
+ post_install_message:
99
120
  rdoc_options: []
100
121
  require_paths:
101
122
  - lib
@@ -110,9 +131,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
131
  - !ruby/object:Gem::Version
111
132
  version: '0'
112
133
  requirements: []
113
- rubyforge_project:
114
- rubygems_version: 2.6.6
115
- signing_key:
134
+ rubygems_version: 3.2.4
135
+ signing_key:
116
136
  specification_version: 4
117
137
  summary: OmniAuth strategy for authenticating with Cronofy
118
138
  test_files: []