Commit Graph

59 Commits

Author SHA1 Message Date
Glenn Griffin
fbb8c69efb Change the name of TokenGetterBuilder to AuthFlow.
I believe AuthFlow more succinctly describes the purpose of the type to
users reading documentation.
2019-08-29 11:48:29 -07:00
Glenn Griffin
ccc6601ff3 Use the builder pattern to create authenticators.
Beyond simply moving to the builder pattern for intialization this has a
few other effects.

The DeviceFlow and InstalledFlow can no longer be used without an
associated Authenticator. This is becaus they no longer have any
publicly accessible constructor. All initialization goes through the
Authenticator. This also means that the flows are always initialized
with a clone of the hyper client used by the Authenticator.

The authenticator uses the builder pattern which allows omitting
optional fields. This means that if users simply want a default hyper
client, they don't need to create one explicitly. One will be created
automatically. If users want to specify a hyper client (maybe to allow
sharing a single client between different libraries) they can still do so
by using the hyper_client method on the builder. Additionally for both
AuthenticatorDelegate's and FlowDelegate's if the user does not specify
an override the default ones will be used.

The builders are now exposed publicly with the names of Authenicator,
InstalledFlow, and DeviceFlow. The structs that actually implement those
behaviors are now hidden and only expose the GetToken trait. This means
some methods that were previously publicly accessible are no longer
available, but the methods appeared to be implementation details that
probably shouldn't have been exposed anyway.
2019-08-29 11:47:15 -07:00
Glenn Griffin
eb2a82f685 Make listening on an ephemeral port an option rather than the default. 2019-08-29 09:59:10 -07:00
Glenn Griffin
e83ec7e25e Have the installed flow http server always listen on an ephemeral port.
Specifying a port of zero has the server listen on an ephemeral port.
Many users may not be aware of that unless they have a background in
networking where that's common practice. I'm also not able to think of
any use cases where listening on a hardcoded port would be beneficial,
so with this change I've opted to remove the ability entirely rather
than simply documenting that almost everybody should specify zero.
2019-08-09 13:59:03 -07:00
Glenn Griffin
e0e955b2f6 Make fixes to support rust 1.35.0
Apparently 1.36.0 added From<&String> for String.
2019-08-08 15:01:01 -07:00
Lewin Bormann
58af9fc36b refactor(deps): Remove dependency on openssl. 2019-08-01 21:32:22 +02:00
Mark Catley
7459f167c5 Fixing typos and spelling in comments. 2019-06-28 09:46:59 +12:00
Lewin Bormann
602ea1565d refactor(errors): Move almost everything to RequestError.
This is nicer than stupid Box<dyn Error+Send> everywhere.
2019-06-22 21:53:55 +02:00
Lewin Bormann
8d6085375f doc(Installed): More documentation about InstalledFlow and new example 2019-06-22 20:25:47 +02:00
Lewin Bormann
e0f3298904 test(ServiceAccount): Add test with internal mockito web server. 2019-06-21 11:22:24 +02:00
Lewin Bormann
48cf83e4da feat(Authenticator): Implement new Authenticator. 2019-06-13 15:32:31 +02:00
Lewin Bormann
f3774e4b74 fix(tests): Disable unused tests and fix failing ones. 2019-06-12 00:02:47 +02:00
Lewin Bormann
c2fbee4dc8 rewrite(installed): Make the InstalledFlow asynchronous with futures. 2019-06-11 23:29:12 +02:00
Lewin Bormann
ce9b6d8dd7 chore(syntax): Remove extern crate imports where not needed 2019-06-09 09:24:15 +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
b96cfcd66a Format to fustfmt defaults and force lint check in Travis 2019-02-21 20:46:00 +00: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
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
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
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
69c43287e7 docs(crate): Update crate documentation
Please regenerate the documentation in `gh-pages`.
2016-09-28 21:19:43 +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
51e0b9d163 docs(installed): Mention the InstalledFlow in the documentation 2016-09-04 19:29:56 +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
Sebastian Thiel
31bad1ae53 chore(features): rename with_syntex to with-syntex
This makes the name similar to the one used in quasi, aster, serde
and the likes.
2016-05-20 14:57:09 +02:00
Sebastian Thiel
a3bc7e88b5 chore(serde): upgrade to latest version for stable
Now it builds with stable too, it appears.
2016-05-20 12:15:23 +02:00
Sebastian Thiel
ad0bde3092 fix(tests): assure tests actually work
Previously we simply forgot to run the tests, and published test-code
that didn't really work.
2015-08-08 11:45:53 +02:00
Sebastian Thiel
a169d9610d chore(serde): update to serde 0.5.0
Serde move all json code into a separate crate, which we are now pulling
in separately.
2015-08-08 10:40:14 +02:00
Sebastian Thiel
6a5915d7d6 fix(lib): remove macro usage to work on stable
As usage of the `!include` macro is enforced, there is currently no way
to use the exported macros from `yup_hyper_mock`. Now some more
boilerplate code was added to make it work anyway.
2015-06-18 17:58:22 +02:00
Sebastian Thiel
a260b13868 fix(lib): setup nightly crate meta data correctly
* Previously the meta-data was applied to the crate, which doesn't seem
  to work.
* attempted to make `examples/auth.rs` work on stable. This isn't
  properly tested now, as tests don't compile.

We are now at a state were stable as well as nightly work similarly,
but fail because `include!` doesn't behave correctly if macros are
involved. Namely it happens before crates are linked, yet it will
try to expand macros right away, which is a problem.

If the macro is defined in an empty fashion, it will actually be used
at include time, and expanded. Which causes issues further down the
compilation.

With the current 'fix' we manage to at least make everything but
`cargo test` work.

Related to #12
2015-06-11 11:29:10 +02:00
Sebastian Thiel
37231fad2e chore(make): added makefile
* It should help to keep track of how to properly call cargo in nightly
  mode. After all, I have wasted some time, multiple times just trying
  to figure out that I forgot to add the nightly feature.
* Slightly improved structure of lib.rs and includes

Related to #12
2015-06-11 10:57:57 +02:00
Sebastian Thiel
0901497d89 fix(syntex): cleanup, build works on stable
It seems it doesn't like one line in particular (helper.rs:450),
which causes syntex to crash. Commenting it out does the trick.
2015-05-26 17:46:47 +02:00
Sebastian Thiel
9b2f9e77be feat(syntex): basic infrastructure
It doesn't yet work on nightly due to a panic in
https://goo.gl/RyM4GT

Might have something to do with me being on nightly,
and some cargo-related hickoup.
2015-05-26 14:41:31 +02:00
Sebastian Thiel
598f5ed496 chore(cargo):update to latest hyper/yup-hyper-mock
This fixes the macro issues that caused us so much trouble
2015-05-18 10:46:38 +02:00
Sebastian Thiel
e05e5553e3 feat(serde): use serde instead of rustc_serialize
That way, we can pretty-print the respective application secret
strucures. This is primiarily of interest for the main client of this
library, namely Google APIs RS.

Version incremented.

Fixes #2
2015-04-30 14:18:44 +02:00
Sebastian Thiel
3ca51ccfe2 fix(rustup): 1.1.0-nightly (97d4e76c2 2015-04-27)
Also incremented version
2015-04-29 09:53:27 +02:00
Sebastian Thiel
727c1d801b fix(rustup): replace sleep with sleep_ms
Now it works with the latest compiler. I wonder why I didn't notice
that before ... .
2015-04-26 21:13:45 +02:00
Sebastian Thiel
1ce4147d54 fix(refresh): use correct URL for refresh flow
This also allowed us to simplify the API once again.
2015-04-23 17:24:20 +02:00
Sebastian Thiel
2481c75c31 fix(API): review Result types and adapt code
* Do not return massive custom result enums, but instead adhere to the
  `Result` convention. This natively fixed our problem related to having
  to make unnecessary clones, making our design much cleaner.

Fixes #4
2015-04-23 17:01:21 +02:00
Sebastian Thiel
2cdf8bbf76 fix(API): overall improved error handling
* Return `Result<Token, Box<Error>>` type wherever feasible
* increment version to 0.3.5
* remove all usages of depreceated std items
2015-04-23 13:47:49 +02:00
Sebastian Thiel
84454d1736 fix(rustup): (abf0548b5 2015-04-15) (built 2015-04-15) 2015-04-17 06:39:16 +02:00
Sebastian Thiel
0222a19e9d fix(version-up): v0.3.3
* hyper adjustments to deal with Client without type parameter
* adjust to changed crate name conventions, '-' are converted to '_'

Fixes #3
2015-04-08 16:40:48 +02:00
Sebastian Thiel
2489b81383 fix(update-dependencies): rustup + dep-up
* updated to rustc (be9bd7c93 2015-04-05)
* use latest hyper

The latter required us to deal with HttpError not being clonable
anymore.
2015-04-07 10:35:25 +02:00
Sebastian Thiel
feba2d0e5a feat(header): Authorization Scheme for Oauth
Allows not natively use Oauth2 schemes with hyper Authorization headers.
Added support for serialization and parsing.
2015-03-22 11:55:05 +01:00
Sebastian Thiel
3d1678daea fix(rustup): update to latest rustc
rustc 1.0.0-nightly (3e4be02b8 2015-03-13) (built 2015-03-13)
2015-03-15 11:34:03 +01:00