Skip to content
This repository has been archived by the owner on Sep 16, 2022. It is now read-only.

Refactor DeviceCertView #267

Closed
a-martynovich opened this issue Jun 12, 2019 · 6 comments · Fixed by #315
Closed

Refactor DeviceCertView #267

a-martynovich opened this issue Jun 12, 2019 · 6 comments · Fixed by #315

Comments

@a-martynovich
Copy link
Contributor

Subtask of #216

DeviceCertView should be split in two, one for IS_API, another for IS_DASH (see branching by if 'format' in request.GET:). One branch of this code is currently used by agent, another branch is used by Dash. Instead, the part which is used by Dash should be part of Dash.

It will also allow us to remove hardcoded urls in models.Device.get_cert_url().

@rptrchv
Copy link
Contributor

rptrchv commented Jul 8, 2019

On me

@rptrchv
Copy link
Contributor

rptrchv commented Jul 9, 2019

@a-martynovich

One branch of this code is currently used by agent

I haven't managed to find any signs of this view usage by agent other than:
docs/examples/google-core-iot/README.md:$ curl -s "https://api.wott.io/v0.2/device-cert/$DEVICE_ID" > device.crt
which is quite the same like we use it in the Dash.
Moving this view's url pattern to the 'IS_DASH' section of urls.py seems quite reasonable and I'll do that after your confirmation it's enough for this task.

@a-martynovich
Copy link
Contributor Author

@rptrchv The certificate retrieval via api.wott.io is needed for #278 and is used in WoTTsecurity/google-core-iot#1. It should probably require token authentication (the same as for listing all devices), but I'm not sure (@vpetersson ?)

@vpetersson
Copy link
Contributor

No, public certificates should not require auth, because they are needed for some device-to-device communication.

@rptrchv
Copy link
Contributor

rptrchv commented Jul 9, 2019

@rptrchv The certificate retrieval via api.wott.io is needed for #278 and is used in WoTTsecurity/google-core-iot#1. It should probably require token authentication (the same as for listing all devices), but I'm not sure (@vpetersson ?)

None of the consumers of this view (including the ones you mentioned above) uses its branch if 'format' in request.GET:.
So I'm concluding we just need to have the same view available by 2 urls:

  • one in the 'IS_API' section of urls.py
  • another in the 'IS_DASH' section of urls.py

Also we need to get rid of if 'format' in request.GET: branch of the view.
Am I right?
@a-martynovich ^

@a-martynovich
Copy link
Contributor Author

@rptrchv

So I'm concluding we just need to have the same view available by 2 urls:
Also we need to get rid of if 'format' in request.GET: branch of the view.

exactly so.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants