accounts.controllers.authentication module

Controllers for arXiv accounts application.

When a user logs in via the accounts service, they are issued a session key that is stored as a cookie in their browser. That session ID is registered in the distributed keystore, along with claims about the user’s identity and privileges in the system (based on their role). In subsequent requests handled by the UI ingress, the authenticator service uses that session key to validate the authenticated session, and to retrieve corresponding identity and authorization information.

class accounts.controllers.authentication.LoginForm(formdata=None, obj=None, prefix='', data=None, meta=None, **kwargs)[source]

Bases: wtforms.form.Form

Log in form.

password = <UnboundField(PasswordField, ('Password',), {'validators': [<wtforms.validators.DataRequired object>]})>
username = <UnboundField(StringField, ('Username or e-mail',), {'validators': [<wtforms.validators.DataRequired object>]})>
accounts.controllers.authentication.login(method, form_data, ip, next_page, track='')[source]

Provide the login form.

Parameters:
  • form_data (MultiDict) – Should include username and password data.
  • ip (str) – IP or hostname of client.
  • next_page (str) – Page to which the user should be redirected upon login.
Returns:

  • dict – Additional data to add to the response.
  • int – Status code. This should be 303 (See Other) if all goes well.
  • dict – Headers to add to the response.

Return type:

Tuple[dict, int, dict]

accounts.controllers.authentication.logout(session_cookie, classic_session_cookie, next_page)[source]

Log the user out, and redirect to arXiv.org.

Parameters:
  • session_id (str or None) – If not None, invalidates the session.
  • classic_session_id (str or None) – If not None, invalidates the session.
  • next_page (str) – Page to which the user should be redirected upon logout.
Returns:

  • dict – Additional data to add to the response.
  • int – Status code. This should be 303 (See Other).
  • dict – Headers to add to the response.

Return type:

Tuple[dict, int, dict]