Allow creating property file auth providers from a Buffer - #758
Open
jnbdz wants to merge 1 commit into
Open
Conversation
The property file authentication and authorization providers could only be created from a file system path, read by the provider itself. This prevents loading the content from the classpath, a remote location or preprocessing it, e.g. to resolve environment variable references. Add create overloads taking the property file content as a Buffer, so callers stay in control of how the content is loaded. Fixes eclipse-vertx#728
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The property file authentication/authorization providers can only be created from a file system path, and the provider reads that path itself. As described in #728, this prevents loading the content from anywhere else — the classpath inside a fat jar, a remote location — or preprocessing it before parsing (Apache Camel wants to resolve environment variable references in the file, e.g.
user.admin=${ADMIN_PASSWORD}).This adds
create(Vertx, Buffer)overloads to bothPropertyFileAuthenticationandPropertyFileAuthorization, taking the property file content directly:The issue suggested
InputStream, but aBufferfelt more idiomatic for Vert.x (@VertxGen-friendly, non-blocking, and it is whatFileSystem.readFilereturns) while solving the same problem: the caller stays in control of how the content is loaded. The existing path-based overloads are unchanged; parsing is shared between both paths. For the buffer variant, the authorization provider id (previously the path) is the constantproperties.Includes tests and documentation.
Fixes #728