Commit Graph

139 Commits

Author SHA1 Message Date
Lewin Bormann
33babd3d53 test(ServiceAccount): Add tests for error paths. 2019-06-21 19:32:49 +02:00
Lewin Bormann
c321f6d2e6 fix(ServiceAccount): Make cache behavior more intuitive.
Now the cache is only checked for a token when the future is polled, not
at future creation time.

This also allows for reverting c2b41c3.
2019-06-21 18:41:17 +02:00
Lewin Bormann
e0f3298904 test(ServiceAccount): Add test with internal mockito web server. 2019-06-21 11:22:24 +02:00
Lewin Bormann
534d5edc12 refactor(google): Make some things less google-specific. 2019-06-19 18:22:03 +02:00
Lewin Bormann
9e4a7e6d49 refactor(StringError): Take more comfortable types in StringError::new 2019-06-14 10:44:44 +02:00
Lewin Bormann
5a568f2358 fix(refresh): Write refreshed tokens back to cache.
Tested manually.
2019-06-13 18:58:49 +02:00
Lewin Bormann
0eb1268567 doc(tokio): Set keep_alive to false on hyper clients.
This prevents hanging event loops.
2019-06-13 18:52:04 +02:00
Lewin Bormann
f034b8bea4 imp(ServiceAccountAccess): Print exact error if server returns one.
Prevents #76.
2019-06-13 16:16:51 +02:00
Lewin Bormann
6b05056b05 imp(expiry): Treat tokens with < 1 minute life left as expired.
Fixes #78.
2019-06-13 16:08:23 +02:00
Lewin Bormann
4cfbc6e5fc imp(Device): Honor FlowDelegate's opinion on pending authorization. 2019-06-13 16:07:32 +02:00
Lewin Bormann
48cf83e4da feat(Authenticator): Implement new Authenticator. 2019-06-13 15:32:31 +02:00
Lewin Bormann
18411a0610 imp(Storage): Implement Default for MemoryStorage and make errors sendable 2019-06-13 15:30:50 +02:00
Lewin Bormann
a656df6b74 feat(GetToken): Add application_secret method to GetToken trait.
This makes decoupling Authenticator and individual flows easier while
allowing for refreshing tokens.
2019-06-13 15:29:18 +02:00
Lewin Bormann
86e71cca5d feat(DefaultFlowDelegate): Introduce DefaultFlowDelegate type.
This was necessary after splitting traits.
2019-06-13 15:28:25 +02:00
Lewin Bormann
505d759ba0 refactor(Refresh): Convert Refresh flow to be simpler and use futures. 2019-06-12 22:13:58 +02:00
Lewin Bormann
71a45f059e refactor(delegate): Split AuthenticatorDelegate to have FlowDelegate 2019-06-12 21:16:28 +02:00
Lewin Bormann
46e1f1b880 feat(DeviceFlow): Proper timeout handling for the DeviceFlow. 2019-06-12 19:28:37 +02:00
Lewin Bormann
e7a89fae07 refactor(cleanup): Remove obsolete tests.
DeviceFlow now works in a different way, so remove old test.
2019-06-12 18:49:14 +02:00
Lewin Bormann
58383f9a03 refactor(DeviceFlow): Make DeviceFlow work with Futures 2019-06-12 18:43:30 +02:00
Lewin Bormann
732e594962 refactor(InstalledFlow): Implement GetToken for InstalledFlow 2019-06-12 14:40:08 +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
39fe5f1d25 chore(syntax): Use dyn everywhere and remove unused imports. 2019-06-12 00:05:32 +02:00
Lewin Bormann
f3774e4b74 fix(tests): Disable unused tests and fix failing ones. 2019-06-12 00:02:47 +02:00
Lewin Bormann
7c1731cac9 chore(rustfmt): cargo fmt 2019-06-11 23:41:55 +02:00
Lewin Bormann
c2fbee4dc8 rewrite(installed): Make the InstalledFlow asynchronous with futures. 2019-06-11 23:29:12 +02:00
Lewin Bormann
9f061a0a10 Work on Installed flow for futures 2019-06-09 11:25:53 +02:00
Lewin Bormann
79f66402e1 First step towards futures in yup-oauth2 2019-06-09 10:55:53 +02:00
Lewin Bormann
ce9b6d8dd7 chore(syntax): Remove extern crate imports where not needed 2019-06-09 09:24:15 +02:00
Lewin Bormann
db4077983f cleanup(openssl): Remove openssl dependency 2019-06-09 08:34:25 +02:00
alu
b7962a8ba1 Fix hyper 0.12.x compatibility 2019-05-27 16:16:02 +09:00
Lewin Bormann
610240eb7c fix(syntax): Fix #92.
It was a missing comma.
2019-05-26 20:12:08 +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
Mohamed Zenadi
6098eeb45c fix typo 2019-05-04 20:06:11 +02:00
Lyle Mantooth
108162fcf8 imp: accept any string-like parameter
Use the power of the `AsRef` trait to take generic parameters for
several API functions. This makes the API more ergonomic because the
callers may pass in static `str` slices or references to owned `String`s
or even more exotic things like a `Cow`, all based on their particular
situation.

Update the tests and examples to use the most natural types they have
available.

Fixes #77. No existing code should break, as `&String` implements
`AsRef<str>` and `AsRef<Path>`
2019-04-03 09:01:28 -04:00
Guy Taylor
b96cfcd66a Format to fustfmt defaults and force lint check in Travis 2019-02-21 20:46:00 +00:00
Lewin Bormann
39e6baa9c0 Merge pull request #84 from mashedcode/nit-weird-return-value-required
imp(flows) don't require present_user_url to return an additional char
2019-02-15 17:37:32 +01:00
mash
a7d5c40f5b imp(flows) don't require present_user_url to return an additional char
For custom AuthenticatorDelegate implementations it may be very weird to
be required to return an additional character after the code from
present_user_url.

One may find himself chasing the bug which is bad UX for the user.

Improve this behavior and therefore introduce a breaking change that
will hopefully not break existing implementations nevertheless.
2019-02-15 16:24:12 +00:00
mash
4497eeb31a feat(flows): allow custom redirect uri
When implementing AuthenticatorDelegate one might want to change the
redirect_uri to use an authorized domain or just change the way
InstalledFlow works.

Add a redirect_uri method to AuthenticatorDelegate that may be
implemented to define a custom redirect uri if needed.
2019-02-12 16:48:08 +00: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
Jamie Turner
ab4b2c2fd4 Rust 2018 edition modifications. 2019-01-04 12:43:19 -08:00
Igor Gnatenko
3163be984d deps: rustls → openssl
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2018-07-25 22:51:51 +02:00
Igor Gnatenko
9b5bbf5459 deps: hyper-rustls → hyper-native-tls
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2018-07-25 22:51:37 +02:00
Igor Gnatenko
78cefeab47 deps: update url to 1
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2018-07-25 22:50:45 +02:00
Igor Gnatenko
e634d3f139 deps: update chrono to 0.4
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2018-07-25 22:47:52 +02:00
Mark Catley
f529404ccb docs: update the example to use the hyper tls connector
This is required to use tls apis hyper 0.10. The example uses a tls api, so this is required.

Closes #52
2018-05-07 12:24:55 +12:00
Martell Malone
f6d0fa0260 feat(jwt): use rustls and remove openssl
This removes the need for the remaining C interfaces.
Building any rust library with openssl adds a bunch
of depends such as foreign types via ffi and pkgconfg.
You are also required to have a prebuilt openssl.
Cross building and keeping up to date should be easier
with a pure rust implementation.
2017-06-26 16:29:56 +01:00
Brian Smith
22a3076924 Update dependencies.
The current Git master doesn't build with Rust 1.17 because the
version of Rustls used on master doesn't built with Rust 1.17.

* Update the base64 dependency to ensure the version with a buffer
overflow fix is used.

* Update hyper-rustls to one that uses a version of Rustls that builds
with Rust 1.17, and that uses *ring* 0.9+, to ensure there are no
problems with accidentally linking multiple versions of *ring*, to make
the build easier to set up (especially on Windows), and to keep things
working once *ring* 0.7.* gets yanked.

* Update the rust-openssl dependency while we're at it.
2017-05-09 10:42:32 -10:00
OZ
09488622a7 Make "sub" argument simple String in with_sub constructor 2017-02-26 01:23:20 +01:00
OZ
4e45d4358d Add with_sub method for ServiceAccountKey - required to read email from user accounts 2017-02-22 03:50:21 +01:00
Lewin Bormann
38fd851493 fix(service_account): Fix bad PR #51: JWTs need RSA signatures. 2017-02-04 17:03:47 +01:00