Skip to content

xnat: automate query to establish a new provider for non-public project #101

@yarikoptic

Description

@yarikoptic

XNAT does not return 403 but 404:

$> wget -S 'https://central.xnat.org/data/projects/test-private?format=json'
--2021-04-20 08:39:25--  https://central.xnat.org/data/projects/test-private?format=json
Resolving central.xnat.org (central.xnat.org)... 128.252.217.126
Connecting to central.xnat.org (central.xnat.org)|128.252.217.126|:443... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 404 Not Found
  Set-Cookie: JSESSIONID=central.xnat.org3~8D1E10CD81618689E10E473DC2E37F27; Path=/; HttpOnly
  Set-Cookie: SESSION_EXPIRATION_TIME="1618922365335,900000"; Version=1; Path=/
  Date: Tue, 20 Apr 2021 12:39:26 GMT
  Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
  Accept-Ranges: bytes
  Server: Noelios-Restlet-Engine/1.1.10
  X-Content-Type-Options: nosniff
  X-XSS-Protection: 1; mode=block
  X-Frame-Options: SAMEORIGIN
  Content-Security-Policy: frame-ancestors 'self'
  Content-Type: text/html;charset=ISO-8859-1
  Content-Length: 312
2021-04-20 08:39:26 ERROR 404: Not Found.

unfortunately this provider config I crafted

[provider:xnat-test-private]
#url_re = https://central.xnat.org/data/projects/test-private.*
url_re = https://central.xnat.org/.*
credential = xnat-test-private
authentication_type = html_form
html_form_url = https://central.xnat.org/app/template/Login.vm#!
html_form_tagid = login_form
html_form_fields = username={user}
                   password={password}
                   XNAT_CSRF=
html_form_success_re = Logged in as


[credential:xnat-test-private]
url = https://central.xnat.org
type = user_password
is not yet complete/working:
$> datalad -l debug download-url 'https://central.xnat.org/data/projects/test-private?format=json'
...
[DEBUG  ] Importing keyring 
[DEBUG  ] Posted to https://central.xnat.org/app/template/Login.vm#! fields ['username', 'password', 'XNAT_CSRF'], got response <Response [200]> with headers ['Server', 'Set-Cookie', 'X-Content-Type-Options', 'X-XSS-Protection', 'X-Frame-Options', 'Content-Security-Policy', 'Content-Type', 'Content-Language', 'Transfer-Encoding', 'Date'] 
download_url(error): /tmp/ (file) [Access to https://central.xnat.org/data/projects/test-private?format=json has failed: not found [http.py:check_response_status:104]]
[DEBUG  ] could not perform all requested actions: Command did not complete successfully. 1 failed:
[{'action': 'download_url',
  'exception_traceback': '[download_url.py:__call__:185,providers.py:download:482,base.py:download:521,base.py:access:169,base.py:_download:419,http.py:get_downloader_session:573,http.py:check_response_status:104]',
  'message': 'Access to '
             'https://central.xnat.org/data/projects/test-private?format=json '
             'has failed: not found [http.py:check_response_status:104]',
  'path': '/tmp/',
  'status': 'error',
  'type': 'file'}] [utils.py:generator_func:455] 
so more debugging/dance is needed. May be @chaselgrove remembers some detail?

attn @dnkennedy @satra

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