Skip to content

Commit 3f98405

Browse files
Merge pull request #3 from nicolas-vivot/feature/migrating-existing
chore: README updates
2 parents 00a2737 + 75bd0e3 commit 3f98405

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

Diff for: README.md

+13-10
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,20 @@ Libraries that deal with authentication can be divided into two parts:
2020
- the providers: the ones that perform the authentication and provide tokens. Example: [Google Cloud Rust][link-google-cloud-rust].
2121
- the consumers: the ones that require you to provide tokens for their usage. Example: [Reqwest][link-reqwest], [Openapi Generator][link-openapi-generator].
2222

23-
Unfortunately, nothing really unify these two category of libraries.
23+
Unfortunately, nothing really unify these two categories of library.
2424
Also, because some libraries may provide you very limited way to manage the tokens, it often leave you the responsibility to bridge the gap between the two.
2525

2626
**Example 1**
27+
2728
You are deploying a service in Kubernetes (let's say GKE) and this servive need to request another one.
2829
- the external service provides a rust client library, automatically generated via [Openapi Generator][link-openapi-generator]. This requires to set the authentication as a `string` when creating the client.
2930
- use [Google Cloud Rust][link-google-cloud-rust] or any other crate providing similar features to get a valid authentication token.
3031

3132
It will come a time where a generated token will expire (especially short-time ones) and you probably do not want to create a new client instance for every request your need to perform to the external service.
32-
Here, because of the lack of functionalities/authentication mechanism support from the generate library, you have no choice than dealing with the token expiry verification and renewal by yourself, re-creating a new client.
33+
Here, because of the lack of functionalities/authentication mechanism support from the generated library, you have no other choice than dealing with the token expiry verification and renewal by yourself, re-creating a new client.
3334

3435
**Example 2**
36+
3537
You are deploying a service in Kubernetes (let's say GKE) and this service need to request another one.
3638
You may use:
3739
- use [Reqwest][link-reqwest] to query the external service, providing a token as a `string` put in the headers.
@@ -41,20 +43,21 @@ You may use:
4143
Everything may goes well, until one of your request get triggered very close to the expiry time of your already generated token and that request fails and get retries for some reason. When the retry policy applys, the authentication token will expire and the subsequent retries will all fails due to `403`
4244

4345
**Example 3**
46+
4447
Same as example 2, but let says that you now want to deploy your service in both GKE and EKS.
4548
You will have to provide two different way of sourcing the authentication tokens. You can use any technic (based on environment settings, based on compilation profiles) but your will certainly have to write some code to deal with this, and that can be pretty boiler plate depending on the libraries you will use.
4649

47-
### One crate to standardize them all!
48-
49-
Having a single crate defining simple definitions of `token-source` and `token-source-provider` as Trait will help to standardize expectations, behavior and responsibilities across libraries.
50+
### One crate to standardize them all
5051

51-
Of course, this will be proven true as libraries start using those trait as their requirements, rather than pure `string` or custom types.
52+
Having a single crate with simple definitions of `token-source` and `token-source-provider` as Trait will help to standardize expectations, behavior and responsibilities across libraries.
5253

54+
As other libraries start to use the `TokenSource` and `TokenSourceProvider` traits in place of raw of custom types, it will become easier to use it.
5355

54-
### What benefits does this bring ?
55-
- vendor agnostic
56-
- better abstraction (enhanced cross library integration)
57-
- better separation of concerns and responsibilities
56+
### What benefits does this bring?
57+
- vendor agnostic.
58+
- better abstraction, separation of concerns and responsibilities.
59+
- enhanced cross library integration.
60+
- less DIY glue code.
5861

5962
## License
6063
This project is licensed under the [MIT license](./LICENCE).

0 commit comments

Comments
 (0)