cognito_idp_rails 0.1.1 → 1.0.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: 3721cad7a6153962cb61d6ff372bb12649c90b155eb8973355fe217320972307
4
- data.tar.gz: e881041ce6006f72682e85137a922ab79b657eb040ec5e9e76b51a22e2e6bf01
3
+ metadata.gz: f2e90ec3ceff76f7525a0cb71ab3f0457fef60d32cfe41fe5d4f27a3a2b0e916
4
+ data.tar.gz: 62218081d1ebd666aa06280a31b2e2ae8a587a3abe5858b086bcabaebdc6aaf2
5
5
  SHA512:
6
- metadata.gz: 4e34ece210726e1518a40eaee4f325821c8227b75939aabf6fee7c861f42f539275af90e91bd5e738ecba01ccb9214d89ebaa00e452d3a0ded45f03447b6efe5
7
- data.tar.gz: 7ed7cc524fb0d89401d8b320d108a09501fa0065e4bea98b9d94a6d697c4f49162b6a6a3d0e508086f09e5434f70d6071ac8eb8f110a61ae41e9d0de88089048
6
+ metadata.gz: '0793b32cdb97929f1cc53a49a51b087efb6a9053e380e4aae97ba58b42310a86227fe87f82bd5e3a25d1e668499ad0643519d470cf24761ef6a12355adeff9c1'
7
+ data.tar.gz: 34e1e1c5930521393a61c4ed1b04da405035d8c58b6f8da845db1c871a87237ded53b4d2fddd9a0dfc17d7dc4c912f107618f82925b12edefc42090f22daf534
data/README.md CHANGED
@@ -21,7 +21,7 @@ After adding the gem to your application, run the install generator:
21
21
  This generator will add `cognito_idp` to your routes and install an initializer at `config/initializers/cognito_idp.rb`.
22
22
 
23
23
  Be sure to review and edit the initializer to configure options for your Amazon Cognito User Pool configuration. You
24
- must also provide an implementation for the `on_valid_login` function in the initializer appropriate for any actions you
24
+ must also provide an implementation for the `after_login` function in the initializer appropriate for any actions you
25
25
  want to take when a user signed in.
26
26
 
27
27
  ## Development
@@ -12,7 +12,7 @@ module CognitoIdpRails
12
12
  client.get_token(grant_type: :authorization_code, code: params[:code], redirect_uri: auth_login_callback_url) do |token|
13
13
  client.get_user_info(token) do |user_info|
14
14
  reset_session
15
- configuration.on_valid_login.call(token, user_info, session)
15
+ configuration.after_login.call(token, user_info, request)
16
16
  redirect_to configuration.after_login_route, notice: "You have been successfully logged in."
17
17
  return
18
18
  end
@@ -25,7 +25,7 @@ module CognitoIdpRails
25
25
  end
26
26
 
27
27
  def logout_callback
28
- configuration.on_logout.call(session)
28
+ configuration.before_logout.call(request)
29
29
  reset_session
30
30
  redirect_to configuration.after_logout_route, notice: "You have been successfully logged out."
31
31
  end
@@ -1,13 +1,13 @@
1
1
  module CognitoIdpRails
2
2
  class Configuration
3
3
  attr_accessor :after_login_route, :after_logout_route, :domain, :client_id,
4
- :client_secret, :on_logout, :on_valid_login, :scope
4
+ :client_secret, :after_login, :before_logout, :scope
5
5
 
6
6
  def initialize
7
7
  @after_login_route = "/"
8
8
  @after_logout_route = "/"
9
- @on_valid_login = lambda { |token, user_info, session| }
10
- @on_logout = lambda { |session| }
9
+ @after_login = lambda { |token, user_info, request| }
10
+ @before_logout = lambda { |request| }
11
11
  end
12
12
  end
13
13
  end
@@ -1,3 +1,3 @@
1
1
  module CognitoIdpRails
2
- VERSION = "0.1.1"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -2,16 +2,16 @@ CognitoIdpRails.configure do |config|
2
2
  config.client_id = ENV["COGNITO_CLIENT_ID"]
3
3
  config.client_secret = ENV["COGNITO_CLIENT_SECRET"]
4
4
  config.domain = ENV["COGNITO_DOMAIN"]
5
- config.on_valid_login = lambda do |token, user_info, session|
5
+ config.after_login = lambda do |token, user_info, request|
6
6
  # 1. Find or create a user.
7
7
  # user = User.where(identifier: user_info.sub).first_or_create do |user|
8
8
  # user.email = user_info.email
9
9
  # end
10
10
 
11
11
  # 2. Set any session data for the user.
12
- # session[:user_id] = user.id
12
+ # request.session[:user_id] = user.id
13
13
  end
14
- config.on_logout = lambda do |session|
14
+ config.before_logout = lambda do |request|
15
15
  # Your last chance to do something before the session is reset.
16
16
  end
17
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cognito_idp_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Hatherall
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-07 00:00:00.000000000 Z
11
+ date: 2023-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cognito_idp