|
@@ -33,13 +33,10 @@ class SessionController(Controller):
|
33
|
33
|
@hapic.with_api_doc()
|
34
|
34
|
@hapic.input_headers(LoginOutputHeaders())
|
35
|
35
|
@hapic.input_body(BasicAuthSchema())
|
36
|
|
- @hapic.handle_exception(AuthenticationFailed, http_code=HTTPStatus.BAD_REQUEST)
|
|
36
|
+ @hapic.handle_exception(AuthenticationFailed, HTTPStatus.BAD_REQUEST)
|
37
|
37
|
# TODO - G.M - 17-04-2018 - fix output header ?
|
38
|
38
|
# @hapic.output_headers()
|
39
|
|
- @hapic.output_body(
|
40
|
|
- NoContentSchema(),
|
41
|
|
- default_http_code=HTTPStatus.NO_CONTENT
|
42
|
|
- )
|
|
39
|
+ @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT)
|
43
|
40
|
def login(self, context, request: TracimRequest, hapic_data=None):
|
44
|
41
|
"""
|
45
|
42
|
Logs user into the system
|
|
@@ -55,10 +52,7 @@ class SessionController(Controller):
|
55
|
52
|
return uapi.authenticate_user(email, password)
|
56
|
53
|
|
57
|
54
|
@hapic.with_api_doc()
|
58
|
|
- @hapic.output_body(
|
59
|
|
- NoContentSchema(),
|
60
|
|
- default_http_code=HTTPStatus.NO_CONTENT
|
61
|
|
- )
|
|
55
|
+ @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT)
|
62
|
56
|
def logout(self, context, request: TracimRequest, hapic_data=None):
|
63
|
57
|
"""
|
64
|
58
|
Logs out current logged in user session
|
|
@@ -67,13 +61,8 @@ class SessionController(Controller):
|
67
|
61
|
return
|
68
|
62
|
|
69
|
63
|
@hapic.with_api_doc()
|
70
|
|
- @hapic.handle_exception(
|
71
|
|
- NotAuthentificated,
|
72
|
|
- http_code=HTTPStatus.UNAUTHORIZED
|
73
|
|
- )
|
74
|
|
- @hapic.output_body(
|
75
|
|
- UserSchema(),
|
76
|
|
- )
|
|
64
|
+ @hapic.handle_exception(NotAuthentificated, HTTPStatus.UNAUTHORIZED)
|
|
65
|
+ @hapic.output_body(UserSchema(),)
|
77
|
66
|
def whoami(self, context, request: TracimRequest, hapic_data=None):
|
78
|
67
|
"""
|
79
|
68
|
Return current logged in user or 401
|