mirror of
				https://github.com/optim-enterprises-bv/homelab.git
				synced 2025-10-30 17:37:59 +00:00 
			
		
		
		
	feat(netbird): configuring oidc-clients using new XOidcClient composition
This commit is contained in:
		| @@ -3,5 +3,5 @@ kind: Kustomization | |||||||
|  |  | ||||||
| resources: | resources: | ||||||
|   - cloudflare |   - cloudflare | ||||||
|   - netbird |   - netbird-dashboard | ||||||
|   - netbird-backend |   - netbird-backend | ||||||
|   | |||||||
| @@ -1,25 +1,27 @@ | |||||||
| apiVersion: openidclient.keycloak.crossplane.io/v1alpha1 | apiVersion: oidc.homelab.olav.ninja/v1alpha1 | ||||||
| kind: Client | kind: XOidcClient | ||||||
| metadata: | metadata: | ||||||
|   name: netbird-backend |   name: netbird-backend | ||||||
| spec: | spec: | ||||||
|   deletionPolicy: Delete |   clientId: netbird-backend | ||||||
|   forProvider: |   clientSecretSecretRef: | ||||||
|     name: Netbird Backend |     name: netbird-backend-oidc-credentials | ||||||
|     accessType: CONFIDENTIAL |     namespace: netbird | ||||||
|     clientId: netbird-backend |     key: clientSecret | ||||||
|     clientSecretSecretRef: |   description: Netbird Backend Client | ||||||
|       namespace: netbird |   displayName: Netbird Backend | ||||||
|       name: netbird-backend-oidc-credentials |   type: CONFIDENTIAL | ||||||
|       key: clientSecret |   grantTypes: | ||||||
|     description: Netbird Backend Client |     - client_credentials | ||||||
|     standardFlowEnabled: true |     - code | ||||||
|     directAccessGrantsEnabled: true |     - device_code | ||||||
|     serviceAccountsEnabled: true |     - password | ||||||
|     oauth2DeviceAuthorizationGrantEnabled: true |   redirectUris: | ||||||
|     validRedirectUris: |     - "/*" | ||||||
|       - "/*" |   webOrigins: | ||||||
|     webOrigins: |     - "+" | ||||||
|       - "+" |   serviceAccountRoles: | ||||||
|     realmIdRef: |     - realm: homelab | ||||||
|       name: homelab |       client: builtin-homelab-realm-management | ||||||
|  |       role: view-users | ||||||
|  |   realm: homelab | ||||||
|   | |||||||
| @@ -4,4 +4,3 @@ kind: Kustomization | |||||||
| resources: | resources: | ||||||
|   - client.yaml |   - client.yaml | ||||||
|   - credentials.yaml |   - credentials.yaml | ||||||
|   - sa-role-view-users.yaml |  | ||||||
|   | |||||||
| @@ -1,13 +0,0 @@ | |||||||
| apiVersion: openidclient.keycloak.crossplane.io/v1alpha1 |  | ||||||
| kind: ClientServiceAccountRole |  | ||||||
| metadata: |  | ||||||
|   name: netbird-backend-view-users |  | ||||||
| spec: |  | ||||||
|   forProvider: |  | ||||||
|     clientIdRef: |  | ||||||
|       name: builtin-homelab-realm-management |  | ||||||
|     realmIdRef: |  | ||||||
|       name: homelab |  | ||||||
|     role: view-users |  | ||||||
|     serviceAccountUserClientIdRef: |  | ||||||
|       name: netbird-backend |  | ||||||
| @@ -0,0 +1,30 @@ | |||||||
|  | apiVersion: oidc.homelab.olav.ninja/v1alpha1 | ||||||
|  | kind: XOidcClient | ||||||
|  | metadata: | ||||||
|  |   name: netbird | ||||||
|  | spec: | ||||||
|  |   displayName: Netbird | ||||||
|  |   type: PUBLIC | ||||||
|  |   clientId: netbird | ||||||
|  |   description: Netbird Client | ||||||
|  |   defaultScopes: | ||||||
|  |     - acr | ||||||
|  |     - basic | ||||||
|  |     - email | ||||||
|  |     - profile | ||||||
|  |     - roles | ||||||
|  |     - web-origins | ||||||
|  |     - netbird-api | ||||||
|  |   grantTypes: | ||||||
|  |     - code | ||||||
|  |     - device_code | ||||||
|  |     - password | ||||||
|  |   baseUrl: "https://netbird.stonegarden.dev" | ||||||
|  |   postLogoutRedirectUris: | ||||||
|  |     - "https://netbird.stonegarden.dev/*" | ||||||
|  |   redirectUris: | ||||||
|  |     - "http://localhost:53000" | ||||||
|  |     - "https://netbird.stonegarden.dev/*" | ||||||
|  |   webOrigins: | ||||||
|  |     - "+" | ||||||
|  |   realm: homelab | ||||||
| @@ -0,0 +1,11 @@ | |||||||
|  | apiVersion: openidclient.keycloak.crossplane.io/v1alpha1 | ||||||
|  | kind: ClientScope | ||||||
|  | metadata: | ||||||
|  |   name: netbird-api | ||||||
|  | spec: | ||||||
|  |   forProvider: | ||||||
|  |     name: netbird-api | ||||||
|  |     consentScreenText: Netbird Management API | ||||||
|  |     includeInTokenScope: true | ||||||
|  |     realmIdRef: | ||||||
|  |       name: homelab | ||||||
| @@ -1,43 +0,0 @@ | |||||||
| apiVersion: openidclient.keycloak.crossplane.io/v1alpha1 |  | ||||||
| kind: Client |  | ||||||
| metadata: |  | ||||||
|   name: netbird |  | ||||||
| spec: |  | ||||||
|   forProvider: |  | ||||||
|     name: Netbird |  | ||||||
|     accessType: PUBLIC |  | ||||||
|     clientId: netbird |  | ||||||
|     description: Netbird Client |  | ||||||
|     standardFlowEnabled: true |  | ||||||
|     directAccessGrantsEnabled: true |  | ||||||
|     oauth2DeviceAuthorizationGrantEnabled: true |  | ||||||
|     baseUrl: "https://netbird.stonegarden.dev" |  | ||||||
|     validRedirectUris: |  | ||||||
|       - "http://localhost:53000" |  | ||||||
|       - "https://netbird.stonegarden.dev/*" |  | ||||||
|     validPostLogoutRedirectUris: |  | ||||||
|       - "https://netbird.stonegarden.dev/*" |  | ||||||
|     webOrigins: |  | ||||||
|       - "+" |  | ||||||
|     realmIdRef: |  | ||||||
|       name: homelab |  | ||||||
| --- |  | ||||||
| apiVersion: client.keycloak.crossplane.io/v1alpha1 |  | ||||||
| kind: ProtocolMapper |  | ||||||
| metadata: |  | ||||||
|   name: netbird-sub-mapper |  | ||||||
| spec: |  | ||||||
|   forProvider: |  | ||||||
|     name: Username as sub claim |  | ||||||
|     protocol: openid-connect |  | ||||||
|     protocolMapper: oidc-usermodel-property-mapper |  | ||||||
|     config: |  | ||||||
|       user.attribute: username |  | ||||||
|       claim.name: sub |  | ||||||
|       id.token.claim: "true" |  | ||||||
|       access.token.claim: "true" |  | ||||||
|       userinfo.token.claim: "true" |  | ||||||
|     clientIdRef: |  | ||||||
|       name: netbird |  | ||||||
|     realmIdRef: |  | ||||||
|       name: homelab |  | ||||||
| @@ -1,50 +0,0 @@ | |||||||
| apiVersion: openidclient.keycloak.crossplane.io/v1alpha1 |  | ||||||
| kind: ClientDefaultScopes |  | ||||||
| metadata: |  | ||||||
|   name: netbird-default-scopes |  | ||||||
| spec: |  | ||||||
|   forProvider: |  | ||||||
|     defaultScopes: |  | ||||||
|       - acr |  | ||||||
|       - basic |  | ||||||
|       - email |  | ||||||
|       - profile |  | ||||||
|       - roles |  | ||||||
|       - web-origins |  | ||||||
|       - netbird-api |  | ||||||
|     clientIdRef: |  | ||||||
|       name: netbird |  | ||||||
|     realmIdRef: |  | ||||||
|       name: homelab |  | ||||||
| --- |  | ||||||
| apiVersion: openidclient.keycloak.crossplane.io/v1alpha1 |  | ||||||
| kind: ClientScope |  | ||||||
| metadata: |  | ||||||
|   name: netbird-api |  | ||||||
| spec: |  | ||||||
|   forProvider: |  | ||||||
|     name: netbird-api |  | ||||||
|     consentScreenText: Netbird Management API |  | ||||||
|     includeInTokenScope: true |  | ||||||
|     realmIdRef: |  | ||||||
|       name: homelab |  | ||||||
| --- |  | ||||||
| apiVersion: client.keycloak.crossplane.io/v1alpha1 |  | ||||||
| kind: ProtocolMapper |  | ||||||
| metadata: |  | ||||||
|   name: netbird-api-audience-mapper |  | ||||||
| spec: |  | ||||||
|   forProvider: |  | ||||||
|     name: Audience for NetBird Management API |  | ||||||
|     protocol: openid-connect |  | ||||||
|     protocolMapper: oidc-audience-mapper |  | ||||||
|     config: |  | ||||||
|       included.client.audience: "netbird" |  | ||||||
|       id.token.claim: "false" |  | ||||||
|       access.token.claim: "true" |  | ||||||
|       introspection.token.claim: "true" |  | ||||||
|       userinfo.token.claim: "false" |  | ||||||
|     clientScopeIdRef: |  | ||||||
|       name: netbird-api |  | ||||||
|     realmIdRef: |  | ||||||
|       name: homelab |  | ||||||
		Reference in New Issue
	
	Block a user
	 Vegard Hagen
					Vegard Hagen