File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -27,15 +27,20 @@ The easiest way to add endpoints and handle incoming requests is to subclass the
27
27
.. code-block :: python
28
28
29
29
from jupyter_server.base.handlers import JupyterHandler
30
+ import tornado
30
31
31
32
class MyExtensionHandler (JupyterHandler ):
32
33
34
+ @tornado.web.authenticated
33
35
def get (self ):
34
36
...
35
37
38
+ @tornado.web.authenticated
36
39
def post (self ):
37
40
...
38
41
42
+ .. note ::
43
+ It is best practice to wrap each handler method with the ``authenticated `` decorator to ensure that each request is authenticated by the server.
39
44
40
45
Then add this handler to Jupyter Server's Web Application through the ``_load_jupyter_server_extension `` function.
41
46
@@ -178,13 +183,16 @@ Jupyter Server provides a convenient mixin class for adding these properties to
178
183
179
184
from jupyter_server.base.handlers import JupyterHandler
180
185
from jupyter_server.extension.handler import ExtensionHandlerMixin
186
+ import tornado
181
187
182
188
183
189
class MyExtensionHandler (ExtensionHandlerMixin , JupyterHandler ):
184
190
191
+ @tornado.web.authenticated
185
192
def get (self ):
186
193
...
187
194
195
+ @tornado.web.authenticated
188
196
def post (self ):
189
197
...
190
198
@@ -217,16 +225,19 @@ Pair the example above with ``ExtensionHandlers`` that also inherit the ``Extens
217
225
ExtensionHandlerMixin,
218
226
ExtensionHandlerJinjaMixin
219
227
)
228
+ import tornado
220
229
221
230
class MyExtensionHandler (
222
231
ExtensionHandlerMixin ,
223
232
ExtensionHandlerJinjaMixin ,
224
233
JupyterHandler
225
234
):
226
235
236
+ @tornado.web.authenticated
227
237
def get (self ):
228
238
...
229
239
240
+ @tornado.web.authenticated
230
241
def post (self ):
231
242
...
232
243
You can’t perform that action at this time.
0 commit comments