Commit Graph

483 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
be4faf944b drive_example: Make example compile again. Fixes #134 2020-10-27 15:25:16 +01:00
Lewin Bormann
2f50876002 Release v4.1.3 2020-10-27 11:11:33 +01:00
Lewin Bormann
9bf40bef5b Authenticator: Switch from keep_alive to pool_max_idle_per_host 2020-10-27 11:10:57 +01:00
Lewin Bormann
d193431465 Make two more application secret types Debug 2020-10-27 11:10:30 +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
c888d23d19 Add link to async-google-apis in README. 2020-10-17 20:08:10 +02:00
ggriffiniii
3d84ddd178 Merge pull request #132 from zauberpony/fix-claim-field-name
fix 'subject' name in service-account claim
2020-05-28 11:31:13 -07:00
Elmar Athmer
43c8a3d77d fix 'subject' name in service-account claim
As indicated by
https://developers.google.com/identity/protocols/oauth2/service-account#httprest
the name for the subject-field inside the JWT claim needs to be named
'sub' (instead of 'subject').
This is relevant e.g. for the GSuite Admin Directory API.
2020-05-28 17:23:15 +02:00
Lewin Bormann
3221e8986a chore(version): Publish v4.1.2 2020-05-01 20:36:01 +02:00
Lewin Bormann
6bd2c30337 Merge pull request #129 from GeorgeHahn/consumer-improvements
Expose default authenticator type
2020-05-01 20:35:41 +02:00
Lewin Bormann
dab93ff1e4 Merge pull request #130 from GeorgeHahn/update-deps
Update dependencies
2020-05-01 20:34:44 +02:00
George Hahn
4b1262933b Update dependencies 2020-05-01 11:52:23 -05:00
George Hahn
b891e9e670 Expose default authenticator type
This allows downstream users to avoid a dependency on hyper
2020-05-01 11:25:25 -05:00
Lewin Bormann
6fe83abf61 chore(version): release 4.1.1 for #127
fixes #128
2020-04-29 18:16:07 +02:00
Lewin Bormann
fa3c53457f Merge pull request #127 from abdul-rehman0/change-mutex-to-futures-aware-mutex
feat: Use futures-aware mutex
2020-04-07 17:10:20 +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
a15d293fa6 Merge branch 'allow-token-refresh'
Fix #125
2020-03-17 10:44:27 +01:00
Lewin Bormann
35157400ad chore(rustfmt): Run rustfmt 2020-03-16 19:15:14 +01:00
Lewin Bormann
1e492c7393 feat(refresh): Allow forcing Authenticator to refresh a token
On #125
2020-03-16 18:33:15 +01:00
Lewin Bormann
81ac154e36 docs(contributors): Add CONTRIBUTORS file 2020-02-20 09:52:34 +01:00
Lewin Bormann
c70956269b chore(lint): Run rustfmt 2020-02-16 20:57:20 +01:00
Lewin Bormann
a80984d219 chore(version): Release 4.0.2
Update dependencies (#124)
2020-02-15 20:04:14 +01:00
Lewin Bormann
59bbe8edb0 Merge pull request #124 from nagisa/updeps
chore(*): update the dependencies
2020-02-15 20:03:39 +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
Lewin Bormann
ab9c128ff4 Merge pull request #123 from ggriffiniii/master
Update to httptest v0.11.1
2020-02-05 21:44:00 +01:00
Glenn Griffin
f00bc5cb35 Update to httptest v0.11.1 2020-02-05 12:13:00 -08:00
ggriffiniii
b9cb96673d Merge pull request #119 from kendase3/two-steps-docfix
fixup // to /// for DeviceFlow doc
2020-01-17 12:43:13 -08:00
Steven 'Steve' Kendall
76ecfea853 Merge remote-tracking branch 'upstream/master' into two-steps-docfix 2020-01-17 14:45:16 -05:00
Steven 'Steve' Kendall
aedac1b423 fixup // to /// for DeviceFlow doc 2020-01-14 15:05:26 -05: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
348a59d96e Create the token file with more secure permissions on unix.
This creates files with 0600 permissions on unix. Still the default
permissions on non-unix platforms.
2019-12-18 09:07:45 -08:00
Glenn Griffin
5c0334ee6f Add debug logging.
Could be helpful when troubleshooting issues with various providers if
the user is able to turn on debug logging. The most critical logging
provided is the request and responses sent and received from the oauth
servers.
2019-12-18 09:07:45 -08:00
Glenn Griffin
6817fce0bc Extend the refresh tests.
Verify that a second refresh can happen after the first. This adds
coverage to ensure that a refresh flow keeps the refresh token intact by
showing that a second refresh can succeed.
2019-12-18 09:07:45 -08:00
Glenn Griffin
36d186deb4 Authenticator now returns an AccessToken.
What was previously called Token is now TokenInfo and is merely an
internal implementation detail. The publicly visible type is now called
AccessToken and differs from TokenInfo by not including the refresh
token. This makes it a smaller type for users to pass around as well as
reducing the ways that a refresh token may be leaked. Since the
Authenticator is responsible for refreshing the tokens there isn't any
reason users should need to concern themselves with refresh tokens.
2019-12-18 09:07:45 -08:00
Glenn Griffin
045c3e7735 Move all the end to end tests into an integration test
All the same functionality can be tested through the publicly exposed
API providing more extensive coverage.
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
1b39ce4413 Refactor storage to only use a BTreeMap.
Keeping the same tokens in a Vec and BTreeMap created more overhead than
was warranted. It makes much more sense to simply iterator over the
BTreeMap than keep a separate Vec.
2019-12-18 09:07:45 -08:00
Glenn Griffin
497ebf61c5 Add a test to ensure that Authenticator is Send+Sync 2019-12-18 09:07:45 -08:00
Glenn Griffin
c829fb453d cargo fmt 2019-12-18 09:07:45 -08:00
Glenn Griffin
50824c7777 Use Arc<Mutex<T>> rather than Rc<RefCell<T>> in DiskStorage.
This keeps DiskStorage Sync + Send and therefore Authenticator Sync +
Send. The DiskStorage was threadsafe because JSONTokens contains a Mutex
around all the Rc<RefCell<T>> objects, but there's no way to prove to
the type system that none of the Rc's get cloned to an alias used
outside the Mutex so it's not provably safe. I'll probably reevaluate
the design here, but in the meantime the double locking is fine.
2019-12-18 09:07:45 -08:00
Glenn Griffin
635bd5e21a Fix a bug introduced in the storage layer.
When bloom filters were added the btreemap values changed to be a
vector of tokens to accomodate the possibility of bloom filter
collisions. The implementation naively just pushed new tokens onto the
vec even if they were replacing previous tokens meaning old tokens were
still kept around even after a refresh has replaced it. To fix this
efficiently the storage layer now tracks both a hash value and a bloom
filter along with each token. Their is a map keyed by hash for every
token that points to a reference counted version of the token, and each
token also exists in a separate vector. Updates to existing tokens
happens in place, when new entries are added they are added to both data
structures.
2019-12-18 09:07:45 -08:00
Glenn Griffin
0a4c1e79d2 Make DeviceFlowDelegate::present_user_code return a Future.
This is to allow for implementations to use async code. The returned
Future will be awaited before polling for the token begins.
2019-12-18 09:07:45 -08:00
Glenn Griffin
4521e2f246 Rename PollInformation DeviceAuthResponse.
Have it correctly handle either verification_uri or verification_url and
deserialize into a struct that has the data types desired.
2019-12-18 09:07:45 -08:00