8000 Allow customization of FlaskAuthomatic's adapter by touilleMan · Pull Request #139 · authomatic/authomatic · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@touilleMan
Copy link
Contributor

Hi there !

Following the issue #100, I've realized the most elegant way to do custom redirection is to hack the Adapter class. The only trouble is this is not possible with FlaskAuthomatic... so here is this PR !

example:

# Typical need when going through a reverse proxy
class CustomUrlAdapter(WerkzeugAdapter):
    @property
    def url(self):
        return current_app.config['AUTHOMATIC_REDIRECT_URL']

# See my trouble with Heroku in issue #100 about this one
class ForceHttpsAdapter(WerkzeugAdapter):
    @property
    def url(self):
        import re
        return re.sub(r'^http://', 'https://', self.request.base_url)

fa = FlaskAuthomatic(
    config=AUTHOMATIC,
    secret=app.config['SECRET_KEY'],
    adapter_cls=CustomUrlAdapter
)

Maybe it should be interesting to add a word about this in the documentation, what do you think ?

@ivan-c
Copy link
ivan-c commented Sep 22, 2017

I was able to get authomatic working behind an SSL proxy by using werkzeug.contrib.fixers.ProxyFix and adding X-Forwarded-Proto: "https" to my reverse proxy (Apache).

Does Heroku not pass the X-Forwarded-Proto header?

@mrichar1
Copy link
Member

After several years of inactivity, authomatic is now under community management, and we have just released a new stable version (1.0.0).

We are now reviewing all issues and PRs and hoping to begin work to solve as many of these as possible.

We are keen to find out which issues still apply, and which PRs are still required/are likely to merge cleanly into the current code. We are aiming to review them all, but any help with prioritisation would be very useful!

If you are still interested in having this issue/PR resolved, or are able to help us work on it, please reply to this message. That way we know which issues are most important to the community.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0