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

Prevent asking users to authenticate twice #350

Merged
merged 1 commit into from
Jan 25, 2017
Merged

Conversation

tijmenb
Copy link
Contributor

@tijmenb tijmenb commented Jan 25, 2017

This solves the problem with prototypes asking for username/password twice.

The problem is caused by the ordering in the middleware. When a user types in the URL for a prototype like http://govuk-tagging.herokuapp.com they're asked for a username/password first (via utils.basicAuth).

After filling that in they'll be able to "proceed" to the next step, which redirects them to the https:// version (via utils.forceHttps). Because the auth isn't shared between http and https version, they are not authenticated anymore and have to enter their username/password again.

Validated with http://test-prevent-double-auth.herokuapp.com/

Before

 @tijmenb ~/govuk/govuk_prototype_kit on prevent-double-auth $ curl -I http://govuk-tagging.herokuapp.com/
HTTP/1.1 401 Unauthorized

After

 @tijmenb ~/govuk/govuk_prototype_kit on prevent-double-auth $ curl -I http://test-prevent-double-auth.herokuapp.com/
HTTP/1.1 302 Found
Location: https://test-prevent-double-auth.herokuapp.com/

This solves the problem with prototypes asking for username/password
twice.

The problem is caused by the ordering in the middleware.

When a user types in the URL for a prototype like
http://govuk-tagging.herokuapp.com they're asked for a
username/password first (via `utils.basicAuth`).

After filling that in they'll be able to "proceed" to the next step,
which redirects them to the `https://` version (via
`utils.forceHttps`).

Because the auth isn't shared between `http` and `https` version, they
are not authenticated anymore and have to enter their username/password
again.

Validated with https://test-prevent-double-auth.herokuapp.com/
@joelanman joelanman merged commit 444c439 into master Jan 25, 2017
@joelanman
Copy link
Contributor

thanks @tijmenb !

@joelanman joelanman deleted the prevent-double-auth branch January 25, 2017 16:49
@joelanman joelanman mentioned this pull request Jan 25, 2017
rpowis pushed a commit to hmrc/govuk_prototype_kit that referenced this pull request Jan 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants