[keycloak-user] Custom user attribute documentation correct?

Jason Axley jaxley at expedia.com
Wed Feb 24 00:08:34 EST 2016


2 seconds after I found that there were custom attribute template examples in examples/themes that gave me the nuance that is missing or lost on me in the documentation.

You need to use the format “user.attributes.mobile” everywhere except when rendering the value from the model.  There you use ${account.attributes.mobile} for the interpolation.  Any chance those could match and both be account.attributes.<blah> rather than be different?


        <div class="form-group ${messagesPerField.printIfExists('user.attributes.mobile','has-error')}">

            <div class="col-sm-2 col-md-2">

                <label for="user.attributes.mobile" class="control-label">${msg("mobile")}</label> <span class="required">*</span>

            </div>


            <div class="col-sm-10 col-md-10">

                <input type="text" class="form-control" id="user.attributes.mobile" name="user.attributes.mobile" value="${(account.attributes.mobile!'')?html}"/>

            </div>

        </div>

-Jason

From: <keycloak-user-bounces at lists.jboss.org<mailto:keycloak-user-bounces at lists.jboss.org>> on behalf of Jason Axley <jaxley at expedia.com<mailto:jaxley at expedia.com>>
Date: Tuesday, February 23, 2016 at 9:02 PM
To: "keycloak-user at lists.jboss.org<mailto:keycloak-user at lists.jboss.org>" <keycloak-user at lists.jboss.org<mailto:keycloak-user at lists.jboss.org>>
Subject: [keycloak-user] Custom user attribute documentation correct?

Is the documentation here accurate for v1.9.0-Final? http://keycloak.github.io/docs/userguide/keycloak-server/html/custom-user-attributes.html#d4e3678  It says (for the user account profile pages, for example) that attributes must be of the form like “user.attributes.mobile” but if you do this, Freemarker can’t render the template.  I can render it if I use “account.mobile”, however it’s not displaying the data that is definitely there on the user profile (I can see it as an administrator on the Attributes tab).


        <div class="form-group ${messagesPerField.printIfExists('account.mobile','has-error')}">

            <div class="col-sm-2 col-md-2">

                <label for="account.mobile" class="control-label">${msg("mobile")}</label> <span class="required">*</span>

            </div>


            <div class="col-sm-10 col-md-10">

                <input type="text" class="form-control" id="account.mobile" name="account.mobile" value="${(account.mobile!'')?html}"/>

            </div>

        </div>

-Jason

Jason Axley
Sr. Security Engineer, Expedia Worldwide Engineering Team
425-679-4157 (o) | 206-484-2778 (m) | 206-55-AXLEY (gv)
333 108th Ave NE, 9S-282, Bellevue, WA 98004
EWE Security Wiki<https://confluence/display/POS/EWE+Security>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20160224/e766efcf/attachment.html 


More information about the keycloak-user mailing list