def __init__(self, identity: SigningKey, router: AbstractRouter): self.identity = identity self.client_registry = ClientRegistry() self.key_registry = KeyRegistry() self.token_registry = TokenRegistry() self.resource_servers: Dict[str, ResourceServer] = {} router.add_post('/token', self.token) router.add_post('/introspect', self.introspect)
def __init__(self, audience: str, identity: SigningKey, as_url: str, as_public_key: VerifyingKey, router: AbstractRouter, client_id=None, client_secret=None): super().__init__(audience, identity, as_url, as_public_key, client_id, client_secret) router.add_post('/authz-info', self.authz_info) router.add_post('/.well-known/edhoc', self.edhoc)
def __init__(self, audience: str, identity: SigningKey, as_url: str, as_public_key: VerifyingKey, router: AbstractRouter, client_id=None, client_secret=None): super().__init__(audience, identity, as_url, as_public_key, router, client_id, client_secret) router.add_get( '/temperature', self.wrap(scope="read_temperature", handler=self.get_temperature)) router.add_post('/led', self.wrap(scope="post_led", handler=self.post_led))
def _setup_humans_routes(router: AbstractRouter) -> None: router.add_post( '/humans/{callsign}/kick', humans.kick_human_by_callsign, ) router.add_post( '/humans/kick', humans.kick_all_humans, ) router.add_get( '/humans/statistics', humans.get_humans_statistics, ) router.add_get( '/humans/count', humans.get_humans_count, ) router.add_get( '/humans', humans.get_humans_list, )
def setup_routes(router: AbstractRouter) -> None: router.add_get('/', misc.get_health) router.add_get('/info', misc.get_server_info) router.add_get('/streaming', StreamingView) _setup_humans_routes(router) _setup_chat_routes(router) _setup_missions_routes(router) _setup_radar_routes(router)
def _setup_chat_routes(router: AbstractRouter) -> None: router.add_post( '/chat/humans/{addressee}', chat.chat_to_human, ) router.add_post( '/chat/belligerents/{addressee}', chat.chat_to_belligerent, ) router.add_post( '/chat', chat.chat_to_all, )
def _setup_missions_routes(router: AbstractRouter) -> None: router.add_get( '/missions/current/info', missions.get_current_mission_info, ) router.add_post( '/missions/current/begin', missions.begin_current_mission, ) router.add_post( '/missions/current/end', missions.end_current_mission, ) router.add_post( '/missions/current/unload', missions.unload_current_mission, ) router.add_post( '/missions/{file_path:[^{}]+\.mis}/load', missions.load_mission, ) router.add_delete( '/missions/{file_path:[^{}]+\.mis}', missions.delete_mission, ) router.add_get( '/missions/{file_path:[^{}]+\.mis}', missions.get_mission, ) router.add_post( '/missions/{dir_path:[^{}]*}', missions.upload_mission, ) router.add_get( '/missions/{dir_path:[^{}]*}', missions.browse_missions, ) router.add_post( '/missions', missions.upload_mission, ) router.add_get( '/missions', missions.browse_missions, )
def _setup_radar_routes(router: AbstractRouter) -> None: router.add_get( '/radar/ships', radar.get_all_ships_positions, ) router.add_get( '/radar/ships/moving', radar.get_moving_ships_positions, ) router.add_get( '/radar/ships/stationary', radar.get_stationary_ships_positions, ) router.add_get( '/radar/aircrafts/moving', radar.get_moving_aircrafts_positions, ) router.add_get( '/radar/ground-units/moving', radar.get_moving_ground_units_positions, ) router.add_get( '/radar/houses', radar.get_all_houses_positions, ) router.add_get( '/radar/stationary-objects', radar.get_stationary_objects_positions, ) router.add_get( '/radar/moving', radar.get_all_moving_actors_positions, ) router.add_get( '/radar/stationary', radar.get_all_stationary_actors_positions, )