Open dmitry-mightydevops opened 2 weeks ago
these are logs
https://example.twingate.com:443][total available: 0; route allocated: 0 of 2; total allocated: 0 of 20] 2024-11-09 00:48:36,389 DEBUG [de.captaingoldfish.scim.sdk.keycloak.scim_client.fullsynchronize.push.AbstractPushRealmSynchronizer] (ForkJoinPool.commonPool-worker-1) Successfully updated USERS 'test-user' 2024-11-09 00:48:36,390 TRACE [org.keycloak.models.cache.infinispan.UserCacheSession] (executor-thread-1) getuserById bca594cc-1004-4010-a58d-7fd011d39247 2024-11-09 00:48:36,391 TRACE [org.keycloak.models.cache.infinispan.UserCacheSession] (executor-thread-1) not cached 2024-11-09 00:48:36,409 TRACE [org.keycloak.connections.jpa.DefaultJpaConnectionProvider] (executor-thread-1) DefaultJpaConnectionProvider close() 2024-11-09 00:48:38,159 TRACE [org.keycloak.models.cache.infinispan.RealmCacheSession] (executor-thread-1) realm by name cache hit: master 2024-11-09 00:48:38,159 TRACE [org.keycloak.models.cache.infinispan.RealmCacheSession] (executor-thread-1) by id cache hit: master 2024-11-09 00:48:38,161 TRACE [org.keycloak.services.cors.DefaultCors] (executor-thread-1) No Origin header, ignoring 2024-11-09 00:48:38,162 TRACE [org.keycloak.keys.DefaultKeyManager] (executor-thread-1) Active key found: realm=master kid=W-dZ0i9GBGSsBObf0fVZ0kgY3A9hduwV7u7b3TuLpcY algorithm=RS256 use=SIG 2024-11-09 00:48:48,159 TRACE [org.keycloak.models.cache.infinispan.RealmCacheSession] (executor-thread-1) realm by name cache hit: master 2024-11-09 00:48:48,159 TRACE [org.keycloak.models.cache.infinispan.RealmCacheSession] (executor-thread-1) by id cache hit: master 2024-11-09 00:48:48,160 TRACE [org.keycloak.services.cors.DefaultCors] (executor-thread-1) No Origin header, ignoring 2024-11-09 00:48:48,160 TRACE [org.keycloak.keys.DefaultKeyManager] (executor-thread-1) Active key found: realm=master kid=W-dZ0i9GBGSsBObf0fVZ0kgY3A9hduwV7u7b3TuLpcY algorithm=RS256 use=SIG ```
as you can see
PUT /api/scim/v2/Users/VXNlcjo1ODEwMTYx HTTP/1.1
Host: example.twingate.com
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User"
],
"locale": "en_us",
"emails": [
{
"primary": true,
"value": "test@example.com"
}
],
"name": {
"givenName": "test",
"familyName": "user"
},
"timezone": "America/Chicago",
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
"division": "executive",
"organization": "example, LLC",
"department": "management"
},
"title": "CTO",
"externalId": "VXNlcjo1ODEwMTYx",
"userName": "test-user",
"active": true
}
so it sends wrong externalId (it should have been bca594cc-1004-4010-a58d-1fd011d39241
)
payload in keycloak logs:
PUT /api/scim/v2/Users/VXNlcjo6ODQwMTYx HTTP/1.1
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User"
],
"locale": "en_us",
"emails": [
{
"primary": true,
"value": "test@example.com"
}
],
"name": {
"givenName": "test",
"familyName": "user"
},
"timezone": "America/Chicago",
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
"division": "executive",
"organization": "example, LLC",
"department": "management"
},
"title": "CTO",
"externalId": "VXNlcjo6ODQwMTYx",
"userName": "test-user",
"active": true
}
this overrides externalId on twingate side and makes it impossible to login
payload in keycloak logs:
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User"
],
"locale": "en_us",
"emails": [
{
"primary": true,
"value": "test@example.com"
}
],
"name": {
"givenName": "test",
"familyName": "user"
},
"timezone": "America/Chicago",
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
"division": "executive",
"organization": "example, LLC",
"department": "management"
},
"title": "CTO",
"externalId": "VXNlcjo6ODQwMTYx",
"id": "bca594cc-1004-4010-a58d-7fd011d39247",
"userName": "test-user",
"active": true
}
this overrides externalId on twingate side and makes it impossible to login. It would be nice to not include externalId here in the payload.
payload in keycloak logs:
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User"
],
"locale": "en_us",
"emails": [
{
"primary": true,
"value": "test@example.com"
}
],
"name": {
"givenName": "test",
"familyName": "user"
},
"timezone": "America/Chicago",
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
"division": "executive",
"organization": "example, LLC",
"department": "management"
},
"title": "CTO",
"externalId": "VXNlcjo6ODQwMTYx",
"id": "VXNlcjo6ODQwMTYx",
"userName": "test-user",
"active": true
}
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User"
],
"locale": "en_us",
"emails": [
{
"primary": true,
"value": "test@exampl.com"
}
],
"name": {
"givenName": "test",
"familyName": "user"
},
"timezone": "America/Chicago",
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
"division": "executive",
"organization": "exampl, LLC",
"department": "management"
},
"title": "CTO",
"externalId": "VXNlcjo6ODQwMTYx",
"userName": "test-user",
"active": true,
"id": "VXNlcjo6ODQwMTYx"
}
So either this is a bug or I did something wrong or we need a new setting like send externalId as externalId field and if not set - don't include it in the PUT /Users payload.
Hi Dmitry,
thanks for reporting this so thoroughly. I know where the problem is but I need to fix it. You haven't done anything wrong here. I need to prevent the synchronization of the externalId
-attribute. This will require some time. I will try to to fix this until the end of next week.
@Captain-P-Goldfish thank you! Pls also check this one I found: https://github.com/Captain-P-Goldfish/scim-for-keycloak/issues/127 as it could be related.
In the meantime I will go and buy an enterprise license. Thanks for your work!
I'm using latest version of this plugin https://scim-for-keycloak.de/ (
production build kc-26-2.3.3
) and keycloak 26.0.5 I'm getting externalId in remote SCIM provider incorrectly updated (to wrong value)i.e. in remote SCIM after user sync changes the following correct data
would become
which then breaks the authentication via keycloak iDP on the twingate side and I have to manually patch the externalId to make it replaced with bca594cc-1004-4010-a58d-1fd011d39241
see it in action:
keycloak SCIM endpoint data
twingate (remote SCIM) provider
perfom the sync
query twingate (remote SCIM) provider
fix by manually patching via CURL
now I can login, but this manual op bothers me.
Am I doing something wrong in my setup?
I tried to change these 2 (all possible combinations) but it had no effect and I still get externalId incorrectly set on each sync.