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

Add trusted origins feature #117

Merged
merged 7 commits into from
Jul 20, 2019
Merged

Add trusted origins feature #117

merged 7 commits into from
Jul 20, 2019

Conversation

fjorgemota
Copy link
Contributor

@fjorgemota fjorgemota commented Jul 15, 2019

Closes #116

I added tests and I accept feedbacks on the API. I throught about accepting a []string on the added option but we would need to return an error in the case of a URL being invalid, for example.

EDIT: Now the API is more Django-like, accepting []string as a list of trusted hosts to check.

csrf.go Show resolved Hide resolved
csrf.go Show resolved Hide resolved
@fjorgemota fjorgemota mentioned this pull request Jul 15, 2019
Instead of accepting []*url.URL, which can cause weird problems, now TrustedOrigins accept []string, which is the list of hosts accepted by the middleware...So the schema doesn't matter anymore and it's more friendly to use.
Copy link
Contributor

@elithrar elithrar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to flesh out the docs a little more.

csrf_test.go Outdated Show resolved Hide resolved
options.go Outdated Show resolved Hide resolved
@fjorgemota
Copy link
Contributor Author

Fixed. Thanks for the feedback. :)

What do you think?

@fjorgemota
Copy link
Contributor Author

Hey.

Sorry for bothering but...do you have any additional feedback, @elithrar? :)

Thanks.

@elithrar
Copy link
Contributor

elithrar commented Jul 18, 2019 via email

@fjorgemota
Copy link
Contributor Author

Oh. Ok! I'll wait and continue to using my fork with this patch on my project, meanwhile.

Have a nice trip. :)

@elithrar
Copy link
Contributor

Thanks for bearing with me & resolving the outstanding comments - merged!

@elithrar elithrar merged commit 5050f9c into gorilla:master Jul 20, 2019
@fjorgemota
Copy link
Contributor Author

Nice, thank you for accepting the PR! Good luck with the project and keep the nice work. ;)

@fjorgemota fjorgemota deleted the trusted-origins branch July 21, 2019 21:16
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.

Trusted Origins
3 participants