Display expiration date in expiring password template

shibboleth655 at lewenberg.com shibboleth655 at lewenberg.com
Fri Jan 26 13:32:49 EST 2018



On 1/25/2018 2:15 PM, Cantor, Scott wrote:
> On 1/25/18, 11:46 AM, "users on behalf of shibboleth655 at lewenberg.com" <users-bounces at shibboleth.net on behalf of shibboleth655 at lewenberg.com> wrote:
> 
>>   I would like to display the value of the "passwordExpiration" in the
>> password expiring view expiring-password.vm. How do I do that?
> 
> I imagine there are other ways, but the way I do it is by injecting a JodaTime object as a custom view context bean so I can access it in the view and use it to parse the string that I happen to know is in my expiration attribute so I can turn it into a DateTime and then I can turn that into a formatted string in the view.
> 
> My shibboleth.CustomViewContext bean in global.xml is a map and one of the slots is this bean:
> 
>      <bean id="osu.passwordExpParser"
>          class="org.joda.time.format.DateTimeFormat"
>          factory-method="forPattern" c:_0="yyyyMMddHHmmss'Z'" />
> 
> It's probably a common enough need that I could add something to the flow/view to do this slightly more conveniently by predefining some of it. Nobody's asked.


That gives me an org.joda.time.format.DateTimeFormat object in the 
velocity template. But how do I access the attribute string which is the 
expiration attribute? For example, if the attribute is called 
"passwordExpiration" how do I simply display that string?

Or, more generally, if I know there is some attribute called "foo", how 
can I display that attribute in a Velocity template?


> 
> -- Scott
> 
> 



More information about the users mailing list