File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -72,6 +72,32 @@ def login_handler():
7272 )
7373
7474
75+ @login .route ("/login2" , methods = ["GET" , "POST" ])
76+ @csrf .exempt
77+ @open_id .loginhandler
78+ def login2_handler ():
79+ if authentication .is_authenticated (flask .session ):
80+ return flask .redirect (open_id .get_next_url ())
81+
82+ try :
83+ root = authentication .request_macaroon ()
84+ except ApiResponseError as api_response_error :
85+ if api_response_error .status_code == 401 :
86+ return flask .redirect (flask .url_for (".logout" ))
87+ else :
88+ return flask .abort (502 , str (api_response_error ))
89+
90+ openid_macaroon = MacaroonRequest (
91+ caveat_id = authentication .get_caveat_id (root )
92+ )
93+ flask .session ["macaroon_root" ] = root
94+
95+ lp_teams = TeamsRequest (query_membership = [LP_CANONICAL_TEAM ])
96+
97+ return f"<h1>OK</h1><p>openid_macaroon: { openid_macaroon } </p><p>lp_teams: { lp_teams } </p>"
98+
99+
100+
75101@open_id .after_login
76102def after_login (resp ):
77103 flask .session ["macaroon_discharge" ] = resp .extensions ["macaroon" ].discharge
You can’t perform that action at this time.
0 commit comments