Skip to content

Commit

Permalink
Added sso failure log
Browse files Browse the repository at this point in the history
  • Loading branch information
samhotep committed Jul 4, 2023
1 parent 0ef4d19 commit c1da2b2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions webapp/login/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
import datetime

from talisker import logging

import flask
from canonicalwebteam.candid import CandidClient
from canonicalwebteam.store_api.stores.snapstore import (
Expand All @@ -19,6 +21,8 @@
from webapp.login.macaroon import MacaroonRequest, MacaroonResponse
from webapp.publisher.snaps import logic

TALISKER_WSGI_LOGGER = logging.getLogger("talisker.wsgi")

login = flask.Blueprint(
"login", __name__, template_folder="/templates", static_folder="/static"
)
Expand Down Expand Up @@ -48,6 +52,12 @@ def login_handler():
try:
root = authentication.request_macaroon()
except ApiResponseError as api_response_error:

TALISKER_WSGI_LOGGER.error(
"Error requesting macaroon: %s",
api_response_error
)

if api_response_error.status_code == 401:
return flask.redirect(flask.url_for(".logout"))
else:
Expand Down

0 comments on commit c1da2b2

Please sign in to comment.