Gerhard Weis
9ac6ed344c
UserTokenListAPIHandler should support Authenticator.authenticate returning a dict
2018-11-22 14:33:48 +10:00
Min RK
e79b43e906
support removing named servers
2018-09-24 16:21:40 +02:00
Min RK
fcbc6e06c8
stop keepalive loop promptly on finish
...
rather than waiting until keepalive_interval, which leaves idle coroutines for at least 8 seconds
2018-09-24 15:54:01 +02:00
Min RK
d79a99323e
make .get_current_user
async
...
- `.get_current_user` is called in the `prepare` stage for all handlers
- use `.current_user` to access current user in methods
- adds Authenticator.refresh_user for refreshing user auth (unused at this point)
2018-09-13 10:16:13 +02:00
Min RK
54449562bd
remove spurious print from keepalive code
...
and send keepalive every 8 seconds
to protect against possibly aggressive proxies dropping connections after 10 seconds of inactivity
2018-09-11 16:50:48 +02:00
Min RK
e29fad06ed
write needs no await
2018-09-11 16:41:27 +02:00
Min RK
146587ffff
add keepalive to progress eventstream
...
avoids issues with proxies dropping connections when no data passes through
Progress behavior should already be resilient to dropped connections,
as the progress ought to just resume anew.
2018-08-30 19:03:14 +02:00
Min RK
58c91e3fd4
implement API token expiry
2018-05-07 13:00:37 +02:00
Min RK
0e08963355
suppress auth errors on authenticated token request
...
since Authenticators may not be prepared for this
2018-05-04 17:18:32 +02:00
Min RK
cd9e39bf54
allow authenticators to authenticate API requests for tokens
...
gives Authenticators the ability to authenticate token requests,
e.g. with an existing OAuth token from the upstream provider
2018-05-04 17:18:32 +02:00
Richard Darst
2344d696ca
API: pass 'server_state' through to admin clients only
...
- This will allow, for example, cull_idle_servers to be more
intelligent when culling servers.
- This is only given to admin API users, because we don't know if all
spawners expect their state to be made available to users.
2018-04-24 16:52:18 +03:00
Min RK
4281babee4
make server-model inclusion opt-in
...
so only certain API endpoints include server info:
- user list
- get named user
The rest exclude running servers
2018-04-24 11:35:51 +02:00
Min RK
976fa9c907
update default note for API-requested tokens
2018-04-20 15:34:52 +02:00
Min RK
ce535b55bc
Revoking one oauth token revokes all oauth tokens for that client
2018-04-20 15:34:52 +02:00
Min RK
f7f0b72776
retrieve tokens by id in REST API, not full token in URL
2018-04-20 15:34:52 +02:00
Min RK
251289fc05
add new token management to REST API
...
- list tokens
- create new tokens
- delete tokens
2018-04-20 15:34:52 +02:00
Carol Willing
cbf2b8cb78
Merge pull request #1790 from minrk/409-conflict
...
raise 409 conflict on duplicate actions
2018-04-13 10:29:52 -07:00
Min RK
c08148266a
raise 409 conflict on duplicate actions
...
Makes it easier for upstream clients to retry failed actions and ignore failure due to duplicate transactions
2018-04-11 10:52:05 +02:00
Min RK
9b914e8f01
fix waiting for spawner to fail in progress
2018-04-09 14:46:28 +02:00
Min RK
a189196855
ensure async generators are properly closed
...
only terminate with iterate_until in handler, not Spawner._generate_events
2018-04-09 13:03:18 +02:00
Min RK
c0f37c48a1
fix wait for spawn future
...
asyncio.wait takes a list
2018-04-09 11:16:17 +02:00
Min RK
ee1a86d192
progress url is at server/progress
...
instead of server-progress
2018-04-05 11:22:00 +02:00
Min RK
707b300bd6
add iterate_until utility
...
allows iterating through an async generator, yielding items until another Future resolves
if/when that deadline Future resolves, ready items will continue to be yielded until there is one that actually needs to wait
at which point the iteration will halt
2018-04-05 11:22:00 +02:00
Min RK
c9e12182a2
halt progress iteration on completed spawn
...
requires calling `__aiter__` and `__anext__` instead of `async for`
2018-04-05 11:22:00 +02:00
Min RK
4f78cbbd1b
implement progress on spawn_pending page
...
- add Spawner.progress method. Must be an async generator of JSON-able progress events
- add /api/users/:user/server-progress eventstream endpoint
- use eventstream to fill progress bar on the spawn pending page
2018-04-05 11:22:00 +02:00
Tim Head
5b9f51417f
Fix permission check when handing out auth state
2018-03-27 10:02:59 +02:00
Tim Head
bf7afa16e5
Remove auth state from user's self handler
2018-03-27 10:02:59 +02:00
Tim Head
0d57baae82
Modify user API wrt auth_state
...
A user can not get their own auth state via the REST API. Only admins
can fetch and update the auth state this way.
2018-03-27 10:02:59 +02:00
Tim Head
1ee993c664
Add ability to modify auth_state via the REST API
2018-03-27 10:02:59 +02:00
Tim Head
542c20065f
Reduce the number of endpoints that expose auth_state
2018-03-27 10:02:59 +02:00
Tim Head
39f663d03c
Expose auth_state via user API
2018-03-27 10:02:59 +02:00
Min RK
0421497b1e
remove web.authenticated from /api/user handler
...
which prevents it from being used with oauth tokens
2018-03-13 10:03:01 +01:00
Min RK
dad26be2c6
call it our own maybe_future
...
our version of gen.maybe_future that's fully tornado- and asyncio-compatible
2018-03-12 18:18:47 +01:00
Min RK
b6f634368c
add utils.awaitable replacement for gen.maybe_future
...
gen.maybe_future doesn't accept asyncio coroutines
and asyncio.ensure_future doesn't accept *tornado* coroutines, so do our own thing
2018-03-12 18:18:46 +01:00
Min RK
7a268c94b0
bulk find/replace async def and await
...
- `@gen.coroutine def` -> `async def`
- `yield future` -> `await future`
needs some fine tuning, but this is the big one
2018-03-12 18:18:46 +01:00
Min RK
c8b4cab022
support getting user models from orm-only User objects
...
avoids instantiating User wrappers for inactive users in get_all_users
2018-02-06 12:04:14 +01:00
Min RK
06fb94b4ea
Delay instantiation of User and Spawner objects
...
Avoids instantiating too many objects before they are used
- deletes Spawner instances after they stop to avoid lingering instances
- use user_dict cache more often instead of db queries
- check for empty spawners dict to avoid a few Spawner instantiations
2018-02-06 12:04:14 +01:00
Min RK
5f7ffaf1f6
allow default (empty) server name with named servers
...
remove generated names behavior because it doesn't work
2017-09-17 11:47:17 +02:00
Min RK
8e3553462c
exercise start/stop race conditions
...
this doesn’t cover all the edge cases of each possible stage for the races, but it gets the basics covered.
2017-08-26 11:57:05 -04:00
Min RK
f7ea451df8
get the tests running
2017-08-25 18:12:15 -04:00
Min RK
2866be9462
don’t allow start while stop is pending
...
- start fails with 400 if stop is pending
- set spawn_pending across a whole spawn (including proxy)
- proxy_pending is only around the proxy
2017-08-23 23:35:19 -04:00
Min RK
57c8ad6b92
consolidate server APIHandlers
...
no need for separate handlers for named and default servers
avoid claiming that empty responses are JSON.
2017-08-04 16:17:20 +02:00
Min RK
55000f98bc
include non-empty body with 202 responses
...
reply claims to be application/json, so make sure it has some content
2017-08-03 12:01:19 +02:00
Min RK
684afed3f1
restore user.running property
...
it was made a method for handing named_servers,
but that made things way more complicated and replaced a boolean flag with a callable,
which would behave unexpectedly but without error if a boolean flag was expected.
Spawners have properties for dealing with this now, so use spawners
Restore `user.running` as an alias for `user.spawner.ready`
2017-08-03 11:09:27 +02:00
Min RK
3e796b579d
Address review in named_servers
...
from willingc
- consistency of repr/str when logging usernames
- cleanup some attribute declarations
- add comments about db session weirdness
2017-07-26 10:47:35 +02:00
Min RK
2cec124b4f
support named servers in REST API
...
and exercise them in tests
2017-07-24 16:55:17 +02:00
Min RK
4b5aad41b1
make user.running a method
...
accept server names
2017-07-18 14:48:29 +02:00
Min RK
c943162649
merge named server handlers
...
only need one handler class per path
2017-07-18 14:28:45 +02:00
Min RK
5da4348c2d
move some state to Spawner
...
now that there are more than one per user
2017-06-21 16:33:16 +02:00
Min RK
e33e34748f
Re-sync with master
2017-06-21 15:33:01 +02:00