omniauth-centralid 1.2.0 → 1.3.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: a6ffac9d4d3e487ac97beabf85e7a4fd5aea35e5217a33c722c0fa712646caec
4
- data.tar.gz: f203e33e0a461d4071442100c4c48a5e672d2acdedf09cf0940e3ec175a105d2
3
+ metadata.gz: '08637c544cff96c710495dfe33f1a8b1dc8518c06a8182de104f4dc091c0662a'
4
+ data.tar.gz: 004c208ca78837a67a400a7383120ec272e41dc52d73d35cdde81282bc82755e
5
5
  SHA512:
6
- metadata.gz: cb952e7dcd7ec7d85f01ee766bf03c3c43a07d1e2e644db977ff4e23481479cc900dce16b5d0db9f52a046200248f6c9bd57d1798ddc1c4600798d9cec6db985
7
- data.tar.gz: 659b83a20646fb5cdb164318960ac2c2c8f2a8ac5c2b9116e0ecb1271ce821aa3259a1729b7c275ca092d05d015801af5f8c7351e966c3245ebfae85b97a0798
6
+ metadata.gz: a8fc89ad1a51cb4175146f23e028943cb0a99bc892c5d30f081e64979462ef52fc11ba919c3f9f3e9da161faf44e95bcd0c84b1b7450326aa5ee177ee71912d4
7
+ data.tar.gz: bde115d788db34b4f28485fe7711741a2f7fc3e20e7523d02d26449286cb409098cb12666250586f4e17c48b2cec638dd4f5da1852aedcdfacbb3cddcf28bf16
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.0 / 2022-11-14
4
+
5
+ - Update root URL
6
+
3
7
  ## 1.2.0 / 2018-07-03
4
8
 
5
9
  - Upgrade `omniauth-oauth2` to 1.5
data/README.md CHANGED
@@ -8,21 +8,30 @@ This gem offers OmniAuth strategy for Central ID service.
8
8
  First start by adding this gem to your Gemfile:
9
9
 
10
10
  ```ruby
11
- gem 'omniauth-centralid'
11
+ gem "omniauth-centralid"
12
12
  ```
13
13
 
14
- Next, tell OmniAuth about this provider. In a Rails app, create an initializer for instance `config/initializers/omniauth.rb` with:
14
+ Next, let OmniAuth know about provider. In a Rails app, create an initializer for instance `config/initializers/omniauth.rb` with:
15
15
 
16
16
  ```ruby
17
17
  Rails.application.config.middleware.use OmniAuth::Builder do
18
18
  provider :centralid, "CENTRALID_KEY", "CENTRALID_SECRET"
19
19
  end
20
20
  ```
21
+ You can override config, like
22
+ ```ruby
23
+ Rails.application.config.middleware.use OmniAuth::Builder do
24
+ provider :centralid, "CENTRALID_KEY", "CENTRALID_SECRET",
25
+ client_options: {
26
+ site: "http://localhost:3000"
27
+ }
28
+ end
29
+ ```
21
30
  In your routes file:
22
31
 
23
32
  ```ruby
24
- get 'auth/:provider/callback', to: 'oauths#create'
25
- get 'auth/failure', to: 'oauths#failure' # optional (to override default redirect behaviour)
33
+ get "auth/:provider/callback", to: "oauths#create"
34
+ get "auth/failure", to: "oauths#failure" # optional (to override default redirect behaviour)
26
35
  ```
27
36
 
28
37
  Add a controller (oauths_controller.rb as defined in your routes)
@@ -31,8 +40,8 @@ Add a controller (oauths_controller.rb as defined in your routes)
31
40
  # sends the user on a trip to the provider,
32
41
  # and after authorizing there back to the callback url.
33
42
  def create
34
- auth = request.env['omniauth.auth']
35
- user = User.find_by(provider: auth['provider'], uid: auth['uid']).try(:user) || User.create_with_omniauth(auth)
43
+ auth = request.env["omniauth.auth"]
44
+ user = User.find_by(provider: auth["provider"], uid: auth["uid"]).try(:user) || User.create_with_omniauth(auth)
36
45
  # Sign in the user
37
46
  session[:user_id] = user.id
38
47
  redirect_to dashboard_path
@@ -52,12 +61,12 @@ And finally add a `create_with_omniauth` method in your user model.
52
61
 
53
62
  def self.create_with_omniauth(auth)
54
63
  user = create! do |user|
55
- user.full_name = auth['info']['name']
56
- user.email = auth['info']['email']
64
+ user.full_name = auth["info"]["name"]
65
+ user.email = auth["info"]["email"]
57
66
  user.password = SecureRandom.hex
58
67
  user.authentications.new(
59
- provider: auth['provider'],
60
- uid: auth['uid']
68
+ provider: auth["provider"],
69
+ uid: auth["uid"]
61
70
  )
62
71
  end
63
72
  user
@@ -1,5 +1,5 @@
1
- require 'omniauth-oauth2'
2
- require 'multi_json'
1
+ require "omniauth-oauth2"
2
+ require "multi_json"
3
3
 
4
4
  module OmniAuth
5
5
  module Strategies
@@ -7,26 +7,26 @@ module OmniAuth
7
7
  option :name, :centralid
8
8
 
9
9
  option :client_options, {
10
- site: 'https://centralid.herokuapp.com',
11
- authorize_path: '/oauth/authorize'
10
+ site: "https://centralid.yafoy.com",
11
+ authorize_path: "/oauth/authorize"
12
12
  }
13
13
 
14
14
  option :fields, [:name, :email]
15
15
 
16
16
  uid do
17
- raw_info['id']
17
+ raw_info["id"]
18
18
  end
19
19
 
20
20
  info do
21
21
  {
22
- name: raw_info['full_name'],
23
- email: raw_info['email'],
24
- username: raw_info['username']
22
+ name: raw_info["full_name"],
23
+ email: raw_info["email"],
24
+ username: raw_info["username"]
25
25
  }
26
26
  end
27
27
 
28
28
  def raw_info
29
- @raw_info ||= access_token.get('/api/v1/me').parsed
29
+ @raw_info ||= access_token.get("/api/v1/me").parsed
30
30
  end
31
31
 
32
32
  # https://github.com/intridea/omniauth-oauth2/issues/81
@@ -1,3 +1,3 @@
1
1
  module OmniauthCentralid
2
- VERSION = "1.2.0"
2
+ VERSION = "1.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-centralid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yafoy
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-03 00:00:00.000000000 Z
11
+ date: 2022-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2
@@ -108,7 +108,7 @@ homepage: http://github.com/yafoy/omniauth-centralid
108
108
  licenses:
109
109
  - MIT
110
110
  metadata: {}
111
- post_install_message:
111
+ post_install_message:
112
112
  rdoc_options: []
113
113
  require_paths:
114
114
  - lib
@@ -123,9 +123,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  requirements: []
126
- rubyforge_project:
127
- rubygems_version: 2.7.6
128
- signing_key:
126
+ rubygems_version: 3.3.7
127
+ signing_key:
129
128
  specification_version: 4
130
129
  summary: Central ID stategy for OmniAuth
131
130
  test_files: []