Commit Graph

91 Commits

Author SHA1 Message Date
Min RK
2c47fd4a02 Add /api/ and /api/info endpoints
/api/ is not authenticated, and just reports JupyterHub's version for now.
/api/info is admin-only, and reports more detailed info about Python, authenticators/spawners in use, etc.
2016-08-01 15:15:59 +02:00
Min RK
dfa13cb2c5 avoid creating duplicate users in test_api
now that we check!
2016-07-28 17:23:44 +02:00
Min RK
2eaecd22ba cleanup servers, api tokens after spawner shutdown
prevents growing table of unused servers and tokens
2016-07-08 16:50:43 +02:00
Min RK
6d106b24f4 add groups API 2016-06-01 14:04:32 +02:00
Min RK
71f47b7a70 add user groups 2016-06-01 13:47:53 +02:00
Min RK
05c268e190 Run tests with an encoded base_url
to ensure we get our escaping right

Mostly revealed fixes needed in tests so far, not code,
but should catch regressions.
2016-05-26 13:56:20 +02:00
dominic
c7f542e79e Add tests for form based token generation 2016-04-18 10:27:38 +02:00
Min RK
67ccfc7eb7 increase some test coverage 2016-03-07 16:13:57 +01:00
Min RK
be5860822d remove redundant use_subdomains
non-empty subdomain_host is enough
2016-03-04 11:11:41 +01:00
Min RK
335b47d7c1 include protocol in subdomain_host
makes everything easier, and tests are passing with and without subdomains (yay!)
2016-02-28 11:12:41 +01:00
Min RK
f922561003 Tests are passing with subdomains 2016-02-26 17:32:55 +01:00
Min RK
9441fa37c5 validate usernames
via Authenticator.validate_username

base class configurable with Authenticator.username_pattern
2016-01-13 14:02:50 +01:00
Carol Willing
2815f72250 Change mocking of slowspawner to match nospawner 2016-01-05 19:45:49 -08:00
Min RK
41ea696546 Instantiate Spawner on User init
shrinks `User.spawn` to take single argument, grants User more direct access to state.
2015-12-30 13:55:36 +01:00
Min RK
54f9a296de test Spawner.user_options and spawn form 2015-12-30 13:55:01 +01:00
Min RK
6f128758db move non-persisted User objects (spawner-related) off of orm.User
adds higher level User object, which handles spawning.
This object has running, spawner, etc. attributes.
2015-11-30 14:05:00 +01:00
Min RK
d1edbddb77 use gen.sleep
instead of elaborate `gen.Task(add_timeout...)`

requires tornado 4.1
2015-09-23 17:04:01 +02:00
Min RK
3003c87f02 check Referer on API requests
For CSRF
2015-07-12 14:23:02 -05:00
Min RK
2c8c88ac3f add CSP report handler 2015-07-12 11:22:21 -05:00
Min RK
48fe642c44 use thread local db sessions
to avoid segfaults on Travis
2015-07-09 11:34:35 -05:00
Min RK
612cc73c3c skip existing users on bulk user creation
rather than aborting if any already exist

if no users are to be created, throw 400
2015-05-06 15:24:34 -07:00
Min RK
546d86e888 allow creating multiple users with one API request 2015-05-06 14:01:31 -07:00
Min RK
80997c8297 reply with full user model in auth handlers 2015-05-01 13:43:43 -07:00
Scott Sanderson
74d3740921 DEV: Allow configuration of default headers.
Applies Content-Security-Policy: frame-ancestors 'self' by default.
2015-04-24 01:19:25 -04:00
Min RK
d9fc40652d test shutdown API handler 2015-04-07 15:49:25 -07:00
Min RK
edfb39c74c Merge pull request #148 from minrk/poke-proxy-api
add proxy API
2015-02-08 10:24:42 -08:00
Min RK
c82903b85e add 'pending' to user REST model 2015-02-08 10:19:48 -08:00
Min RK
4fd58b2bf2 add proxy API
- GET fetches proxy table (relays same request to proxy's API endpoint)
- POST prods routing table sync (useful when proxy restarts)
- PATCH allows updating the proxy API location, auth token
2015-02-06 17:06:41 -08:00
Min RK
09d9efb44c handle Spawners that are slow to stop
e.g. docker, which can take a long time to stop,
especially if several docker actions are already queued.

Use status `202: Accepted` for API replies sent with spawn/stop still pending
2015-01-28 11:35:38 -08:00
Min RK
7a0979aa4f don't compare last_activity in user models 2015-01-07 15:10:34 -08:00
Min RK
6d95bf1893 test slow and never-finishing spawners 2014-12-22 13:27:23 -08:00
Min RK
27e51cd0b4 Merge pull request #81 from minrk/crypto-db
hash tokens in database

closes #80
closes #83
2014-10-30 16:20:16 -07:00
Scott Sanderson
8cfbe9b38e DEV: Close transactions at the end of HTTP Requests.
Fixes #84
2014-10-29 17:38:24 -04:00
Min RK
ae7b92c55e get rid of cookie tokens
use single cookie_id, since cookies themselves are already unique via `set_secure_cookie`

resetting cookie_id effectively logs out all browser sessions for a given user
2014-10-28 15:01:29 -07:00
MinRK
bce2be7401 only store hashed tokens
- use PasswordType
- store first 4 bytes for filtering by prefix
  since we can't filter by equality on the hashed value.
- user.new_foo_token() returns token string, not ORM object
2014-10-27 17:29:44 -07:00
MinRK
0bd03f0861 remove cookie_secret from single-user servers
pass encrypted cookies to Hub for verification
2014-10-26 20:23:24 -07:00
MinRK
d8ef6d59c1 adjustments to Spawner.stop
- call start/stop_polling outside Spawner
  (avoids need for custom spawners to reimplement)
- don't clear state when stopping Spawner
  (should enable spawners to resume)
2014-10-08 13:54:17 -07:00
MinRK
e2f12f7071 raise 400 when failing to create users 2014-09-25 14:49:06 -07:00
MinRK
0a8759b0a5 flesh out REST API
can now list/view/add/create/modify users
and start/stop single-user servers
2014-09-14 16:47:09 -07:00
MinRK
833835b0f3 add user list handler, first of many 2014-09-14 11:54:37 -07:00
MinRK
5c87461605 add mock utils to tests
basic testing framework to get starting writing and testing the REST API

including tests for the authorizations API,
the only API URL defined so far.
2014-09-13 16:11:22 -07:00