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

updateClient - RESTEASY003065: Cannot consume content type #88

Open
omar331 opened this issue Mar 25, 2022 · 1 comment
Open

updateClient - RESTEASY003065: Cannot consume content type #88

omar331 opened this issue Mar 25, 2022 · 1 comment

Comments

@omar331
Copy link

omar331 commented Mar 25, 2022

Hi,

I'm trying to update a Keycloak client like this

    $r = $keycloakAdminClient->updateClient( 
          ['id' => $client['id'],
           'realm' => 'evolutto',
           'body' => $client
           ]);

    var_dump($r);

But i get the response

array(1) {
  ["error"]=>
  string(43) "RESTEASY003065: Cannot consume content type"
}

The admin client is working file for getClient.

I also have

var_dump($client)

array(30) {
  ["id"]=>
  string(36) "18ad2816-4151-4381-958e-b0276b7294fb"
  ["clientId"]=>
  string(22) "plataforma-consultoria"
  ["rootUrl"]=>
  string(0) ""
  ["adminUrl"]=>
  string(0) ""
  ["baseUrl"]=>
  string(0) ""
  ["surrogateAuthRequired"]=>
  bool(false)
  ["enabled"]=>
  bool(true)
  ["alwaysDisplayInConsole"]=>
  bool(false)
  ["clientAuthenticatorType"]=>
  string(13) "client-secret"
  ["redirectUris"]=>
  array(3) {
    [0]=>
    string(1) "*"
    [1]=>
    string(36) "https://bb.evolutto.localhost:8090/*"
    [2]=>
    string(37) "https://bb.evolutto.localhostt:8090/*"
  }
  ["webOrigins"]=>
  array(1) {
    [0]=>
    string(1) "*"
  }
  ["notBefore"]=>
  int(0)
  ["bearerOnly"]=>
  bool(false)
  ["consentRequired"]=>
  bool(false)
  ["standardFlowEnabled"]=>
  bool(true)
  ["implicitFlowEnabled"]=>
  bool(false)
  ["directAccessGrantsEnabled"]=>
  bool(false)
  ["serviceAccountsEnabled"]=>
  bool(true)
  ["authorizationServicesEnabled"]=>
  bool(true)
  ["publicClient"]=>
  bool(false)
  ["frontchannelLogout"]=>
  bool(true)
  ["protocol"]=>
  string(14) "openid-connect"
  ["attributes"]=>
  array(22) {
    ["saml.assertion.signature"]=>
    string(5) "false"
    ["saml_assertion_consumer_url_redirect"]=>
    string(56) "https://prod.evoluttodev.localhost:8090/app_dev.php/saml"
    ["saml.force.post.binding"]=>
    string(4) "true"
    ["saml.multivalued.roles"]=>
    string(5) "false"
    ["saml.encrypt"]=>
    string(5) "false"
    ["backchannel.logout.revoke.offline.tokens"]=>
    string(5) "false"
    ["saml.server.signature"]=>
    string(4) "true"
    ["saml.server.signature.keyinfo.ext"]=>
    string(5) "false"
    ["exclude.session.state.from.auth.response"]=>
    string(5) "false"
    ["saml.signing.certificate"]=>
    string(908) "MIICozCCAYsCBgF4E2itWzANBgkqhkiG9w0BAQsFADAVMRMwEQYDVQQDDApwbGF0YWZvcm1hMB4XDTIxMDMwODE5NTM1MFoXDTMxMDMwODE5NTUzMFowFTETMBEGA1UEAwwKcGxhdGFmb3JtYTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKJLXmjhiKlRcku85vjJjpdzFV9khzOGR2tdZqj0J4H+tfdAHzYHkwvVIyFPcda7mmnMv9bvLNxQcj6OnuRCUQqc1kxjOqUC20u/zLaDAPLBd0gc3KRwdBiukIJMxrYk95V3vFxN5rirX3ksJHE7LqJ3HMnuLykZSvYA4lRtYGk2pQ4ut9oWr/TBqNiKavarzNhGhoB1t6HauNY6ZkVulDSHgq/29ixwdTuCGonIXd7HZJmYkehD1XzRc/PLIehFDP6IKD4ldn0+j8tKHPoo5fk5jSSxdQbk1/h1PbmEJNb5St4Q2VpawgKLfhb6rpKQynPcr6+cG3VWNb+rFgb2RuMCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAeTueI0Y97t7MJO9rqJIkzcM6pTpdnkgzrNTreG+Bn2VWsvRLELAprUE6x3KRfFVUMtfryJYKIdX8ePbg+G3GvVHNiBOvVL5+xhJUBAwqzCMAXfSS4zxg88kHeZrSZOd4yv6dPNZfbXLVdNPwvuEK0ZtWW+il03cCY+ghcIa4LhazBV1pa8Gx0fxIZ+zUZBnTqMr6aFx9EhQAgrVjVrxBv+bACC7sol5Cp6jeQPfmAtVjY3vHbmIj9tHO9oouGObIiznoGluqwmwcNEF8naKbAXZdP5CogtDGk9eOsTnGUSoVKeKct1+oS7B1A+/XLS1TIKKqT32ptnCWuTksrir3tQ=="
    ["backchannel.logout.session.required"]=>
    string(5) "false"
    ["client_credentials.use_refresh_token"]=>
    string(5) "false"
    ["saml.signature.algorithm"]=>
    string(10) "RSA_SHA256"
    ["saml_force_name_id_format"]=>
    string(5) "false"
    ["saml.client.signature"]=>
    string(4) "true"
    ["tls.client.certificate.bound.access.tokens"]=>
    string(5) "false"
    ["saml.authnstatement"]=>
    string(4) "true"
    ["display.on.consent.screen"]=>
    string(5) "false"
    ["saml.signing.private.key"]=>
    string(1592) "MIIEpQIBAAKCAQEAokteaOGIqVFyS7zm+MmOl3MVX2SHM4ZHa11mqPQngf6190AfNgeTC9UjIU9x1ruaacy/1u8s3FByPo6e5EJRCpzWTGM6pQLbS7/MtoMA8sF3SBzcpHB0GK6QgkzGtiT3lXe8XE3muKtfeSwkcTsuonccye4vKRlK9gDiVG1gaTalDi632hav9MGo2Ipq9qvM2EaGgHW3odq41jpmRW6UNIeCr/b2LHB1O4Iaichd3sdkmZiR6EPVfNFz88sh6EUM/ogoPiV2fT6Py0oc+ijl+TmNJLF1BuTX+HU9uYQk1vlK3hDZWlrCAot+FvqukpDKc9yvr5wbdVY1v6sWBvZG4wIDAQABAoIBAQCFUsEWC+DGp5/rVB2yV3IKPIJcQStISpE1RB9nwFsMUYCOw2BgdEx6NfeMD8WHD8rEC221VfpWasfPWD5zaX9F5p2tVv8AO56HVeMINAp9Yi1pUjx34eGdvRn90LCVRT0Wzqwwb9aP8kiWNIsjcejXkl5WDJM1gg+wk/1aOhgvlV5Y2kZbHEJBDOwSbf3efQzaMZmyYlq1Eyn8e9gJjuij9bR9LKicM0JkXV9TMC4AxDKSC/oMG8/ZDRhuWqUBha68j6FTCQeHCxyWFeEvxzND0JAAf0zULd6xR+v9Mp1IVuU1gaNI5oXPE4g8WV8CQCFfd7JPiWWk3RqburLKgH4xAoGBAPMimf73B9pdgjFiFca8an4TPiXEO2RS5uOHtyB6tcd3AnksjU62764dO/sjeAe6WgXXMkBZn89yLTLGO3UNh3jG+bN85y78K04M4ZwyCf+3KvDW4BUV3Iji9ev0J+f2LLWnNLUP8/u+1fCqewyTsWjNpSozvrejIWDDdsdBRvIvAoGBAKrhvDFJX4yACbODEzqit9zVdFEobrhr66so9WPpteOFrNzqrS0ePWMVkFmKjJ/SRO/ODm02Pu6wvS7MOJ01rndhqkEfMOVjmcSnJP60ldYRMglGL0UzrOAifC9A9/PTwpSajxGhIjkSPcISYjFezd2kibyM6urEVlQombEDsY2NAoGBAJWes3mtd02vwZC2NYRpKnePS+1dxtbEFYXrXIxGN1saJ5F+Ey9fcDuLjf/MIe9PhFqXxTrIbInyT1IxnyE3RCjU+ZC0ymelktijIKtIN9L/WxN+h8MyAtbSJFghlfUvDvByhwLtYE2JcIp7vuFMeh5ufrdrxG+pmb68Snnv98LNAoGBAIVFGCi4OLSzBt3h1BVe4lZwgw7oobFjOaF7iCYsF5ciofaJcBZIB0hHgRTUYWgj7W+5HLdAH0S4wlLFI0I4o6Cnosi3MsM0MrCUSt36qQES2BsziZpG+wSy4HdaDAc1mAOdpwbwzGgGOfQpsjse3R+HO4S5wlzmUw2/vF25q7fhAoGAbA8/hhH3GNhDkfBfVrQpLhWqgYP3A31fna69MatiRApGpiCxRFkxufK3CCClWmEyEAA1vMzGEQ/rd5P3JG7iXyBNbvVISFcpz+7aNueSvfWdUwmltjFO6gpQpNSXbrc4A0fbWLNoLnJp80uOE50Ua4a/HcG3Fj2q4f/77kp0jMk="
    ["saml_name_id_format"]=>
    string(8) "username"
    ["saml.onetimeuse.condition"]=>
    string(5) "false"
    ["saml_signature_canonicalization_method"]=>
    string(39) "http://www.w3.org/2001/10/xml-exc-c14n#"
  }
  ["authenticationFlowBindingOverrides"]=>
  array(0) {
  }
  ["fullScopeAllowed"]=>
  bool(true)
  ["nodeReRegistrationTimeout"]=>
  int(-1)
  ["protocolMappers"]=>
  array(3) {
    [0]=>
    array(6) {
      ["id"]=>
      string(36) "4880175a-48f3-4d71-b3b3-621916099607"
      ["name"]=>
      string(17) "Client IP Address"
      ["protocol"]=>
      string(14) "openid-connect"
      ["protocolMapper"]=>
      string(33) "oidc-usersessionmodel-note-mapper"
      ["consentRequired"]=>
      bool(false)
      ["config"]=>
      array(5) {
        ["user.session.note"]=>
        string(13) "clientAddress"
        ["id.token.claim"]=>
        string(4) "true"
        ["access.token.claim"]=>
        string(4) "true"
        ["claim.name"]=>
        string(13) "clientAddress"
        ["jsonType.label"]=>
        string(6) "String"
      }
    }
    [1]=>
    array(6) {
      ["id"]=>
      string(36) "caf58504-9d0d-431e-a8b7-ee290eb2dfa2"
      ["name"]=>
      string(9) "Client ID"
      ["protocol"]=>
      string(14) "openid-connect"
      ["protocolMapper"]=>
      string(33) "oidc-usersessionmodel-note-mapper"
      ["consentRequired"]=>
      bool(false)
      ["config"]=>
      array(5) {
        ["user.session.note"]=>
        string(8) "clientId"
        ["id.token.claim"]=>
        string(4) "true"
        ["access.token.claim"]=>
        string(4) "true"
        ["claim.name"]=>
        string(8) "clientId"
        ["jsonType.label"]=>
        string(6) "String"
      }
    }
    [2]=>
    array(6) {
      ["id"]=>
      string(36) "8afba569-6a49-4a33-af15-6d425052014b"
      ["name"]=>
      string(11) "Client Host"
      ["protocol"]=>
      string(14) "openid-connect"
      ["protocolMapper"]=>
      string(33) "oidc-usersessionmodel-note-mapper"
      ["consentRequired"]=>
      bool(false)
      ["config"]=>
      array(5) {
        ["user.session.note"]=>
        string(10) "clientHost"
        ["id.token.claim"]=>
        string(4) "true"
        ["access.token.claim"]=>
        string(4) "true"
        ["claim.name"]=>
        string(10) "clientHost"
        ["jsonType.label"]=>
        string(6) "String"
      }
    }
  }
  ["defaultClientScopes"]=>
  array(5) {
    [0]=>
    string(11) "web-origins"
    [1]=>
    string(9) "role_list"
    [2]=>
    string(5) "roles"
    [3]=>
    string(7) "profile"
    [4]=>
    string(5) "email"
  }
  ["optionalClientScopes"]=>
  array(4) {
    [0]=>
    string(7) "address"
    [1]=>
    string(5) "phone"
    [2]=>
    string(14) "offline_access"
    [3]=>
    string(16) "microprofile-jwt"
  }
  ["access"]=>
  array(3) {
    ["view"]=>
    bool(true)
    ["configure"]=>
    bool(true)
    ["manage"]=>
    bool(true)
  }
}

No clue of what is going on...

Some help? :)

@Eorana
Copy link

Eorana commented May 5, 2023

Here is a somewhat late answer, but I hope it will still be helpful:

In the file Resources/keycloak-1_0.php (for version 1.0), you can find the expected format for each method.

For updateClient, we have:

'updateClient' => array(
             'uri' => 'admin/realms/{realm}/customers/{id}',
             'description' => 'Update the client',
             'httpMethod' => 'PUT',
             'parameters' => array(
                 'real' => array(
                     'location' => 'uri',
                     'description' => 'The Realm name',
                     'type' => 'string',
                     'required' => true,
                 ),
                 'id' => array(
                     'location' => 'uri',
                     'description' => 'id of client (not client-id)',
                     'type' => 'string',
                     'required' => true,
                 ),
             ) + $ClientRepresentation
         ),

So you have to send:

$this->keycloakAdminClient->updateClient([
                 "realm" =>  'evolutto',
                 "id" => $client["id"],
                 // here the values to update
             ]);

For example, il you want to disable your client:

$this->keycloakAdminClient->updateClient([
                 "realm" =>  'evolutto',
                 "id" => $client["id"],
                 "enabled"   => false
             ]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants