cklein05 commented on pull request #428:
URL: https://github.com/apache/tomcat/pull/428#issuecomment-918144068


   Inspired by Rémy's suggestion (@rmaucher), I've added support for arbitrary 
extra attributes to the `User` object used with the `UserDatabase`. Now, these 
can also be queried by the `UserDatabaseRealm`. While doing so, I stumbled over 
this:
   
   1. The `User`'s `fullName` property is loaded from either the `fullName` or 
the `fullname` XML attribute. However, when writing back to XML in 
`MemoryUser.toXML()`, this property is always written to the `fullName` XML 
attribute. Seems like `fullname` is just an _undocumented_ alias to `fullName`. 
However, in `tomcat-users.xsd`, there is only attribute `fullname` defined. 
That's a bit confusing and I actually don't know, which of the two XML 
attributes is the "official" one or the "correct" one.
   
   2. What is the exact purpose of `tomcat-users.xsd`? The Tomcat (aka the 
UserDatabase) does not use this XML schema for validation (and I did not find 
an option to enable XML validation for the user database). Is it correct, that 
this schema definition file is intended to assist users editing 
`tomcat-users.xml` in their XML editor only?
   
   With my current _arbitrary attributes_ implementation, one can just add any 
extra attributes to the `<user username="...` entry. Every unknown attribute 
(those not named `username`, `fullName`, `password`, etc). ends up in the 
`User`'s attributes. However, I'm not able to figure out how to add these 
_generic_ extra attributes to the schema file along with the already defined 
ones (if that's even possible). On the other hand, if the schema file is 
intended for local file editing only, users could just add their extra 
attributes to the XSD file as well, just to make their editor happy (if they 
don't, they must live with validation errors in the editor).
   
   Using nested `<userAttribute name="my_attribute" value="123" />` entries 
inside a `<user ...>` entry may be more XSD-friendly. However, that way it is 
much more complex to implement.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to