This repository has been archived by the owner on Jan 24, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add secure middleware to enable more header options #618
Open
timothy-spencer
wants to merge
17
commits into
bitly:master
Choose a base branch
from
timothy-spencer:addsecureoptions
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 12 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
7e618fa
added https://github.com/unrolled/secure to proxy
timothy-spencer a51f1da
make tests, move secure middleware to NewOAuthProxy
timothy-spencer 60b211e
make test name more descriptive
timothy-spencer 4513f35
cleanup some extra whitespace
timothy-spencer f150841
try a different way of registering handler
timothy-spencer 27a4c9a
wrap the middleware outside of the constructor
timothy-spencer d3df255
forgot to add the lib to main
timothy-spencer 5b171a5
made sure calls to the original proxy work
timothy-spencer 9e0b585
make sure that dep ensure works
timothy-spencer 1748723
formatted to make gofmt happy
timothy-spencer d71bc76
turn on -x to see why test.sh is failing in travis
timothy-spencer 6aa4c50
don't need -x
timothy-spencer 8926159
updated tests with roger's help
timothy-spencer 0dcf222
fixed gofmt stuff
timothy-spencer 041466f
added an end to end test for the secure proxy
timothy-spencer a86773d
move options validation back
timothy-spencer 5f186f5
rename Create
timothy-spencer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this tests a third-party package but doesn't really test the behavior of this package. What kinds of regressions would this test catch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, other tests further up in the file test the proxy. This tests that the middleware is functioning on top of the proxy. I definitely don't have 100% coverage here. I only am testing one of the secure middleware options, for example. More tests certainly could be written!
These were sufficient for me to verify that the proxy with middleware worked for our purposes, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this tests any of the code you added. As far as I can tell, the test imports a third-party package, instantiates its middleware, and verifies that the middleware behaves as expected. It doesn't really exercise the code you added, or any of the code in this package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's how main() does it too. Remember how you told me to wrap the middleware outside of NewOAuthProxy? This is the result. As far as I can see, this is the only way I can actually do this sort of thing. As a golang neophyte, I welcome being proven wrong.