Commit Graph

160 Commits

Author SHA1 Message Date
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
Sebastian Thiel
59584b240e imp(serde):use proc_macros and serde-derive
With Rust 1.15, proc macros have been stabilized. Therefore
custom build scripts are not required anymore.

This commit removes all the previous machinery and the
need for nightly.
2017-02-03 06:40:00 +01:00
Lewin Bormann
d4ebbc47b2 chore(language): Sort imports and migrate from deprecated types.
std:#️⃣:SipHasher is not std::collections::hash_map::DefaultHasher
(really!?).
Imports were unordered.
2017-01-31 19:27:50 +01:00
Lewin Bormann
567ff12cd4 fix(deps): Fix dependency problems and openssl test failure.
Sigh, #51 again.
2017-01-31 18:54:07 +01:00
Lewin Bormann
1639b1648f Revert "fix(openssl): Update to 0.9.x"
The patch introduced an unwrap() failure in a test.

This reverts commit fe0a094b45.
2017-01-30 19:54:12 +01:00
Martell Malone
fe0a094b45 fix(openssl): Update to 0.9.x
This also updates hyper to 0.10.x because it uses openssl
2017-01-26 10:56:47 +00:00
Lewin Bormann
608b2af781 doc(service_account): auth/token URIs aren't hardcoded anymore
Instead, they're taken from the ServiceAccountKey JSON structure.
2016-12-23 10:00:40 +01:00
Sebastian Thiel
11baf2f712 fix(serde): use serde_derive
serde_macros is no longer maintained and will eventually
fail on nightly.
Also in a hopefully not-so-distant future, we will be able
to use macros 1.1 in stable, and thus get rid of the
complication required for the hybrid approach.
2016-10-09 16:38:52 +02:00
Lewin Bormann
a8479b8ddb feat(device): Make the Device flow independent of Google
This is a breaking change; it's supposed to fix #1. Also, it's a
proposal -- not sure if the benefits outweigh the cost of this.

The example/auth.rs binary is not broken by this, as it doesn't use the
API that changed. The tests have been updated accordingly.
2016-10-09 09:55:33 +02:00
Lewin Bormann
08d79de313 fix(tests): A deactivated key leads to "Signature errors" 2016-10-01 15:40:45 +02:00
Lewin Bormann
970d188794 feat(service_account): Enable service account oauth with other providers
The Token URI is already in the client key, so we should just use that
information instead of hardcoding it.
2016-10-01 15:33:55 +02:00
Lewin Bormann
2b77d01229 Merge pull request #40 from dermesser/crate-docs
docs(crate): Update crate documentation
2016-09-28 22:15:22 +02:00
Lewin Bormann
b143033ad1 fix(service_account): Use correct base64 encoding 2016-09-28 21:45:10 +02:00
Lewin Bormann
69c43287e7 docs(crate): Update crate documentation
Please regenerate the documentation in `gh-pages`.
2016-09-28 21:19:43 +02:00
Lewin Bormann
a4d60e754b fix(deps): Use small base64 crate instead of rustc-serialize 2016-09-28 20:10:53 +02:00
Lewin Bormann
3cf00eb1cf docs(crate): Add a short snippet about service account auth. 2016-09-21 22:50:23 +02:00
Lewin Bormann
ed0a3c4990 fix(types::Token): Don't panic if refresh_token is empty
Service account tokens don't set the refresh_token. Checking the
access_token field should be sufficient.
2016-09-21 09:24:09 +02:00
Lewin Bormann
943f57e42f fix(service_account): Remove debug println from code
whoops :)
2016-09-21 09:03:51 +02:00
Lewin Bormann
624a202464 docs(helpers): Let service account and helper code show up in rustdoc 2016-09-21 08:39:47 +02:00
Lewin Bormann
1c1880cfe7 feat(service_account): Implement token source for service accounts
Tested with unit tests and against Google OAuth.
2016-09-20 20:29:19 +02:00
Lewin Bormann
d151e75454 feat(helpers): Add service account key helper 2016-09-20 20:19:10 +02:00
Lewin Bormann
0506ffaa44 feat(helpers): Implement hash_scope() helper function 2016-09-20 20:19:00 +02:00
Lewin Bormann
2bdb47375a feat(refactor): Move StringError from authenticator to types module 2016-09-20 20:18:45 +02:00
Lewin Bormann
51e0b9d163 docs(installed): Mention the InstalledFlow in the documentation 2016-09-04 19:29:56 +02:00
Lewin Bormann
cb66737988 fix(test): Add missing import to authenticator tests 2016-09-04 19:20:59 +02:00
Lewin Bormann
a4532f27b4 fix(helper): Parse app secrets into right type 2016-08-31 20:46:10 +02:00
Lewin Bormann
c4231e9499 feat(helpers): Add helpers for reading/parsing JSON
This is boilerplate that can easily be provided to users of the library.
2016-08-31 20:07:33 +02:00
Lewin Bormann
85b12dd3e8 refactor(common): Rename common -> types 2016-08-31 20:01:24 +02:00
Lewin Bormann
9e59bf0496 refactor(all): More flows demand for a different structure
I mainly resolved some circular dependencies that had crept in, and
moved code around. I renamed helper.rs because that was not really an
appropriate name anymore, and moved the delegate code into a new module.
2016-08-31 19:48:38 +02:00
Sebastian Thiel
7a907eb318 fix(dependencies): use latest version of serde_codegen
In the way it's meant to be used, which means it uses it's
own version of syntex, to assure it doesn't clash anymore in
unforseen ways.
2016-07-17 11:36:21 +02:00