cklein05 commented on a change in pull request #463:
URL: https://github.com/apache/tomcat/pull/463#discussion_r783661408



##########
File path: java/org/apache/catalina/TomcatPrincipal.java
##########
@@ -47,4 +48,37 @@
      *                   exception to LoginContext
      */
     void logout() throws Exception;
+
+    /**
+     * Returns the value of the named attribute as an <code>Object</code>, or
+     * <code>null</code> if no attribute of the given name exists, or if
+     * <code>null</code> has been specified as the attribute's name.
+     * <p>
+     * Only the servlet container may set attributes to make available custom
+     * information about a Principal or the user it represents. For example, 
some of
+     * the Realm implementations can be configured to additionally query user
+     * attributes from the <i>user database</i>, which then are provided 
through the
+     * Principal's attributes map.
+     * <p>
+     * Attribute names and naming conventions are maintained by the Tomcat
+     * components that contribute to this map, like some of the Realm
+     * implementations.

Review comment:
       In other words, when querying an attribute named "displayName", a Realm 
could add this under a key like "realm.displayName" or "user.displayName". For 
that, the (maybe custom) Realm may have a config option `userAttributePrefix` 
or this could even be hard-coded.
   
   Such prefixes might make sense, if, in the future, for example, several 
components could contribute to the Principal's attributes (like the 
Authenticator or a new component `SocialUserDataProvider` querying user 
information from Facebook etc.).




-- 
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