Skip to content

OIDC login fails with "malformed server configuration" #122

Closed
opencloud-eu/opencloud
#1707

Description

@schweigisito

Trying login to latest server, deployed via "docker compose" using keycloak as IDP (according to https://docs.opencloud.eu/docs/admin/configuration/authentication-and-user-management/keycloak), fails with "Malformed server configuration" error.

Client version: OpenCloud release version 1.0.0 (98dd03e06)

Steps to reproduce:

Login via web and iOS client to the same instance (demo.opencloud.eu) works fine.

Server logs from another test instance contain:

opencloud-1      | {"level":"info","service":"storage-system","host.name":"3f524f9bb0c7","pkg":"rgrpc","traceid":"6de567771c18b659bc350c4447c22473","time":"2025-10-06T13:42:26Z","line":"github.com/opencloud-eu/reva/[email protected]/internal/grpc/services/authprovider/authprovider.go:146","message":"user idp:\"internal\" opaque_id:\"90245829-6f2e-4235-9a3e-83d66d576676\" type:USER_TYPE_PRIMARY authenticated"}
opencloud-1      | {"level":"info","service":"proxy","proto":"HTTP/1.1","request-id":"aefaf177-5be7-42a7-aad6-9c910e5bd3d6","traceid":"e4c67ee036d2f2161485111fb3e54d3a","remote-addr":"80.139.15.167","method":"GET","status":200,"path":"/.well-known/webfinger","duration":4.008038,"bytes":162,"time":"2025-10-06T13:43:21Z","line":"github.com/opencloud-eu/opencloud/services/proxy/pkg/middleware/accesslog.go:34","message":"access-log"}
keycloak-1       | 2025-10-06 13:43:22,217 WARN  [org.keycloak.services] (executor-thread-12) KC-SERVICES0101: Failed to verify remote host : 80.139.15.167
keycloak-1       | 2025-10-06 13:43:22,218 WARN  [org.keycloak.services] (executor-thread-12) KC-SERVICES0099: Operation 'before register client' rejected. Policy 'Block Client Registration' rejected request to client-registration service. Details: Host not trusted.
keycloak-1       | 2025-10-06 13:43:22,221 WARN  [org.keycloak.events] (executor-thread-12) type="CLIENT_REGISTER_ERROR", realmId="openCloud", realmName="openCloud", clientId="null", userId="null", ipAddress="80.139.15.167", error="not_allowed", client_registration_policy="Block Client Registration"
opencloud-1      | {"level":"info","service":"storage-system","host.name":"3f524f9bb0c7","pkg":"rgrpc","traceid":"b9e7eedaff68e1860dd92a2a51240f5b","time":"2025-10-06T13:43:26Z","line":"github.com/opencloud-eu/reva/[email protected]/internal/grpc/services/authprovider/authprovider.go:146","message":"user idp:\"internal\" opaque_id:\"90245829-6f2e-4235-9a3e-83d66d576676\" type:USER_TYPE_PRIMARY authenticated"}
ldap-server-1    | 68e3c78b.145516ad 0x7783b49fe6c0 conn=1083 fd=16 ACCEPT from IP=172.18.0.9:44898 (IP=0.0.0.0:1389)
ldap-server-1    | 68e3c78b.145d6b61 0x7783aeafd6c0 conn=1083 op=0 BIND dn="cn=admin,dc=opencloud,dc=eu" method=128
ldap-server-1    | 68e3c78b.145e6a95 0x7783aeafd6c0 conn=1083 op=0 BIND dn="cn=admin,dc=opencloud,dc=eu" mech=SIMPLE bind_ssf=0 ssf=0
ldap-server-1    | 68e3c78b.145fa564 0x7783aeafd6c0 conn=1083 op=0 RESULT tag=97 err=0 qtime=0.000019 etime=0.000216 text=
ldap-server-1    | 68e3c78b.146c422b 0x7783acdfa6c0 conn=1083 op=1 SRCH base="ou=users,dc=opencloud,dc=eu" scope=1 deref=3 filter="(&(entryUUID=2b609528-3703-1040-931f-7735e1834eea)(objectClass=inetOrgPerson))"
ldap-server-1    | 68e3c78b.146d2617 0x7783acdfa6c0 conn=1083 op=1 SRCH attr=entryUUID uid mail sn cn pwdChangedTime objectclass krb5PrincipalName createTimestamp modifyTimestamp
ldap-server-1    | 68e3c78b.1470e780 0x7783acdfa6c0 conn=1083 op=1 SEARCH RESULT tag=101 err=0 qtime=0.000027 etime=0.000397 nentries=1 text=
ldap-server-1    | 68e3c78b.147e126a 0x7783b49fe6c0 conn=1083 op=2 UNBIND
ldap-server-1    | 68e3c78b.14807083 0x7783b49fe6c0 conn=1083 fd=16 closed
ldap-server-1    | 68e3c78b.14eb5652 0x7783aeafd6c0 conn=1084 fd=16 ACCEPT from IP=172.18.0.9:44904 (IP=0.0.0.0:1389)
ldap-server-1    | 68e3c78b.14f141d9 0x7783acdfa6c0 conn=1084 op=0 BIND dn="uid=albert_einstein,ou=users,dc=opencloud,dc=eu" method=128
ldap-server-1    | 68e3c78b.14f35094 0x7783acdfa6c0 conn=1084 op=0 BIND dn="uid=albert_einstein,ou=users,dc=opencloud,dc=eu" mech=SIMPLE bind_ssf=0 ssf=0
ldap-server-1    | 68e3c78b.14f4e9aa 0x7783acdfa6c0 conn=1084 op=0 RESULT tag=97 err=0 qtime=0.000018 etime=0.000300 text=
ldap-server-1    | 68e3c78b.14fbbd63 0x7783b49fe6c0 conn=1084 op=1 UNBIND
ldap-server-1    | 68e3c78b.14feee9e 0x7783b49fe6c0 conn=1084 fd=16 closed
opencloud-1      | {"level":"info","service":"proxy","proto":"HTTP/1.1","request-id":"35b6f291-96b8-4b5f-9615-333b7e7f75b9","traceid":"e7310ca211b8f1fe170b5319577954a2","remote-addr":"80.139.15.167","method":"GET","status":200,"path":"/.well-known/webfinger","duration":57.817902,"bytes":190,"time":"2025-10-06T13:43:40Z","line":"github.com/opencloud-eu/opencloud/services/proxy/pkg/middleware/accesslog.go:34","message":"access-log"}
opencloud-1      | {"level":"error","service":"proxy","error":"claim path 'uuid' not set or empty","time":"2025-10-06T13:43:40Z","line":"github.com/opencloud-eu/opencloud/services/proxy/pkg/middleware/account_resolver.go:120","message":"could not read user id claim"}
opencloud-1      | {"level":"info","service":"proxy","proto":"HTTP/1.1","request-id":"92147612-1998-465d-a429-7e77b791af12","traceid":"34989866ccd37dedf80476269bd97ef3","remote-addr":"80.139.15.167","method":"PROPFIND","status":500,"path":"/remote.php/dav/files/","duration":26.84778,"bytes":0,"time":"2025-10-06T13:43:40Z","line":"github.com/opencloud-eu/opencloud/services/proxy/pkg/middleware/accesslog.go:34","message":"access-log"}

According to the logs it looks like the client is trying to do DCR and fails. It should fall back to the public client id then.

Activity

  1. added theissue type on Oct 22, 2025
  2. schweigisito commented on Oct 22, 2025

    @schweigisito
    MemberAuthor

    The issue does not happen if the built-in IDP is used.

  3. schweigisito commented on Oct 22, 2025

    @schweigisito
    MemberAuthor

    Meanwhile I have setup an OC instance using an external Keycloak with autoprovisioning with latest compose stack. All clients (web, android and ios) work correctly.

  4. zerox80 commented on Oct 23, 2025

    @zerox80
    SponsorContributor

    opencloud-eu/android@49a2374

    Should fix it, can u try it out? Try to build it wiht Android Studio please.

  5. zerox80 commented on Oct 24, 2025

    @zerox80
    SponsorContributor

    Das problem liegt am backend von opencloud
    die android app ruft nach der keycloak anmeldung /ocs/v2.php/cloud/user auf, bekommt dort vom demo backend einen http 500 und wandelt das per RemoteOperationResult.ResultCode.INSTANCE_NOT_CONFIGURED in die Meldung "malformed server configuration" um

    Auf Android seite läuft der flow korrekt : Login -> Token -> UserInfo

    Das problem liegt wahrscheinlich im Backend / Proxy (z.b falscher OIDC claim oder fehlende Machine Auth Konfiguration) nicht im code der App

    Dass es bei weboberfläche klappt: Die Weboberfläche geht zwar auch über denselben Proxy, ruft aber in ihrem normalen Startpfad keine OCS-User-Info ab. Sie lebt mit den Session claims im Browser und spricht vor allem WebDAV/Graph/Spaces, deshalb merkt man dort von der fehlerhaften OCS konfiguration nichts

  6. schweigisito commented on Oct 24, 2025

    @schweigisito
    MemberAuthor

    The problem is that the generated token for the OpenCloudAndroid client doesn't get a uuid attribute, while the OpenCloudIOS client gets one:

    iOS

    $ curl -ks -X POST https://keycloak.holzburg.org/realms/openCloud/protocol/openid-connect/token -H 'Content-Type: application/x-www-form-urlencoded' -d 'username=testbert'   -d 'password=secret' -d 'grant_type=password' -d 'client_id=OpenCloudIOS'|jq -r .access_token|jwt decode -
    
    Token header
    ------------
    {
      "typ": "JWT",
      "alg": "RS256",
      "kid": "-tKRAYO1mxucHqrC7hiP67tK8O7yjLI7fS06ymPfqgU"
    }
    
    Token claims
    ------------
    {
      "aud": "account",
      "azp": "OpenCloudIOS",
      "email": "[email protected]",
      "email_verified": false,
      "exp": 1761306942,
      "family_name": "Bert",
      "given_name": "Test",
      "iat": 1761306642,
      "iss": "https://keycloak.holzburg.org/realms/openCloud",
      "jti": "onrtro:cb7b8159-7ca5-189a-227f-0c61d0df8f26",
      "name": "Test Bert",
      "preferred_username": "testbert",
      "resource_access": {
        "account": {
          "roles": [
            "manage-account",
            "manage-account-links",
            "view-profile"
          ]
        }
      },
      "roles": [
        "opencloudGuest",
        "default-roles-opencloud",
        "offline_access",
        "uma_authorization",
        "opencloudUser"
      ],
      "scope": "email profile",
      "sid": "acfa28ac-6f03-4117-8553-6185ecad6a43",
      "sub": "46231351-308d-4913-9989-739262db8d3e",
      "typ": "Bearer",
      "uuid": "ee9abd3a-4508-1040-9a07-995bd8fd4d0b"
    }
    

    Android

    $ curl -ks -X POST https://keycloak.holzburg.org/realms/openCloud/protocol/openid-connect/token -H 'Content-Type: application/x-www-form-urlencoded' -d 'username=testbert'   -d 'password=secret' -d 'grant_type=password' -d 'client_id=OpenCloudAndroid'|jq -r .access_token|jwt decode -
    
    Token header
    ------------
    {
      "typ": "JWT",
      "alg": "RS256",
      "kid": "-tKRAYO1mxucHqrC7hiP67tK8O7yjLI7fS06ymPfqgU"
    }
    
    Token claims
    ------------
    {
      "aud": "account",
      "azp": "OpenCloudAndroid",
      "email": "[email protected]",
      "email_verified": false,
      "exp": 1761307032,
      "family_name": "Bert",
      "given_name": "Test",
      "iat": 1761306732,
      "iss": "https://keycloak.holzburg.org/realms/openCloud",
      "jti": "onrtro:fead0890-8344-eda3-dbd8-8bca65be5c4b",
      "name": "Test Bert",
      "preferred_username": "testbert",
      "resource_access": {
        "account": {
          "roles": [
            "manage-account",
            "manage-account-links",
            "view-profile"
          ]
        }
      },
      "roles": [
        "opencloudGuest",
        "default-roles-opencloud",
        "offline_access",
        "uma_authorization",
        "opencloudUser"
      ],
      "scope": "email profile",
      "sid": "bafac66a-937c-4ec2-bf69-218eecc5c218",
      "sub": "46231351-308d-4913-9989-739262db8d3e",
      "typ": "Bearer"
    }
    

    And finally the server throws:

    opencloud-1  | {"level":"error","service":"proxy","error":"claim path 'uuid' not set or empty","time":"2025-10-24T11:57:48Z","line":"github.com/opencloud-eu/opencloud/services/proxy/pkg/middleware/account_resolver.go:120","message":"could not read user id claim"}
    
  7. schweigisito commented on Oct 24, 2025

    @schweigisito
    MemberAuthor
  8. self-assigned this
    on Oct 24, 2025
  9. moved this from Qualification to In Progress in OpenCloud Team Boardon Oct 24, 2025
  10. added theissue type on Oct 24, 2025
  11. added 3 commits that reference this issue on Oct 24, 2025
    7783a93
    54dbbe3
    b185779
  12. zerox80 commented on Oct 24, 2025

    @zerox80
    SponsorContributor

    damn well done!! so it's a backend issue as i assumed, glad u found a fix.

  13. added a commit that references this issue on Oct 27, 2025
    3558f9c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Priority:p2-high

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions