Added dedicated resolvers section

Signed-off-by: Andre Wanlin <awanlin@spotify.com>
This commit is contained in:
Andre Wanlin
2024-04-16 11:03:28 -05:00
parent a874dd1524
commit 8383e2ca7d
9 changed files with 105 additions and 55 deletions
+12 -2
View File
@@ -34,8 +34,6 @@ auth:
- resolver: emailMatchingUserEntityAnnotation
```
> Note: the resolvers will be tried in order, but will only be skipped if they throw a `NotFoundError`.
The full `audience` value can be obtained by visiting your [Identity-Aware Proxy Google Cloud console](https://console.cloud.google.com/security/iap), selecting your project, finding your Backend Service to proxy, clicking the 3 vertical dots then "Get JWT Audience Code", and copying from the resulting popup, which will look similar to the following:
![Identity-Aware Proxy JWT Audience Code popup](../../assets/auth/gcp-iap-jwt-audience-code-popup.png)
@@ -43,6 +41,18 @@ The full `audience` value can be obtained by visiting your [Identity-Aware Proxy
This config section must be in place for the provider to load at all. Now let's
add the provider itself.
### Resolvers
This provider includes several resolvers out of the box that you can use:
- `emailMatchingUserEntityProfileEmail`: Matches the email address from the auth provider with the User entity that has a matching `spec.profile.email`. If no match is found it will throw a `NotFoundError`.
- `emailLocalPartMatchingUserEntityName`: Matches the [local part](https://en.wikipedia.org/wiki/Email_address#Local-part) of the email address from the auth provider with the User entity that has a matching `name`. If no match is found it will throw a `NotFoundError`.
- `emailMatchingUserEntityAnnotation`: Matches the email address from the auth provider with the User entity where the value of the `google.com/email` annotation matches. If no match is found it will throw a `NotFoundError`.
> Note: The resolvers will be tried in order, but will only be skipped if they throw a `NotFoundError`.
If these resolvers do not fit your needs you can build a custom resolver, this is covered in the [Building Custom Resolvers](../identity-resolver.md#building-custom-resolvers) section of the Sign-in Identities and Resolvers documentation.
## Backend Changes
This provider is not enabled by default in the auth backend code, because
+12 -2
View File
@@ -49,14 +49,24 @@ auth:
- resolver: emailMatchingUserEntityAnnotation
```
> Note: the resolvers will be tried in order, but will only be skipped if they throw a `NotFoundError`.
The Google provider is a structure with two configuration keys:
- `clientId`: The client ID that you generated, e.g.
`10023341500512-beui241gjwwkrdkr2eh7dprewj2pp1q.apps.googleusercontent.com`
- `clientSecret`: The client secret tied to the generated client ID.
### Resolvers
This provider includes several resolvers out of the box that you can use:
- `emailMatchingUserEntityProfileEmail`: Matches the email address from the auth provider with the User entity that has a matching `spec.profile.email`. If no match is found it will throw a `NotFoundError`.
- `emailLocalPartMatchingUserEntityName`: Matches the [local part](https://en.wikipedia.org/wiki/Email_address#Local-part) of the email address from the auth provider with the User entity that has a matching `name`. If no match is found it will throw a `NotFoundError`.
- `emailMatchingUserEntityAnnotation`: Matches the email address from the auth provider with the User entity where the value of the `google.com/email` annotation matches. If no match is found it will throw a `NotFoundError`.
> Note: The resolvers will be tried in order, but will only be skipped if they throw a `NotFoundError`.
If these resolvers do not fit your needs you can build a custom resolver, this is covered in the [Building Custom Resolvers](../identity-resolver.md#building-custom-resolvers) section of the Sign-in Identities and Resolvers documentation.
## Adding the provider to the Backstage frontend
To add the provider to the frontend, add the `googleAuthApi` reference and