forked from p15670423/monkey
Island: Remove POST in propagation credentials endpoint
Post is not used, because configuration credentials are put all at once and stolen credentials are added via telemetry
This commit is contained in:
parent
40b29ba99a
commit
6e821c5bbc
|
@ -28,30 +28,13 @@ class PropagationCredentials(AbstractResource):
|
||||||
|
|
||||||
return propagation_credentials, HTTPStatus.OK
|
return propagation_credentials, HTTPStatus.OK
|
||||||
|
|
||||||
def post(self, collection=None):
|
|
||||||
credentials = [Credentials.from_mapping(c) for c in request.json]
|
|
||||||
|
|
||||||
if collection == _configured_collection:
|
|
||||||
self._credentials_repository.save_configured_credentials(credentials)
|
|
||||||
elif collection == _stolen_collection:
|
|
||||||
self._credentials_repository.save_stolen_credentials(credentials)
|
|
||||||
elif collection is None:
|
|
||||||
return {}, HTTPStatus.METHOD_NOT_ALLOWED
|
|
||||||
else:
|
|
||||||
return {}, HTTPStatus.NOT_FOUND
|
|
||||||
|
|
||||||
return {}, HTTPStatus.NO_CONTENT
|
|
||||||
|
|
||||||
def put(self, collection=None):
|
def put(self, collection=None):
|
||||||
credentials = [Credentials.from_mapping(c) for c in request.json]
|
credentials = [Credentials.from_mapping(c) for c in request.json]
|
||||||
|
|
||||||
if collection == _configured_collection:
|
if collection == _configured_collection:
|
||||||
self._credentials_repository.remove_configured_credentials()
|
self._credentials_repository.remove_configured_credentials()
|
||||||
self._credentials_repository.save_configured_credentials(credentials)
|
self._credentials_repository.save_configured_credentials(credentials)
|
||||||
elif collection == _stolen_collection:
|
elif collection is None or collection == _stolen_collection:
|
||||||
self._credentials_repository.remove_stolen_credentials()
|
|
||||||
self._credentials_repository.save_stolen_credentials(credentials)
|
|
||||||
elif collection is None:
|
|
||||||
return {}, HTTPStatus.METHOD_NOT_ALLOWED
|
return {}, HTTPStatus.METHOD_NOT_ALLOWED
|
||||||
else:
|
else:
|
||||||
return {}, HTTPStatus.NOT_FOUND
|
return {}, HTTPStatus.NOT_FOUND
|
||||||
|
|
Loading…
Reference in New Issue