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

Fix handling of auth scheme/strategy realms #4281

Merged
merged 2 commits into from
Sep 14, 2021
Merged

Fix handling of auth scheme/strategy realms #4281

merged 2 commits into from
Sep 14, 2021

Conversation

devinivy
Copy link
Member

@devinivy devinivy commented Sep 5, 2021

We were seeing some hard-to-explain behavior in #4218 as it relates to the realm of the server inside of auth schemes. In short, each time server is cloned, all servers were being mutated such that server.auth.strategy was bound to the server of the most recent clone.

Cloning is the process by which hapi creates independent realms for a. each plugin and b. each auth strategy. When server is cloned, the clone's realm.parent is assigned to server.realm. Due to the mutation of a shared interface during each clone, the server.realm within an auth strategy had a strange/unpredictable chain of ancestor realms. This work tidies that up by no longer mutating the shared auth on each clone, instead creating a new public auth interface for each one.

Resolves #4218.

@devinivy devinivy added bug Bug or defect documentation Non-code related changes labels Sep 5, 2021
lib/auth.js Outdated Show resolved Hide resolved
test/auth.js Show resolved Hide resolved
@jonathansamines
Copy link
Contributor

Thanks for taking care of this issue @devinivy!

@devinivy devinivy merged commit e639788 into master Sep 14, 2021
@devinivy devinivy deleted the fix-auth-realm branch September 14, 2021 01:40
@devinivy devinivy added this to the 20.2.0 milestone Sep 14, 2021
@devinivy devinivy self-assigned this Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug or defect documentation Non-code related changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Realms and authentication strategies
3 participants