Skip to content

Commit 1c0895d

Browse files
authored
Add authenticated decorator to handlers in doc
1 parent 4f2d91d commit 1c0895d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docs/source/developers/extensions.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,15 @@ The easiest way to add endpoints and handle incoming requests is to subclass the
2727
.. code-block:: python
2828
2929
from jupyter_server.base.handlers import JupyterHandler
30+
import tornado
3031
3132
class MyExtensionHandler(JupyterHandler):
3233
34+
@tornado.web.authenticated
3335
def get(self):
3436
...
3537
38+
@tornado.web.authenticated
3639
def post(self):
3740
...
3841
@@ -178,13 +181,16 @@ Jupyter Server provides a convenient mixin class for adding these properties to
178181
179182
from jupyter_server.base.handlers import JupyterHandler
180183
from jupyter_server.extension.handler import ExtensionHandlerMixin
184+
import tornado
181185
182186
183187
class MyExtensionHandler(ExtensionHandlerMixin, JupyterHandler):
184188
189+
@tornado.web.authenticated
185190
def get(self):
186191
...
187192
193+
@tornado.web.authenticated
188194
def post(self):
189195
...
190196
@@ -217,16 +223,19 @@ Pair the example above with ``ExtensionHandlers`` that also inherit the ``Extens
217223
ExtensionHandlerMixin,
218224
ExtensionHandlerJinjaMixin
219225
)
226+
import tornado
220227
221228
class MyExtensionHandler(
222229
ExtensionHandlerMixin,
223230
ExtensionHandlerJinjaMixin,
224231
JupyterHandler
225232
):
226233
234+
@tornado.web.authenticated
227235
def get(self):
228236
...
229237
238+
@tornado.web.authenticated
230239
def post(self):
231240
...
232241

0 commit comments

Comments
 (0)