Skip to content

Fails to set a global route auth config#2940

Merged
hueniverse merged 2 commits intohapijs:masterfrom
giovannicalo:master
Nov 21, 2015
Merged

Fails to set a global route auth config#2940
hueniverse merged 2 commits intohapijs:masterfrom
giovannicalo:master

Conversation

@giovannicalo
Copy link
Copy Markdown
Contributor

After the recent special routes changes, a server configured to use an authentication strategy by default for all routes...

const server = new Hapi.Server({ connections: { routes: { auth: "foo" } });
server.connection(...);
...
server.auth.strategy("foo", ..., ...);

... would fail to start and instead throw an error.

Unknown authentication strategy: foo in path: /{p*}

I also doubt the special routes are supposed to require authentication in the first place, as they didn't till the aforementioned commit.

This fixes it.

However, it might be better to just ignore authentication-related options for routes where method === "_special", instead of passing config: { auth: false } every time.

@gergoerdosi
Copy link
Copy Markdown
Contributor

Can you add a test that fails without your changes and passes with them?

@hueniverse hueniverse changed the title Fixed an issue where special routes would attempt to validate authentication if set globally Fails to set a global route auth config Nov 21, 2015
@hueniverse hueniverse added the bug Bug or defect label Nov 21, 2015
@hueniverse hueniverse added this to the 11.1.2 milestone Nov 21, 2015
@hueniverse hueniverse self-assigned this Nov 21, 2015
hueniverse added a commit that referenced this pull request Nov 21, 2015
Fails to set a global route auth config
@hueniverse hueniverse merged commit a17d1bf into hapijs:master Nov 21, 2015
hueniverse added a commit that referenced this pull request Nov 21, 2015
@lock
Copy link
Copy Markdown

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Bug or defect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants