@@ -349,6 +349,39 @@ Even if the facilities you observe at are not API-accessible, you
349349can still add them to your TOM’s airmass plots to judge what targets to
350350observe when.
351351
352+ How to add User-specific credentials to your Facility
353+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
354+
355+ Observation facilities typically require credentials (username and password or API key)
356+ to interact and submit observation requests. That is, you have to "log in" to use the Facility's
357+ API or client library.
358+
359+ A TOM can be configured to provide common Facility credentials for every User of the TOM.
360+ These are specified in the ``FACILITIES `` dictionary of ``settings.py ``. In this case, the TOM
361+ administrator would be resposible for maintaining the appropriate credentials. All observation
362+ requests from the TOM would use those same credentials.
363+
364+ While you may write your Facility to use that mechanism, a few additional steps allow your
365+ Facility to provide for individual, User-specific credentials. Each TOM user can thus manage
366+ their own credentials and use them to submit their own observation requests.
367+
368+ In outline, your Facility must:
369+
370+ 1. Create a FaciltyProfile model in your Facility's ``models.py ``. (Your Facility is typically
371+ implmemented as an ``INSTALLED_APP `` and as such has a ``models.py `` module). This is described
372+ and demonstrated in the `tom_demoapp <https://github.com/TOMToolkit/tom_demoapp >`__ and documented
373+ `here <https://github.com/TOMToolkit/tom_demoapp/wiki/Integration-Points#profile-details >`__.
374+
375+ 2. The fields of your Facility's Profile model would store the required credentials (for example,
376+ a username and password or an API-key). Sensitive data such as passwords and API-keys should be
377+ saved in an encrypted fashion and that is described
378+ :doc: `here <../customization/encrypted_model_fields >`.
379+
380+ 3. Finally, your Facility class must access these credentials to intereact with your Facility.
381+ An example of this can be found in the TOMToolkit
382+ `ESOFacility <https://github.com/TOMToolkit/tom_eso/blob/6e3575c7e44cdb09f3df83740f2e9f522afbb603/tom_eso/eso.py#L378 >`__.
383+
384+
352385Happy developing!
353386
354387
0 commit comments