Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add guides for common OIDC providers #3917

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ You may decide to give your engineering teams access to the WGE dashboard so the

OIDC extends the OAuth2 authorization protocol by including an additional field (ID Token) that contains information (claims) about a user's identity. After a user successfully authenticates with the OIDC provider, Weave GitOps Enterprise uses this information to impersonate the user in any calls to the Kubernetes API. This allows cluster administrators to use RBAC rules to control access to the cluster and the dashboard.

For more specific examples of how to setup OIDC with Weave GitOps, see [this guide](../../../guides/oidc/).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯


<Tabs groupId="infrastructure" default>
<TabItem value="Login via an OIDC provider" label="Login via an OIDC provider">

Expand Down
75 changes: 75 additions & 0 deletions website/docs/guides/oidc.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
title: Common OIDC provider configurations
makkes marked this conversation as resolved.
Show resolved Hide resolved
---

This page provides guides for configuring Weave GitOps with the most common OIDC providers.

## Google

Google's identity provider does not support the groups scope which Weave GitOps requests by default. That's why in
this example the `customScopes` field is set to only request the `openid` and `email` scopes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻


1. Obtain the client ID and secret by following the [official guide](https://developers.google.com/identity/openid-connect/openid-connect)
from Google.
1. Configure Weave GitOps:

```yaml
apiVersion: v1
kind: Secret
metadata:
name: oidc-auth
namespace: WEAVE_GITOPS_NAMESPACE
stringData:
clientID: CLIENT_ID_FROM_STEP_1
clientSecret: CLIENT_SECRET_FROM_STEP_1
issuerURL: https://accounts.google.com
redirectURL: BASE_WEAVE_GITOPS_URL/oauth2/callback
customScopes: openid,email
```
makkes marked this conversation as resolved.
Show resolved Hide resolved

## Azure AD

1. Obtain the client ID and secret by following the [official guide](https://learn.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app)
from Microsoft.
1. [optional] Configure group claims by following this [official guide](https://learn.microsoft.com/en-us/security/zero-trust/develop/configure-tokens-group-claims-app-roles).
1. Configure Weave GitOps:

```yaml
apiVersion: v1
kind: Secret
metadata:
name: oidc-auth
namespace: WEAVE_GITOPS_NAMESPACE
stringData:
clientID: CLIENT_ID_FROM_STEP_1
clientSecret: CLIENT_SECRET_FROM_STEP_1
issuerURL: https://login.microsoftonline.com/TENANT_ID/v2.0
redirectURL: BASE_WEAVE_GITOPS_URL/oauth2/callback
customScopes: openid
claimUsername: sub
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we want to talk about the groups on Azure?

And recommend that users use roles https://learn.microsoft.com/en-us/security/zero-trust/develop/configure-tokens-group-claims-app-roles ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻 I will need to set this up one more time to see what specifically is necessary for getting the groups.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this once more and added a step to configure group claims.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this get pushed?

       customScopes: openid

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The funny thing is you don't need to request any other scope if the groups claim is configured. The claim will be pushed nonetheless. 🤷🏻‍♂️ Microsoft doing Microsoft things.


## Keycloak

Keycloak is highly customizable so the steps to obtain client ID and secret will vary depending on your setup. The
general steps are very similar and the following steps point to the appropriate pages in the official Keycloak
documentation:

1. Log in to the Keycloak admin console and [create a realm](https://www.keycloak.org/docs/latest/server_admin/#configuring-realms).
1. [Create a client application](https://www.keycloak.org/docs/latest/authorization_services/index.html#_resource_server_create_client)
and choose "OpenID Connect" as the client type.
1. Make sure to set the "Client Authenticator" on the "Credentials" tab to "Client Id and Secret" and generate a secret.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to say anything about scopes for the client?

Do we need to say anything about groups for this? (realm roles?!)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I basically stopped iterating on this part of the page as soon as #4113 arrived because that PR provides all the nitty-gritty details of using WeGO with Keycloak. So I suppose this part will be overridden soon, anyway.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, maybe we can remove this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And link to the other doc?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will as soon as the other doc is merged.

1. Configure Weave GitOps:

```yaml
apiVersion: v1
kind: Secret
metadata:
name: oidc-auth
namespace: WEAVE_GITOPS_NAMESPACE
stringData:
clientID: CLIENT_ID_FROM_STEP_2
clientSecret: CLIENT_SECRET_FROM_STEP_3
issuerURL: https://KEYCLOAK_DOMAIN/realms/KEYCLOAK_REALM
redirectURL: BASE_WEAVE_GITOPS_URL/oauth2/callback
```
1 change: 1 addition & 0 deletions website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
type: 'category',
label: 'Guides',
items: [
'guides/oidc',
'guides/displaying-custom-metadata',
'guides/fluxga-upgrade',
],
Expand Down
Loading