Skip to content

Commit

Permalink
Merge pull request #67 from Colin-b/bugfix/early_expiry
Browse files Browse the repository at this point in the history
Account for network latency when considering token expired
  • Loading branch information
Colin-b authored Jan 11, 2022
2 parents 9dc59e1 + 4277774 commit fa3e40a
Show file tree
Hide file tree
Showing 14 changed files with 753 additions and 199 deletions.
30 changes: 29 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,40 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [6.0.0] - 2022-01-11
### Changed
- `requests_auth.oauth2_tokens.TokenMemoryCache.get_token` method now requires arguments to be named.
- `requests_auth.oauth2_tokens.TokenMemoryCache.get_token` method `on_missing_token` arguments must now be named (switched from args to kwargs).
- `requests_auth.JsonTokenFileCache.get_token` method now requires arguments to be named.
- `requests_auth.JsonTokenFileCache.get_token` method `on_missing_token` arguments must now be named (switched from args to kwargs).
- `requests_auth.testing` now requires `pyjwt==2.*`.

### Added
- `requests_auth.oauth2_tokens.TokenMemoryCache.get_token` now allows to specify a custom `early_expiry` in seconds (default to 30).
- `requests_auth.JsonTokenFileCache.get_token` now allows to specify a custom `early_expiry` in seconds (default to 30).
- `requests_auth.OAuth2ResourceOwnerPasswordCredentials` contains a new `early_expiry` parameter allowing to tweak the number of seconds before actual token expiry where the token will be considered as already expired. Default to 30s.
- `requests_auth.OAuth2ClientCredentials` contains a new `early_expiry` parameter allowing to tweak the number of seconds before actual token expiry where the token will be considered as already expired. Default to 30s.
- `requests_auth.OktaClientCredentials` contains a new `early_expiry` parameter allowing to tweak the number of seconds before actual token expiry where the token will be considered as already expired. Default to 30s.
- `requests_auth.OAuth2AuthorizationCode` contains a new `early_expiry` parameter allowing to tweak the number of seconds before actual token expiry where the token will be considered as already expired. Default to 30s.
- `requests_auth.OktaAuthorizationCode` contains a new `early_expiry` parameter allowing to tweak the number of seconds before actual token expiry where the token will be considered as already expired. Default to 30s.
- `requests_auth.OAuth2AuthorizationCodePKCE` contains a new `early_expiry` parameter allowing to tweak the number of seconds before actual token expiry where the token will be considered as already expired. Default to 30s.
- `requests_auth.OktaAuthorizationCodePKCE` contains a new `early_expiry` parameter allowing to tweak the number of seconds before actual token expiry where the token will be considered as already expired. Default to 30s.
- `requests_auth.OAuth2Implicit` contains a new `early_expiry` parameter allowing to tweak the number of seconds before actual token expiry where the token will be considered as already expired. Default to 30s.
- `requests_auth.AzureActiveDirectoryImplicit` contains a new `early_expiry` parameter allowing to tweak the number of seconds before actual token expiry where the token will be considered as already expired. Default to 30s.
- `requests_auth.AzureActiveDirectoryImplicitIdToken` contains a new `early_expiry` parameter allowing to tweak the number of seconds before actual token expiry where the token will be considered as already expired. Default to 30s.
- `requests_auth.OktaImplicit` contains a new `early_expiry` parameter allowing to tweak the number of seconds before actual token expiry where the token will be considered as already expired. Default to 30s.
- `requests_auth.OktaImplicitIdToken` contains a new `early_expiry` parameter allowing to tweak the number of seconds before actual token expiry where the token will be considered as already expired. Default to 30s.

### Removed
- `requests_auth.oauth2_tokens.is_expired` is not available anymore.
- `requests_auth.oauth2_tokens.decode_base64` is not available anymore.
- `requests_auth.oauth2_tokens.TokenMemoryCache.add_bearer_token` is not available anymore.
- `requests_auth.oauth2_tokens.TokenMemoryCache.add_access_token` is not available anymore.

### Fixed
- OAuth2 token will now be considered as expired 30 seconds before actual expiry. To ensure it is still valid when received by the actual server.

## [5.3.0] - 2021-06-06
### Added
- Support for refresh tokens in the Resource Owner Password Credentials flow and Authorization Code (with and without PKCE) flows (Thanks to [Stijn Caerts](https://github.com/StijnCaerts)).
Expand Down Expand Up @@ -140,7 +167,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Public release

[Unreleased]: https://github.com/Colin-b/requests_auth/compare/v5.3.0...HEAD
[Unreleased]: https://github.com/Colin-b/requests_auth/compare/v6.0.0...HEAD
[6.0.0]: https://github.com/Colin-b/requests_auth/compare/v5.3.0...v6.0.0
[5.3.0]: https://github.com/Colin-b/requests_auth/compare/v5.2.0...v5.3.0
[5.2.0]: https://github.com/Colin-b/requests_auth/compare/v5.1.0...v5.2.0
[5.1.0]: https://github.com/Colin-b/requests_auth/compare/v5.0.2...v5.1.0
Expand Down
Loading

0 comments on commit fa3e40a

Please sign in to comment.