Exemplo n.º 1
0
 def register():
     body = routes.current_request.json_body
     username = get_param(body, 'username', required=True)
     password = get_param(body, 'password', required=True)
     body.pop('username')
     body.pop('password')
     return lifecycle.register(username, password, body)
Exemplo n.º 2
0
 def login():
     body = routes.current_request.json_body
     username = get_param(body, 'username', required=True)
     password = get_param(body, 'password', required=True)
     try:
         return lifecycle.login(username, password)
     except ChallengeError as e:
         return Response(body=e.params,
                         status_code=401,
                         headers={
                             'Challenge': e.challenge,
                             'Session': e.session,
                         })
Exemplo n.º 3
0
 def refresh():
     body = routes.current_request.json_body
     refresh_token = get_param(body, 'refresh_token', required=True)
     return lifecycle.refresh(refresh_token)
Exemplo n.º 4
0
 def auth_challenge():
     body = routes.current_request.json_body
     challenge = get_param(body, 'challenge', required=True)
     session = get_param(body, 'session', required=True)
     params = get_param(body, 'params', required=True)
     return lifecycle.auth_challenge(challenge, session, params)
Exemplo n.º 5
0
 def confirm():
     body = routes.current_request.json_body
     username = get_param(body, 'username', required=True)
     code = get_param(body, 'code', required=True)
     lifecycle.confirm(username, code)