omniauth-globalid 0.1.2 → 0.1.4

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: 9c564c5362740d38c5a31e3dbccba87586db783127a3416a7f0e55dc13429caa
4
- data.tar.gz: 5b6b0484eacbf3ebab858cfd3e757261753d34c675e10984279e5f99699657fd
3
+ metadata.gz: '09664b26f11207b69b017e70d168614cabab576a179c53ff208bf8a74a1696a7'
4
+ data.tar.gz: c0e9257def49062aef8e9b34bdcd14e520aec23b50ddc7393edcf77965cd9e46
5
5
  SHA512:
6
- metadata.gz: 0362dbaf66eef9378c048020f41773d2723857a9a49f0ada7fa05c67f7d31ac8532e0f67164a8bf9fbe4252ecab5ad5dbc7f41222bedeb4c5744de618685c99c
7
- data.tar.gz: 907a483a2acbb90088c9e6860e92c1d79157875e5b660bed1855b0e18d062e02c9562448ae1421f19153fe27fc0b15d308da6fc71d20ba4cc95ca787dca8612b
6
+ metadata.gz: 3aaf1e094e8fd1322c111d76e1ecbdde70fdb3b460d3c50956e2bac89838d7491b483e882c17789b9ee0dd782d0aee4c98c6268485fc09fe320fb5dd0558bfb2
7
+ data.tar.gz: d13997f78247c117873e8874c58894f86e5297d9b13127f8656a2336bdfabba2135c2281a0958976f5d229614529d0bc782a0ccbdc3f09507694400a7dabd216
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # OmniAuth globaliD
2
2
 
3
- This gem contains the GlobaliD strategy for OmniAuth, and includes functionality for accessing PII that authenticated users share with you.
3
+ `omniauth-globalid` is a rack middleware for authenticating with globaliD. It supports OAuth2 authentication and openID Connect. This gem contains the GlobaliD strategy for OmniAuth, and includes functionality for accessing PII that authenticated users share with you.
4
4
 
5
5
  ## Installation
6
6
 
@@ -12,15 +12,13 @@ gem "omniauth-globalid"
12
12
 
13
13
  Then `bundle install`
14
14
 
15
- `Omniauth::Strategies::Globalid` is a rack middleware for authenticating with globaliD. It supports OAuth2 authentication and openID Connect.
16
-
17
- If you're adding this to a Rails app using [devise](https://github.com/plataformatec/devise) for authentication, add this to your `config/initializers/devise.rb`:
15
+ If you're adding this to a Rails app using [devise with OmniAuth](https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview), add this to your `config/initializers/devise.rb`:
18
16
 
19
17
  ```ruby
20
18
  config.omniauth :globalid, ENV["GLOBALID_CLIENT_ID"], ENV["GLOBALID_CLIENT_SECRET"],
21
19
  ```
22
20
 
23
- Here's an example not using devise, adding this to the middleware to a Rails app in `config/initializers/omniauth.rb`:
21
+ Otherwise, you'll probably want to add this to the middleware of the Rails app in `config/initializers/omniauth.rb`:
24
22
 
25
23
  ```ruby
26
24
  Rails.application.config.middleware.use OmniAuth::Builder do
@@ -36,6 +34,7 @@ Options you can pass in the initialization (none are required):
36
34
  | `scope` | Must be `openid` if passing an `acrc_id` that specifies [PII sharing](#access-pii-from-the-vault) |
37
35
  | `private_key` | Private key given to globaliD. Required for [PII sharing](#access-pii-from-the-vault) |
38
36
  | `private_key_pass` | Password for `private_key` specified |
37
+ | `decrypt_pii_on_login` | Decrypt PII on login, passing it through the authentication hash |
39
38
 
40
39
  Here is what a configuration for a setup that uses PII sharing looks like:
41
40
 
@@ -46,7 +45,8 @@ provider :globalid,
46
45
  acrc_id: ENV["ACRC_ID"],
47
46
  scope: "openid",
48
47
  private_key: ENV["GLOBALID_PRIVATE_KEY"],
49
- private_key_pass: ENV["GLOBALID_PRIVATE_KEY_PASS"]
48
+ private_key_pass: ENV["GLOBALID_PRIVATE_KEY_PASS"],
49
+ decrypt_pii_on_login: true
50
50
  ```
51
51
 
52
52
  If you're curious about what those options mean, or how to use them, read [globaliD's documentation](https://developer.global.id/external/documentation/index.html) or the [walkthroughs in this readme](#globalid-authentication-walkthroughs).
@@ -11,6 +11,9 @@ module OmniAuth
11
11
  @client_id = client_id || ENV["GLOBALID_CLIENT_ID"]
12
12
  @client_secret = client_secret || ENV["GLOBALID_CLIENT_SECRET"]
13
13
  @redirect_uri = redirect_uri || ENV["GLOBALID_REDIRECT_URL"]
14
+ # Clean up the private key in case environmental variables were extra escaped
15
+ private_key ||= ENV["GLOBALID_PRIVATE_KEY"].gsub("\\n", "\n").gsub("\"", "")
16
+ private_key_pass ||= ENV["GLOBALID_PRIVATE_KEY_PASS"]
14
17
  @private_key = OpenSSL::PKey::RSA.new(private_key, private_key_pass)
15
18
  end
16
19
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module Globalid
5
- VERSION = "0.1.2"
5
+ VERSION = "0.1.4"
6
6
  end
7
7
  end
@@ -47,7 +47,6 @@ module OmniAuth
47
47
  description: raw_info["description"],
48
48
  image: raw_info["display_image_url"],
49
49
  location: location(raw_info),
50
- email: decrypted_pii,
51
50
  }.merge(id_token: openid_token)
52
51
  .merge(decrypted_pii: decrypted_pii)
53
52
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
 
19
19
  s.add_runtime_dependency "omniauth", "~> 1.2"
20
20
  s.add_runtime_dependency "omniauth-oauth2", "~> 1.1"
21
- s.add_runtime_dependency "jwt", "~> 2.2.1"
21
+ s.add_runtime_dependency "jwt", "~> 2.2"
22
22
  s.add_dependency "rack"
23
23
  s.add_development_dependency "bundler", "~> 1.14"
24
24
  s.add_development_dependency "rake", "~> 12.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-globalid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Herr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-19 00:00:00.000000000 Z
11
+ date: 2019-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 2.2.1
47
+ version: '2.2'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 2.2.1
54
+ version: '2.2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rack
57
57
  requirement: !ruby/object:Gem::Requirement