open-zaak / open-zaak

Open Zaak is a modern, open-source data- and services-layer to enable zaakgericht werken, a Dutch approach to case management.
Other
39 stars 36 forks source link

Adding external zaaktypes leads to 401 error #1564

Open joeribekker opened 9 months ago

joeribekker commented 9 months ago

General information Open Zaak version: 1.11

Describe the bug Bas Retera reported that he cannot add external zaaktypes in the admin for authorisations. He gets a 401 but says it's not protected (he showed me the page in a browser and said he tested it from the Open Zaak server as well with curl).

image

annashamray commented 9 months ago

@joeribekker I can't reproduce error either locally or on test.openzaak.nl. I've successfully added external zaaktype which was public.

image

annashamray commented 9 months ago

Are there any details of the error message or maybe logs, or the url of the external zaaktype?

annashamray commented 9 months ago

I've also tried to add external zaaktype, which required authentication (I used test.openzaak.nl):

basretera commented 9 months ago

Based on Anna's test above, I took another deep dive into our code. And I found that it went wrong because in our code we expected the payload to include an expiration date (exp). We will remove this validation from our code. But I would still recommend sending an expiration date along with it in your solution. After all, that is something that is strongly recommended.

basretera commented 9 months ago

Now we are accepting the payload without the expiration date, we get another fault message "De URL https://catalogi-api.nb.djuma.local/DevId/api/v1/zaaktypen/415738d9-114d-463c-bf74-007df4aebb2e resource lijkt niet op een ZaakType. Geef een geldige URL op." We have no clue why it isn't accepted as a zaaktype. We give all of the required fields back in the response and more. Please, can you tell me what is wrong?

basretera commented 8 months ago

Can someone let me know what is wrong please?

annashamray commented 8 months ago

Hi! This error means that the zaaktype was successfully requested via this url (so credentials are good), BUT the result doesn't have the same shape as expected from Catalogi API OAS. It can be that some required properties are missing, or some values are in the wrong format. Or it's not even JSON. If you provide the content of the link, we can help you to identify what is wrong

basretera commented 8 months ago

The link is not accessible from outside our network. It is an internal endpoint. But below the response body of a zaaktype. I don't see what is wrong with it so it is appreciated if you can have a look into it!

{
    "url": "https://catalogi-api.nb.djuma.local/DevId/api/v1/zaaktypen/2dcd950e-adf9-45c6-9c4a-b93c377cdcf3",
    "identificatie": "1",
    "omschrijving": "Standaard voor Nieuwe zaak",
    "omschrijvingGeneriek": null,
    "vertrouwelijkheidaanduiding": "openbaar",
    "doel": "Doel",
    "aanleiding": "Aanleiding",
    "toelichting": null,
    "indicatieInternOfExtern": "extern",
    "handelingInitiator": "Handeling initiator",
    "onderwerp": "Standaard voor nieuwe zaak",
    "handelingBehandelaar": "Hand. behandelaar",
    "doorlooptijd": "20",
    "servicenorm": "15",
    "opschortingEnAanhoudingMogelijk": true,
    "verlengingMogelijk": true,
    "verlengingstermijn": "3",
    "trefwoorden": [
        "Administratie",
        "GBA"
    ],
    "publicatieIndicatie": false,
    "publicatietekst": "Test 2",
    "verantwoordingsrelatie": [],
    "productenOfDiensten": [
        "http://www.circlesoftware.nl"
    ],
    "selectielijstProcestype": null,
    "referentieproces": {
        "naam": "ReferentieProces 2",
        "link": "http://www.circlesoftware.nl"
    },
    "catalogus": "https://catalogi-api.nb.djuma.local/DevId/api/v1/catalogussen/aac645dc-0af2-44b5-8aaa-204eb9458160",
    "statustypen": [
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/statustypen/abe68989-11c2-409e-8283-59722b2d6922",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/statustypen/5f36e79b-1a52-4aa4-90f0-b22e61d3df20",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/statustypen/3481f6e4-f853-44e4-badc-e2373c5d636e",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/statustypen/d170ed9f-7cd9-4832-8839-e5aaf895a298",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/statustypen/38f37994-0e66-4b59-be48-075a9845ad9e"
    ],
    "resultaattypen": [
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/resultaattypen/24232c41-cbfe-4f6f-ba07-049967eeb5f2",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/resultaattypen/6198e490-8040-4c4a-9b29-4227079772f0"
    ],
    "eigenschappen": [
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/eigenschappen/811dd96a-b760-4632-98c4-6a68668c619b",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/eigenschappen/e95329ec-40b7-4f43-9f8b-91d215dd7d81",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/eigenschappen/b3f8bad0-0b51-4252-a433-83de3efe5d13",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/eigenschappen/0d781472-baa9-43f0-9043-73ca9f8673a7",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/eigenschappen/e027c54b-f547-4ebc-b975-255f85ca47bf",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/eigenschappen/e8eca3ad-8926-4885-80a6-47ef9860166f",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/eigenschappen/63f56ca4-1f4d-49e7-8e01-e8344577db0c",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/eigenschappen/f2227263-6d67-4ad9-9847-6d5350cb7c82",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/eigenschappen/8f0d561e-8fd0-4eb8-8bc5-d654fdea94cc",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/eigenschappen/e4803417-1dd8-4bec-b082-5b701935101c",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/eigenschappen/3b3a9d0c-94f3-40c6-a9b0-a68f7befdcc8",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/eigenschappen/06c46f48-8581-4275-8542-509b8422dc04",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/eigenschappen/7c4f887f-029c-466c-8bd5-6a140172645a"
    ],
    "informatieobjecttypen": [
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/informatieobjecttypen/1055c64f-7183-449a-821d-cdb6c8ceef3f",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/informatieobjecttypen/c9b9901f-ac2e-43e1-8b67-bdb8ad513919",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/informatieobjecttypen/24a543cd-8580-4156-857c-d9ad55d16033",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/informatieobjecttypen/1c170deb-07a9-4a40-922f-0bcd36b138d9",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/informatieobjecttypen/5ff1db32-fffb-4d04-af01-f7fb11c9835d",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/informatieobjecttypen/d73827c6-31cc-41f7-ae44-f62d05da1d42"
    ],
    "roltypen": [
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/roltypen/31122fc9-1387-4a6a-a98b-3c114c9a5225",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/roltypen/e393a058-6c56-4e4b-8837-3c6b2030c61f",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/roltypen/56045282-dc5b-4c8d-8555-0699c835db62",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/roltypen/0a114089-67fb-4dce-9f3b-2768c6a2244e",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/roltypen/82665837-d2ae-4a3c-a541-18310386e8d1",
        "https://catalogi-api.nb.djuma.local/DevId/api/v1/roltypen/a0f6223b-f455-41d3-8e15-59555db528d8"
    ],
    "besluittypen": [],
    "deelzaaktypen": [],
    "gerelateerdeZaaktypen": [
        {
            "zaaktype": "https://catalogi-api.nb.djuma.local/DevId/api/v1/zaaktypen/2dcd950e-adf9-45c6-9c4a-b93c377cdcf3",
            "aardRelatie": "Bijdrage",
            "toelichting": "Alleen bezwaarschrift"
        },
        {
            "zaaktype": "https://catalogi-api.nb.djuma.local/DevId/api/v1/zaaktypen",
            "aardRelatie": "Onderwerp",
            "toelichting": "Alle zijn mogelijk"
        }
    ],
    "beginGeldigheid": "2016-06-27",
    "eindeGeldigheid": "9999-07-17",
    "versiedatum": "2016-06-27",
    "concept": false
}