All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Added: Rescue and return no access token on
bearer_does_not_exit
error.
- Fix: Use latest access token instead of first valid one in case user granted new permissions
- Fix
access_token
can be nil when deleting a session so add guard for this.
-
Refactor
Zaikio::OAuthClient.client_name
to be thread-safe -
Support
:app_name
and:redirect_uri
parameters with subscription flow
- Support prefilled person and organization data
- Fix: only include valid or refreshable access token in
find_active_access_token
- Fix
logged_in_as
to return access token ID
- Fix
logged_in_as
helper to create a proper access token
- Do not store refresh tokens from client credentials flow to improve security (until they are removed by the hub)
- Do not redeem refresh tokens in
get_access_token
instead use client credentials flow so that only users redeem refresh tokens - Automatically revoke access token on logout (security)
- Add
Zaikio::OAuthClient.find_active_access_token( session[:zaikio_access_token_id])
that should be used to find the latest valid access token. If the (redirect) access token e.g. was revoked (user disconnected, security breach, ...) the user shall be logged out. - Add
Zaikio::AccessToken#revoke!
- Relax dependency on
zaikio-jwt_auth
, allow versions 2.x
- BREAKING: Encrypt
token
&refresh_token
with Active Record Encryption:- Run
rails db:encryption:init
per environment and copy the values to your encrypted credentials - Run
rails zaikio_oauth_client:install:migrations
andrails db:migrate
to encrypt stored access tokens
- Run
- Fix broken Rubocop auto-corrected code.
Do not use, please go straight to v0.17.2
- Retry SSO-flow if code is not given
- Set
allow_other_host: true
when redirecting to Hub (required for Rails 7 strict redirect policy). This property is backwards-compatible with older versions, it's only used in Rails 7+ whenActionController::Base.raise_on_open_redirects = true
is set.
- Retry SSO-flow if code is not valid (anymore)
- Support
prompt_email_confirmation
option for SSO
- Consider
valid_for
when fetching AccessTokens from the database, and only return tokens which meet the expected validity period. This reduces the likelihood of needing to refresh the token before you can use it.
- Don't return access tokens which are due to expire in <30 seconds from now, and allow
configuring this property with the
valid_for
keyword argument.
- Support
prompt
option for SSO - Remove
redirect_with_error=1
since it is now the default and deprecated.
- Allow passing
?lang
, or set the default toI18n.locale
, when starting a new OAuth session
- Add
Zaikio::OAuthClient::SystemTestHelper
for working with system tests (instructions here)
- BREAKING CHANGE: Instead of working
cookies.encrypted
we will switch tosession
because the session cookie will behttponly
and therefore can prevent XSS attack that set the cookie to another value. See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies
- Update zaikio-jwt_auth dependency
- Send
redirect_with_error=1
to redirect flow and handle errors like in OAuth spec. - Support
error_path_for
for custom error handling. - Automatically set
state
parameter for OAuth login and check response to protect against replay attacks.
- Remove Access Token Lookups Queries from Log
- Use configured logger for AccessToken queries
- Support
:organization_id
parameter with subscription flow
- Add support for subscription flow (for setting up a plan)
- Destroy access token with invalid refresh token
- Always destroy old access token after successful Hub API call in
Zaikio::AccessToken#refresh!
and returnnil
if refreshing fails. - Add
.find_usable_access_token
helper method to get a token without making a Hub API call to refresh it
- Replace dependency on
rails
with a more specific dependency onrailties
and friends
- Fix incorrect const_defined? behaviour when initializing without zaikio-hub-models gem
- Don't set
session[:origin]
when passing?origin
tonew_session_path
show_signup
,force_login
andstate
params are now passed throughnew_session_path
.
- Fixed token lookup by searching through requested scopes not through granted scopes. You need to run
$ rails zaikio_oauth_client:install:migrations
to apply latest migrations.
- Improved index to improve access token lookup, run
$ rails zaikio_oauth_client:install:migrations
to apply
- Fixed Namespace for Models gem
- BREAKING Renames
Zaikio::Directory
toZaikio::Hub
- Fix another compatibility issue with Ruby 3.0
- Automatically publish to RubyGems
- Fix compatibility issues with Ruby 3.0