{"action":"created","issue":{"url":"https://api.github.com/repos/cameronbwhite/Flask-CAS/issues/17","labels_url":"https://api.github.com/repos/cameronbwhite/Flask-CAS/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/cameronbwhite/Flask-CAS/issues/17/comments","events_url":"https://api.github.com/repos/cameronbwhite/Flask-CAS/issues/17/events","html_url":"https://github.com/cameronbwhite/Flask-CAS/pull/17","id":55089240,"number":17,"title":"redirect to session['CAS_AFTER_LOGIN_SESSION_URL'] if it exists instead","user":{"login":"renecunningham","id":367850,"avatar_url":"https://avatars.githubusercontent.com/u/367850?v=3","gravatar_id":"","url":"https://api.github.com/users/renecunningham","html_url":"https://github.com/renecunningham","followers_url":"https://api.github.com/users/renecunningham/followers","following_url":"https://api.github.com/users/renecunningham/following{/other_user}","gists_url":"https://api.github.com/users/renecunningham/gists{/gist_id}","starred_url":"https://api.github.com/users/renecunningham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/renecunningham/subscriptions","organizations_url":"https://api.github.com/users/renecunningham/orgs","repos_url":"https://api.github.com/users/renecunningham/repos","events_url":"https://api.github.com/users/renecunningham/events{/privacy}","received_events_url":"https://api.github.com/users/renecunningham/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-01-21T22:48:15Z","updated_at":"2015-01-25T22:00:19Z","closed_at":"2015-01-25T18:13:26Z","pull_request":{"url":"https://api.github.com/repos/cameronbwhite/Flask-CAS/pulls/17","html_url":"https://github.com/cameronbwhite/Flask-CAS/pull/17","diff_url":"https://github.com/cameronbwhite/Flask-CAS/pull/17.diff","patch_url":"https://github.com/cameronbwhite/Flask-CAS/pull/17.patch"},"body":"@cameronbwhite thanks for writing Flask-CAS. I was able to roll it into a flask app fairly easily.\r\n\r\nI needed to preserve the request.path once a client auth'd. In my login_required decorator, I decided to add to the clients session the URL prior to the /login redirection. \r\n\r\n```\r\n# my login_required decorator\r\ndef login_required(function):\r\n    @wraps(function)\r\n    def wrap(*args, **kwargs):\r\n        if 'CAS_USERNAME' in session:\r\n            cas_username = session['CAS_USERNAME']\r\n            if is_account_allowed(cas_username):\r\n                return function(*args, **kwargs)\r\n            else:\r\n                return redirect(url_for('denied'))\r\n        else:\r\n            session['CAS_AFTER_LOGIN_SESSION_URL'] = request.path\r\n            return redirect(url_for('cas.login', _external=True))\r\n    return wrap\r\n```\r\n\r\nWithin routing.py I attempt to access that session variable and if it exists, use it instead of CAS_AFTER_LOGIN.\r\n\r\nThis allowed me to preserve and redirect the URL the client requested instead of redirecting to the static URL that CAS_AFTER_LOGIN provides.\r\n\r\nThanks again!"},"comment":{"url":"https://api.github.com/repos/cameronbwhite/Flask-CAS/issues/comments/71395967","html_url":"https://github.com/cameronbwhite/Flask-CAS/pull/17#issuecomment-71395967","issue_url":"https://api.github.com/repos/cameronbwhite/Flask-CAS/issues/17","id":71395967,"user":{"login":"renecunningham","id":367850,"avatar_url":"https://avatars.githubusercontent.com/u/367850?v=3","gravatar_id":"","url":"https://api.github.com/users/renecunningham","html_url":"https://github.com/renecunningham","followers_url":"https://api.github.com/users/renecunningham/followers","following_url":"https://api.github.com/users/renecunningham/following{/other_user}","gists_url":"https://api.github.com/users/renecunningham/gists{/gist_id}","starred_url":"https://api.github.com/users/renecunningham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/renecunningham/subscriptions","organizations_url":"https://api.github.com/users/renecunningham/orgs","repos_url":"https://api.github.com/users/renecunningham/repos","events_url":"https://api.github.com/users/renecunningham/events{/privacy}","received_events_url":"https://api.github.com/users/renecunningham/received_events","type":"User","site_admin":false},"created_at":"2015-01-25T22:00:19Z","updated_at":"2015-01-25T22:00:19Z","body":"@cameronbwhite awesome, thanks!"}}