omniauth-globalid 0.0.6 → 0.0.7

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: 83940bd4e20de0706280b37adb6fbf87f1d7ae4b5a72609f6e6799ae5588d309
4
- data.tar.gz: 22717588305d36395cf352e8185a51bde0ecbed1625d64277e39d829ad64566d
3
+ metadata.gz: e427c1de19685187e54935aa993e66ebbcd09e5bed685531151038b7cc478efd
4
+ data.tar.gz: b34dd08d02ce163537ad58a40ca0257eddc1ff69e4604cc2731623e0854db77f
5
5
  SHA512:
6
- metadata.gz: 962d6041ad635b47b11b9a2fd83c9d4fcf594d9c8ea3122d4bb066bb98b6fd466782c236995f61457e3e54fc7460b5f76eb43fa831856b07896bb4033d05c981
7
- data.tar.gz: e3eee64ba5384822570dfb1995afe387e50e8287d471728d390d6bcfbdf54082d34183d1ca04c6e31b6e5da7ae574bd67332c75aff1c359f41643828f72ff71e
6
+ metadata.gz: 0ae5b3594525c68653dc67c34de627ef7070575967e7e263e9ff67e98935d6ab87c08297ab5a35056476d3bf075ba79844f275822e02fad8074c6fac3ec999a4
7
+ data.tar.gz: ecfe81f85c6789b66c424ab2d3b9e87179e9d744c9b92c7c1849eccdc03c4cad15f41ff3cd6226fbe3af929112e721d6f41ce438fa55fd68b7f7f9d5db469ac7
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OmniAuth
2
4
  module Globalid
3
- VERSION = "0.0.6"
5
+ VERSION = "0.0.7"
4
6
  end
5
7
  end
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "omniauth-oauth2"
2
4
 
3
5
  module OmniAuth
4
6
  module Strategies
5
7
  class Globalid < OmniAuth::Strategies::OAuth2
6
8
  option :name, "globalid"
7
- DEFAULT_SCOPE = "public".freeze
9
+ DEFAULT_SCOPE = "public"
8
10
 
9
11
  option :client_options, site: "https://auth.global.id",
10
12
  authorize_url: "/",
@@ -15,6 +17,12 @@ module OmniAuth
15
17
  full_host + script_name + callback_path
16
18
  end
17
19
 
20
+ def authorize_params
21
+ return super unless acrc_id_provided?
22
+
23
+ super.merge(acrc_id: request.params["acrc_id"])
24
+ end
25
+
18
26
  uid { raw_info["gid_uuid"] }
19
27
 
20
28
  info do
@@ -29,6 +37,7 @@ module OmniAuth
29
37
 
30
38
  def raw_info
31
39
  return @raw_info if defined?(@raw_info)
40
+
32
41
  result = api_connection.get("/v1/identities/me")
33
42
  @raw_info = JSON.parse(result.body)
34
43
  end
@@ -43,6 +52,10 @@ module OmniAuth
43
52
  end
44
53
  end
45
54
 
55
+ def acrc_id_provided?
56
+ request.params.key?("acrc_id")
57
+ end
58
+
46
59
  def location(raw_info)
47
60
  location = [
48
61
  raw_info["metro_name"],
@@ -56,7 +69,9 @@ module OmniAuth
56
69
  end
57
70
 
58
71
  def nickname(raw_info)
59
- raw_info["gid_name"] if raw_info["gid_name_moderation_status"] == "accepted"
72
+ return if raw_info["gid_name_moderation_status"] != "accepted"
73
+
74
+ raw_info["gid_name"]
60
75
  end
61
76
  end
62
77
  end
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.0.6
4
+ version: 0.0.7
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-09-13 00:00:00.000000000 Z
11
+ date: 2019-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth