[ 
https://issues.apache.org/jira/browse/CAMEL-26196?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen reassigned CAMEL-26196:
-----------------------------------

    Assignee: Claus Ibsen

> camel-keycloak - with pojoRequest a body of the wrong type does nothing and 
> no error, and a failed create or delete is not an error and its Response is 
> never closed
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-26196
>                 URL: https://issues.apache.org/jira/browse/CAMEL-26196
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-keycloak
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 4.24.0
>
>
> Found while adding the catalog body types of keycloak (CAMEL-24961, PR 
> #28416).
> h4. 1. pojoRequest=true with a body of the wrong type does nothing
> With {{pojoRequest=true}}, {{KeycloakProducer.createUser}} (main 
> 2a465aa4814c, line 514 to 520) calls Keycloak only when the body is a 
> {{UserRepresentation}}; for a String or a Map body (for example JSON) there 
> is no call, no error, and the body is unchanged. The other pojoRequest 
> operations use the same {{instanceof}} pattern. Checked on 4.24.0-SNAPSHOT 
> with Keycloak 26.8.1 from test-infra (docker).
> Proposed: convert the body to the expected representation (mandatory), and 
> fail with a clear error when it does not convert.
> h4. 2. A failed create or delete is not an error, and its Response is never 
> closed
> createUser (line 517 to 519), deleteUser (line 557 to 559) and the other 
> creates set the jakarta {{Response}} as the body without looking at its 
> status: a 409 (already exists) or a 404 (not found) completes the exchange as 
> a success. The Response is never closed. Checked on 4.24.0-SNAPSHOT with 
> Keycloak from test-infra.
> Proposed: fail the exchange on a non-2xx status, and read what is needed from 
> the Response (status, location, created id) and close it.
> h4. 3. bulkCreateUsers with a List of Map fails with a raw ClassCastException
> {{KeycloakProducer.bulkCreateUsers}} (line 2337 to 2339) casts a List body to 
> {{List<UserRepresentation>}}; a List of Map (from JSON unmarshalling) then 
> fails with a raw ClassCastException when the elements are used. Checked on 
> 4.24.0-SNAPSHOT with Keycloak from test-infra.
> Proposed: convert each element to UserRepresentation, or fail with an error 
> that names the expected element type.
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to