omniauth-cronofy 0.12.0 → 0.13.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b6928832968482d65cc3f57d5c236894c583f581a2c9795db04bdbee1401c64
4
- data.tar.gz: 6fd4ba9d0085caf5345fe989c10e42bdee56bcef65f457e66afd11ce58e3a840
3
+ metadata.gz: 08d3b9fdad3eef4e29b24ad09e6dbb8c87740ac86d9fd031387df703f18856dc
4
+ data.tar.gz: af84bd469c6564fa31f23f5ca002b461bf8e3bfa25351a36e9f58a1e8b31aece
5
5
  SHA512:
6
- metadata.gz: 91d7e3f5ee1227327f8b2888503a857b873c4ec8007fed3653acb18545da7b072a66114834954a46a03fb2b79fe8a5ce2504f84e6140e7ca15e74cb6bfe6fb7f
7
- data.tar.gz: e4d04bdf8b0ddf1bc642f26ac4b78d3f23e11b46305bc972613181b25a3862b6b74950f17dfad1ad0f51b2e518551dbe72735037cf3eeb4acca5cc32aa9f6f83
6
+ metadata.gz: 6cd2a1c4ee317bf542975101e2995f2cf8f0dbc4c72e3232cab695a8add8f8c9ecb2b2f95fdfb26574bd0ac10823c59d1c48ebca7994dd6f7717f2d7e025e917
7
+ data.tar.gz: 9662faaaccc65d370b6e9883e306e9d92c99d2aa9d812f960cbdf4452387e537dbca5929d998c9f2345af4087fe4d6c52007f593006228d4c2d18d9a4c23b322
data/README.md CHANGED
@@ -43,19 +43,27 @@ Then to auth with Cronofy you would navigate to `/auth/cronofy`.
43
43
 
44
44
  #### Explicit Linking
45
45
 
46
- Cronofy supports [explicit linking of calendar accounts](https://www.cronofy.com/developers/api/alpha/#auth-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.
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
47
 
48
48
  ```
49
49
  /auth/cronofy?link_token=hga672376....
50
50
  ```
51
51
  #### Avoid Linking
52
52
 
53
- Cronofy supports [to avoid profiles to be linked](https://www.cronofy.com/developers/api/#request-authorization-avoid_linking) by passing an `avoid_linking` param with `true` value to the auth flow.
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
54
 
55
55
  ```
56
56
  /auth/cronofy?avoid_linking=true
57
57
  ```
58
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
+
59
67
  ### Configuration
60
68
 
61
69
  Configurable options
@@ -130,6 +138,7 @@ Configurable options
130
138
  :provider => "cronofy_service_account",
131
139
  :uid => "ser_382374827234",
132
140
  :info => {
141
+ :common_name => "company.com",
133
142
  :domain => "company.com"
134
143
  },
135
144
  :credentials => {
@@ -148,6 +157,8 @@ Configurable options
148
157
  }
149
158
  ```
150
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
+
151
162
  ## Contributing
152
163
 
153
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.12.0'.freeze
3
+ VERSION = '0.13.0'.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'] }
@@ -28,16 +34,18 @@ module OmniAuth
28
34
  end
29
35
 
30
36
  def request_phase
31
- link_token = session['omniauth.params']['link_token']
32
- if link_token && !link_token.empty?
33
- options[:authorize_params] ||= {}
34
- options[:authorize_params].merge!(:link_token => link_token)
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]
35
43
  end
36
44
 
37
- avoid_linking = session['omniauth.params']['avoid_linking']
38
- if avoid_linking
39
- options[:authorize_params] ||= {}
40
- options[:authorize_params].merge!(:avoid_linking => avoid_linking)
45
+ if options[:authorize_params]
46
+ options[:authorize_params].merge!(params)
47
+ else
48
+ options[:authorize_params] = params
41
49
  end
42
50
 
43
51
  super
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-cronofy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Bird
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-09 00:00:00.000000000 Z
11
+ date: 2019-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
111
  version: '0'
112
112
  requirements: []
113
113
  rubyforge_project:
114
- rubygems_version: 2.7.6
114
+ rubygems_version: 2.7.8
115
115
  signing_key:
116
116
  specification_version: 4
117
117
  summary: OmniAuth strategy for authenticating with Cronofy