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

Check that certificate is valid first #52

Open
tjzegmott opened this issue Jun 20, 2024 · 0 comments
Open

Check that certificate is valid first #52

tjzegmott opened this issue Jun 20, 2024 · 0 comments
Assignees

Comments

@tjzegmott
Copy link
Collaborator

In the first call, there is no valid cert provided and so the "x-vo-authenticated" header is missing, therefore the user is unauthenticated.

However, in the second call a valid cert is given and the header appears, hence we know that the user has been validated.

In [1]: import requests

In [2]: requests.head("https://ws-uv.canfar.net/minoc/capabilities").__dict__
Out[2]:
{'_content': b'',
 '_content_consumed': True,
 '_next': None,
 'status_code': 200,
 'headers': {'server': 'OpenCADC/cadc-rest + cadc-vosi-1.4', 'www-authenticate': 'ivoa_bearer standard_id="ivo://ivoa.net/sso#tls-with-password", access_url="https://ws-cadc.canfar.net/ac/login", Bearer, ivoa_x509 standard_id="ivo://ivoa.net/sso#BasicAA", access_url="https://ws.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/cred/auth/priv", ivoa_x509', 'transfer-encoding': 'chunked', 'date': 'Thu, 20 Jun 2024 14:54:38 GMT'},
 'raw': <urllib3.response.HTTPResponse at 0x1039bac80>,
 'url': 'https://ws-uv.canfar.net/minoc/capabilities',
 'encoding': None,
 'history': [],
 'reason': '',
 'cookies': <RequestsCookieJar[]>,
 'elapsed': datetime.timedelta(microseconds=334762),
 'request': <PreparedRequest [HEAD]>,
 'connection': <requests.adapters.HTTPAdapter at 0x103564be0>}

In [3]: requests.head("https://ws-uv.canfar.net/minoc/capabilities", cert="/Users/tarikzegmott/.ssl/cadcp
   ...: roxy.pem").__dict__
Out[3]:
{'_content': b'',
 '_content_consumed': True,
 '_next': None,
 'status_code': 200,
 'headers': {'server': 'OpenCADC/cadc-rest + cadc-vosi-1.4', 'x-vo-authenticated': 'tzegmott', 'transfer-encoding': 'chunked', 'date': 'Thu, 20 Jun 2024 14:54:46 GMT'},
 'raw': <urllib3.response.HTTPResponse at 0x1039bbc40>,
 'url': 'https://ws-uv.canfar.net/minoc/capabilities',
 'encoding': None,
 'history': [],
 'reason': '',
 'cookies': <RequestsCookieJar[]>,
 'elapsed': datetime.timedelta(microseconds=427245),
 'request': <PreparedRequest [HEAD]>,
 'connection': <requests.adapters.HTTPAdapter at 0x103566cb0>}
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