Git Product home page Git Product logo

keycloak-attribute-sync-controller's Introduction

keycloak-attribute-sync-controller

Kubernetes Operator to sync Keycloak attributes to Openshift user objects.

Installation

The controller can be installed using kubectl.

kubectl apply -k config/default

Usage

User Attributes stored within Keycloak can be synchronized into OpenShift. The following table describes the set of configuration options for the sync:

Name Description Defaults Required
caSecret Reference to a secret containing a SSL certificate to use for communication. The CA must have the key ca.crt. No
credentialsSecret Reference to a secret containing authentication details (See below) Yes
loginRealm Realm to authenticate against master No
realm Realm to synchronize Yes
attribute The attribute to sync to the user object Yes
targetAnnotation The annotation to sync the attribute to No
targetLabel The label to sync the attribute to No

The following is an example of a minimal configuration that can be applied to integrate with a Keycloak provider:

apiVersion: v1
kind: Secret
metadata:
  name: keycloack-read-users-secrets
type: Opaque
data:
  username: ...
  password: ...
---
apiVersion: keycloak.appuio.io/v1alpha1
kind: AttributeSync
metadata:
  name: sync-special-attribute
spec:
  url: https://keycloak.example.com/
  realm: example
  loginRealm: master
  credentialsSecret:
    name: keycloack-read-users-secrets
    namespace: ...
  attribute: example.com/special-attribute
  targetAnnotation: example.com/special-attribute
  schedule: "@every 5m"

Authenticating to Keycloak

A user with permissions to query for Keycloak groups must be available. The following permissions must be associated to the user:

  • Password must be set (Temporary option unselected) on the Credentials tab
  • On the Role Mappings tab, select master-realm or realm-management next to the Client Roles dropdown and then select query-users and view-users.

A secret must be created in the same namespace that contains the AttributeSync resource. It must contain the following keys for the user previously created:

  • username - Username for authenticating with Keycloak
  • password - Password for authenticating with Keycloak

The secret can be created by executing the following command:

oc create secret generic keycloak-attribute-sync --from-literal=username=<username> --from-literal=password=<password>

Scheduled Execution

A cron style expression can be specified for which a synchronization event will occur. The following specifies that a synchronization should occur nightly at 3AM

apiVersion: keycloak.appuio.io/v1alpha1
kind: AttributeSync
metadata:
  name: sync-default-org
spec:
  schedule: "0 3 * * *"

If a schedule is not provided, synchronization will occur only when the object is reconciled by the platform.

Limitations

  • Only the first Keycloak attribute under the given key is used.
  • The key to look up the OCP user object is the Keycloak field Username. This is currently hardcoded.

keycloak-attribute-sync-controller's People

Contributors

bastjan avatar corvus-ch avatar glrf avatar renovate-bot avatar renovate[bot] avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

keycloak-attribute-sync-controller's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • Update module github.com/stretchr/testify to v1.9.0
  • Update goreleaser/goreleaser-action action to v6
  • Update paambaati/codeclimate-action action to v8
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

dockerfile
Dockerfile
  • docker.io/library/alpine 3.18
github-actions
.github/workflows/lint.yaml
  • actions/checkout v4
  • actions/setup-go v4
  • actions/cache v3
.github/workflows/release.yml
  • actions/checkout v4
  • actions/setup-go v4
  • actions/cache v3
  • docker/login-action v3
  • mikepenz/release-changelog-builder-action v4
  • goreleaser/goreleaser-action v5
.github/workflows/test.yml
  • actions/checkout v4
  • actions/setup-go v4
  • actions/cache v3
  • paambaati/codeclimate-action v5.0.0
gomod
go.mod
  • go 1.21
  • github.com/Nerzal/gocloak/v9 v9.0.4
  • github.com/onsi/ginkgo v1.16.5
  • github.com/onsi/gomega v1.16.0
  • github.com/openshift/api v3.9.0+incompatible
  • github.com/redhat-cop/operator-utils v1.1.4
  • github.com/robfig/cron v1.2.0
  • github.com/stretchr/testify v1.8.4
  • k8s.io/api v0.20.2
  • k8s.io/apiextensions-apiserver v0.20.1
  • k8s.io/apimachinery v0.20.2
  • k8s.io/client-go v0.20.2
  • sigs.k8s.io/controller-runtime v0.8.3

  • Check this box to trigger a request for Renovate to run again on this repository

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Cannot find preset's package (github>whitesource/merge-confidence:beta)

Dependency Dashboard

This issue provides visibility into Renovate updates and their statuses. Learn more

This repository currently has no open or pending branches.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.