omniauth-edlink 0.1.0 → 0.3.0

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
2
  SHA256:
3
- metadata.gz: 4a569bc748df142608c58c8481069a90ea3edceb13f7e2e107091de16507bc8f
4
- data.tar.gz: '0960b368cf2fe33a37528f3c939ee19fd68fe6311077a0c4b07d026266617ee3'
3
+ metadata.gz: 10539216013316ade8d1e23d6e7e7b13069533671cee87a74864d3db287a2fc3
4
+ data.tar.gz: 78c258074dacc027dabab6a886e771858f93c34ce73fab324d38455d71f0aec3
5
5
  SHA512:
6
- metadata.gz: db791e6fcfa1efd880f0f92e0c064680fc979baf8945c2ed3eec3f545362dfa377dd94af186ad66b1fb0f045269c0009e1f90671f2a115b8251b9426d6b1c0de
7
- data.tar.gz: d916c1d12c735ffcae933f8f134a90abde9a485b0bdb93effd6349f1f7b10ccd1bb13f2b08f5895e79546e5bd06de1b7de141f1cd6b3e76261486692ace9fc6e
6
+ metadata.gz: a92ccf04ecf4199790f3f133450ff3eb43bcc8e094c4915c22842292591171580117e870903c4dd84fb93d2a14ec7bdd20f6a599003a53c16ae700dba3ae655b
7
+ data.tar.gz: b5d2c321f0780fb7f5b4775c10c01da1b148ff52b3fe4b1fa7b5ff07c00b04e01bd9467bebbfb8209492468838b466ac2ff8cf89a407ba3ba4469f0b751f38fd
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
- .idea/
1
+ .idea/
2
+ omniauth-edlink-*.gem
data/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ ## 0.3.0
5
+
6
+ * Bugfix for generating a redirect to generic login page (without integration_id)
7
+ * Skip state validation, because state param is removed by Edlink anyway.
8
+
9
+ ## 0.2.0
10
+
11
+ * Support optional integration_id parameter that redirect users directly to IdP login page.
12
+
13
+ ## 0.1.0
14
+
15
+ * Initial release.
data/README.md CHANGED
@@ -37,6 +37,12 @@ Or, alternatively, if you use [Devise](https://github.com/plataformatec/devise),
37
37
  'your-edlink-secret-key'
38
38
  ```
39
39
 
40
+ If for some reason you know the Edlink's integration id for a particular SSO request (e.g. from your application subdomain or from typed email address) and you want to take your users directly to their upstream SSO login page instead of generic Edlink login page, you can pass additional `integration_id` parameter to the redirect request, e.g.:
41
+ ```ruby
42
+ redirect_to "/auth/edlink?integration_id=#{integration_id}"
43
+ ```
44
+ This will redirect the user to the Edlink's SSO login page for the specified integration id.
45
+
40
46
  # Contributing
41
47
  1. Fork it
42
48
  2. Create your feature branch (git checkout -b my-new-feature)
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Edlink
3
- VERSION = '0.1.0'.freeze
3
+ VERSION = '0.3.0'.freeze
4
4
  end
5
5
  end
@@ -21,16 +21,23 @@ module OmniAuth
21
21
  access_token_class: AccessToken
22
22
  }
23
23
  option :uid_field, 'id'
24
+ # `state` injected during the request phase is lost by Edlink, you don't get it in the callback phase.
25
+ option :provider_ignores_state, true
24
26
 
25
27
  uid do
26
28
  raw_info[options.uid_field.to_s]
27
29
  end
28
30
 
31
+ def request_phase
32
+ integration_id = request.params['integration_id']
33
+ authorize_path = integration_id.present? ? integration_authorize_path(integration_id) : options.client_options.authorize_url
34
+ redirect client.connection.build_url(URI.join(options.client_options.site, authorize_path), authorize_params)
35
+ end
36
+
29
37
  def authorize_params
30
- super.tap do |params|
31
- params[:scope] = [:email, :profile]
32
- params[:response_type] = :code
33
- end
38
+ super
39
+ .merge({ :redirect_uri => callback_url })
40
+ .merge(client.auth_code.authorize_params)
34
41
  end
35
42
 
36
43
  info do
@@ -50,6 +57,10 @@ module OmniAuth
50
57
  def callback_url
51
58
  full_host + callback_path
52
59
  end
60
+
61
+ def integration_authorize_path(integration_id)
62
+ "/api/authentication/integrations/#{integration_id}/launch"
63
+ end
53
64
  end
54
65
  end
55
66
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-edlink
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kamil Bednarz
8
8
  - Tomasz Rosiek
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-07-22 00:00:00.000000000 Z
12
+ date: 2024-07-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth-oauth2
@@ -34,6 +34,7 @@ extensions: []
34
34
  extra_rdoc_files: []
35
35
  files:
36
36
  - ".gitignore"
37
+ - CHANGELOG.md
37
38
  - Gemfile
38
39
  - Gemfile.lock
39
40
  - LICENSE
@@ -46,7 +47,7 @@ homepage: https://github.com/u2i/omniauth-edlink
46
47
  licenses:
47
48
  - Apache-2.0
48
49
  metadata: {}
49
- post_install_message:
50
+ post_install_message:
50
51
  rdoc_options: []
51
52
  require_paths:
52
53
  - lib
@@ -61,8 +62,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
62
  - !ruby/object:Gem::Version
62
63
  version: '0'
63
64
  requirements: []
64
- rubygems_version: 3.1.6
65
- signing_key:
65
+ rubygems_version: 3.4.10
66
+ signing_key:
66
67
  specification_version: 4
67
68
  summary: The unofficial strategy for authenticating users using ed.link using OAuth2
68
69
  provider