-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Callbacks are now named better and provide access to the request instead of the session. Requests are more useful than sessions and still provide access to the session should you need it. The `on_valid_login` callback has been renamed to `after_login` and the session is replaced with a request object. For example: ```ruby config.after_login = lambda do |token, user_info, request| user = User.where(identifier: user_info.sub).first_or_create do |user| user.email = user_info.email end request.session[:user_id] = user.id end ``` The `on_logout` callback has been renamed to `before_logout` and the session is replaced with a request object. For example: ```ruby config.before_logout = lambda do |request| # Your last chance to do something before the session is reset. end ``` BREAKING CHANGE: The callback signatures have changed. Initializers must be updated.
- Loading branch information
1 parent
f15f5c9
commit c94d53d
Showing
6 changed files
with
33 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
module CognitoIdpRails | ||
class Configuration | ||
attr_accessor :after_login_route, :after_logout_route, :domain, :client_id, | ||
:client_secret, :on_logout, :on_valid_login, :scope | ||
:client_secret, :after_login, :before_logout, :scope | ||
|
||
def initialize | ||
@after_login_route = "/" | ||
@after_logout_route = "/" | ||
@on_valid_login = lambda { |token, user_info, session| } | ||
@on_logout = lambda { |session| } | ||
@after_login = lambda { |token, user_info, request| } | ||
@before_logout = lambda { |request| } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters