Commit Graph

136 Commits

Author SHA1 Message Date
Michael Kefeder
adc99a10ec example showing howto implement a custom flow, here opening the
default webbrowser with the oauth2 URL for the installed flow.
2020-11-16 09:52:08 +01:00
Lewin Bormann
2f50876002 Release v4.1.3 2020-10-27 11:11:33 +01:00
Lewin Bormann
4660676073 Revert "Upgrade tokio -> 0.3: Bump version to v5.0.0"
This reverts commit e07bc6f471.

Hyper and tokio 0.3 don't work together yet.
2020-10-20 17:47:39 +02:00
Lewin Bormann
e07bc6f471 Upgrade tokio -> 0.3: Bump version to v5.0.0 2020-10-20 16:28:46 +02:00
Lewin Bormann
55a8984c81 Another slight update to README 2020-10-18 22:42:14 +02:00
Lewin Bormann
3221e8986a chore(version): Publish v4.1.2 2020-05-01 20:36:01 +02:00
George Hahn
4b1262933b Update dependencies 2020-05-01 11:52:23 -05:00
Lewin Bormann
6fe83abf61 chore(version): release 4.1.1 for #127
fixes #128
2020-04-29 18:16:07 +02:00
Abdul Rehman
09d1f05a00 feat: Use futures-aware mutex 2020-04-06 15:31:49 +05:00
Lewin Bormann
c5bad4c209 chore(version): Release 4.1.0 2020-03-17 10:55:25 +01:00
Lewin Bormann
a80984d219 chore(version): Release 4.0.2
Update dependencies (#124)
2020-02-15 20:04:14 +01:00
Simonas Kazlauskas
05ee4a4cee chore(*): update the dependencies 2020-02-06 23:20:26 +02:00
Lewin Bormann
d17bbb719c chore(version): Release 4.0.1 2020-02-05 21:45:04 +01:00
Lewin Bormann
26513ec63c chore(version): Release 4.0.0 2020-02-05 21:44:38 +01:00
Glenn Griffin
f00bc5cb35 Update to httptest v0.11.1 2020-02-05 12:13:00 -08:00
Glenn Griffin
1d5c3a4512 Switch from mockito to httptest 2019-12-18 09:07:45 -08:00
Glenn Griffin
9238153723 Move to hyper 0.13.1!!!! 2019-12-18 09:07:45 -08:00
Glenn Griffin
5e39a81894 Go back to waiting for disk writes on every token set.
Defering disk writes is still probably a good idea, but unfortunately
there are some tradeoffs with rust's async story that make it non-ideal.
Ideally we would defer writes, but have a Drop impl on DiskStorage that
waited for all the deferred writes to complete. While it's trival to
create a future that waits for all deferred writes to finish it's not
currently possible to write a Drop impl that waits on a future.

It would be possible to write an inherent async fn that takes self by
value and waits for the writes, but that method would need to be
propogated up all the way to users of the library and they would need to
remember to invoke it before dropping the Authenticator.
2019-12-18 09:07:45 -08:00
Glenn Griffin
0525926bb2 Improve Token
Remove expires_in in favor of only having an expires_at DateTime field.
Add a from_json method that deserializes from json data into the
appropriate Token (or Error) and use that consistently throughout the
codebase.
2019-12-18 09:07:45 -08:00
Glenn Griffin
089c6ba212 Use seahash rather that DefaultHasher.
DefaultHasher is not documented as being consistent. It's best to not
trust that the resulting hash value is consistent even across different
executions of the same binary and even more so across different
versions.
2019-12-18 09:06:33 -08:00
Glenn Griffin
b6b48594b9 Remove dev-dependencies that are no longer used.
These appear to only be used by examples in the old/ directory which has
not compiled for a long time. Not sure why the contents of that
directory are still around.
2019-12-18 08:59:43 -08:00
Glenn Griffin
e5aa32b3cf Tidy up some imports.
No more need to macro_use serde. Order the imports consistently (albeit
somewhat arbitrary), starting with items from this crate, followed by
std, followed by external crates.
2019-12-18 08:59:43 -08:00
Glenn Griffin
88a8f74406 Refactor token storage.
The current code uses standard blocking i/o operations (std::fs::*) this
is problematic as it would block the entire futures executor waiting for
i/o.

This change is a major refactoring to make the token storage mechansim
async i/o friendly. The first major decision was to abandon the GetToken
trait. The trait is only implemented internally and there was no
mechanism for users to provide their own, but async fn's are not
currently supported in trait impls so keeping the trait would have
required Boxing futures. This probably would have been fine, but seemed
unnecessary. Instead of a trait the storage mechanism is just an enum
with a choice between Memory and Disk storage.

The DiskStorage works primarily as it did before, rewriting the entire
contents of the file on every set() invocation. The only difference is
that we now defer the actual writing to a separate task so that it does
not block the return of the Token to the user. If disk i/o is too slow
to keep up with the rate of incoming writes it will push back and
will eventually block the return of tokens, this is to prevent a buildup
of in-flight requests. One major drawback to this approach is that any
errors that happen on write are simply logged and no delegate function
is invoked on error because the delegate no longer has the ability to
say to sleep, retry, etc.
2019-12-18 08:57:24 -08:00
Glenn Griffin
93cbd91341 Move to std::futures to support async/await. 2019-12-18 08:53:22 -08:00
Lewin Bormann
0ab7c49266 chore(version): Release v3.1.1 2019-09-29 09:42:29 +02:00
Lewin Bormann
793f41d49e Merge branch 'master' of github.com:/dermesser/yup-oauth2 2019-09-29 08:40:37 +02:00
Aaron Hill
9597a05dc8 chore(dependencies): Update ring and hyper-rustls
This allows downstream crates to use newer versions of ring.
2019-09-28 16:57:29 -04:00
Lewin Bormann
2f74a665d8 chore(version): Publish version 3.1.0 2019-08-31 19:41:06 +02:00
Lewin Bormann
460af32922 chore(version): v3.0.3-beta 2019-08-03 16:42:54 +02:00
Lewin Bormann
58af9fc36b refactor(deps): Remove dependency on openssl. 2019-08-01 21:32:22 +02:00
Lewin Bormann
080df3fc77 chore(version): 3.0.2 2019-07-10 14:06:46 +02:00
Lewin Bormann
9a334e2d21 chore(version): Release v3.0.2-beta 2019-06-22 22:14:14 +02:00
Lewin Bormann
33babd3d53 test(ServiceAccount): Add tests for error paths. 2019-06-21 19:32:49 +02:00
Lewin Bormann
e0f3298904 test(ServiceAccount): Add test with internal mockito web server. 2019-06-21 11:22:24 +02:00
Lewin Bormann
d3f1f87760 chore(version): Mark 3.0.0 as -alpha for publishing. 2019-06-13 21:46:40 +02:00
Lewin Bormann
9efad9b086 chore(version): Preemptively change version to 3.0.0 2019-06-13 15:27:41 +02:00
Lewin Bormann
58383f9a03 refactor(DeviceFlow): Make DeviceFlow work with Futures 2019-06-12 18:43:30 +02:00
Lewin Bormann
59b2b03b7d rewrite(serviceaccount): Rewrite ServiceAccountAccess to use futures.
Also add example/test to check if obtaining tokens using JWTs works.
2019-06-12 13:50:56 +02:00
Lewin Bormann
c2fbee4dc8 rewrite(installed): Make the InstalledFlow asynchronous with futures. 2019-06-11 23:29:12 +02:00
Lewin Bormann
db4077983f cleanup(openssl): Remove openssl dependency 2019-06-09 08:34:25 +02:00
Lewin Bormann
a7262ea7e3 chore(version): Publish comma fix for nightly rust in 2.0.1 2019-05-26 20:19:24 +02:00
Lewin Bormann
126c7cf32f chore(version): 2.0.0-pre -> 2.0.0 2019-05-26 11:12:26 +02:00
Guy Taylor
9f7f3c3b95 Upgrade to Hyper v0.12
This upgrade Hyper to v0.12 and updats to code to work for it. It has
being done with the minimum code change and so the logic is still
aukward for the futures model. This should be addressed in later commits
but I did not want to compilcate an already large commit.
2019-05-26 11:08:32 +02:00
Guy Taylor
e0c05210c1 Update version from 1.x to 2.x
Update version number and docs as the move to Hyper v0.12 will cause a
breaking change to consumers of this lib.
2019-05-26 11:04:32 +02:00
Lewin Bormann
0da0ff247b chore(version): Publish version 1.0.11 2019-02-12 06:20:10 +01:00
Lewin Bormann
4243ea8d41 chore(version): Version 1.0.10 2019-02-12 06:19:35 +01:00
Lewin Bormann
1ae13ca517 Merge pull request #82 from ignatenkobrain/patch-2
chore: Update itertools to 0.8
2019-02-11 19:59:29 +01:00
Igor Gnatenko
df5495879d chore: Update itertools to 0.8 2019-02-10 17:58:37 +01:00
Igor Gnatenko
0f93e5e915 chore: Update base64 to 0.10 2019-02-10 16:56:53 +01:00
Jamie Turner
20810e32d5 Add a no-openssl feature.
Recently, commits were made to remove support for using rustls/ring
in lieu of OpenSSL to avoid having to add those as dependencies in
environments where OpenSSL already exists.

However, yup-oauth2 is being used in some environments where
*OpenSSL* doesn't exist. So, retaining the option to build
it with an openssl-free stack is key.

Note, the change to hyper-native-tls is fine and actually
unrelated, because this is often happening on Windows or
Mac enviornments, where the stack that will link to is
*not* necessarily OpenSSL either.

For example, the particular breakage that prompted this
CR is a build of yup-oauth2 on iOS. In that environment,
hyper-native-tls uses Apple's Security Framework,
but OpenSSL libraries are not actually present on all
devices/simulator environments. So a link against
a mix of Security Framework and rustls make sense,
there.

Also, update to a newer version of rustls/ring while we're at it.
2019-01-04 12:54:08 -08:00