Skip to content

Can't get macaroon using token? #8027

@DmitryLitvintsev

Description

@DmitryLitvintsev

I can get macaroon using x509 authentication:

SRC="https://amsc.fnal.gov:2880/amsc/test"

curl --silent --cert /tmp/x509up_u$(id -u) --key /tmp/x509up_u$(id -u) --cacert /tmp/x509up_u$(id -u) --capath /etc/grid-security/certificates -X POST -H 'Content-Type: application/macaroon-request' -d '{"caveats": ["activity:DOWNLOAD"], "validity": "PT1M"}' "$SRC" | jq -r '.macaroon'
MDAyMmxvY2F0aW9uIE9wdGlvbmFsWy9hbXNjL3Rlc3RdCjAwMThpZGVudGlmaWVyIE96UGdVTFpECjAwMTVjaWQgaWlkOnhndHJnbmZQCjAwMmNjaWQgaWQ6OTgxMTsxOTk5LDUwNjMsOTExNCw5MjQ3O2Ntc3Byb2QKMDAyZWNpZCBiZWZvcmU6MjAyNi0wMi0yN1QxNzowNzoyMC43MzM3NTQ3MDNaCjAwMThjaWQgcGF0aDovYW1zYy90ZXN0CjAwMWFjaWQgYWN0aXZpdHk6RE9XTkxPQUQKMDAyZnNpZ25hdHVyZSAS2KHxffllc61OT-h3JnLVUwcRcMNE8X5jZRXAUhNmcgo

If I try to use token I fail:

{
  "sub": "408c3486-b1ce-4d3d-ab3f-74717f80a534",
  "iss": "https://cilogon.org/fermilab",
  "wlcg.ver": "1.0",
  "aud": "https://wlcg.cern.ch/jwt/v1/any",
  "acr": "https://refeds.org/profile/sfa",
  "nbf": 1772212166,
  "auth_time": 1772212169,
  "scope": "storage.create:/amsc/neutrino/dune compute.cancel compute.create storage.modify:/amsc/neutrino/dune compute.read storage.read:/amsc/neutrino/dune compute.modify",
  "exp": 1772222971,
  "iat": 1772212171,
  "wlcg.groups": [
    "/amsc/dunewrite",
    "/amsc"
  ],
  "jti": "https://cilogon.org/oauth2/6761206a8eda2fcd5e5112615786406b?type=accessToken&ts=1772212171136&version=v2.0&lifetime=10800000"
}

export BEARER_TOKEN=$(< $XDG_RUNTIME_DIR/bt_u$(id -u))
export SRC="https://amsc.fnal.gov:2880/amsc/neutrino/dune"

curl -v -X POST -H "Authorization: Bearer ${BEARER_TOKEN}" -H 'Content-Type: application/macaroon-request' -d '{"caveats": ["activity:DOWNLOAD"], "validity": "PT1M"}' "$SRC" export BEARER_TOKEN=$(< $XDG_RUNTIME_DIR/bt_u$(id -u))
...

> 
* TLSv1.2 (IN), TLS header, Unknown (23):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.2 (IN), TLS header, Unknown (23):
* Mark bundle as not supporting multiuse
< HTTP/1.1 400 Cannot serialise restriction MultiTargetedRestriction
< Date: Fri, 27 Feb 2026 17:26:53 GMT
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
< Server: 
< Access-Control-Allow-Origin: https://amsc.fnal.gov:2880
< Strict-Transport-Security: max-age=31536000
< Feature-Policy: accelerometer 'none' ; ambient-light-sensor 'none' ; camera 'none' ; encrypted-media 'none' ; fullscreen 'none' ; geolocation 'none' ; gyroscope 'none' ; magnetometer 'none' ; microphone 'none' ; midi 'none' ; payment 'none' ; speaker 'none' ; sync-xhr 'self' ; usb 'none' ; vr 'none' ; picture-in-picture 'none'
< Referrer-Policy: strict-origin-when-cross-origin
< Content-Length: 0
< 
* Connection #0 to host amsc.fnal.gov left intact

The salient error:

HTTP/1.1 400 Cannot serialise restriction MultiTargetedRestriction

Am I doing something wrong or this is broken?

The error is printed from :

https://github.com/dCache/dcache/blob/master/modules/dcache-webdav/src/main/java/org/dcache/webdav/macaroons/MacaroonRequestHandler.java#L270

where it just loops over LoginAttributes and returns ErrorResponseException in case LoginAttribute is of type Restriction

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions