Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow customization of FlaskAuthomatic's adapter #139

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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.

@jensens jensens added this to Todo: Low Priority in Issue-Management Jun 9, 2023
@jensens jensens moved this from Todo: Low Priority to New: Needs Check in Issue-Management Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Issue-Management
  
New: Needs Check
Development

Successfully merging this pull request may close these issues.

None yet

3 participants