accessing cas.properties from Thymeleaf

565 views
Skip to first unread message

Jozef Kotlar - EEA.sk

unread,
Jan 31, 2017, 11:04:53 AM1/31/17
to CAS Community
Hello,

In CAS version 4.2.x I was able to make URL in logo configurable using 

  <header>
    <spring:eval expression="@casProperties.getProperty('cas.logo.url', 'http://www.apereo.org')" var="customHeaderLink" />
    <a id="logo" href="<c:url value="${customHeaderLink}" />" title="<spring:message code="logo.title" />">CAS</a>
    <h1>Central Authentication Service (CAS)</h1>
  </header>

For CAS 5.0.x I am not able to repeat it as casProperties bean is not available. Are there some possibilities to access properties from cas.properties/application.yml?

<header>
    <a id="logo" th:href="${@casProperties.getProperty('cas.logo.url', 'http://www.apereo.org')}" th:title="#{logo.title}">Apereo</a>
    <h1>Central Authentication Service (CAS)</h1>
</header>


Thanks,
Jozef

Ben Howell-Thomas

unread,
Feb 1, 2017, 5:44:14 AM2/1/17
to cas-...@apereo.org
Couldn't you just put it in the messages.properties file and access it like the title eg "#{logo.file}"?

--
- CAS gitter chatroom: https://gitter.im/apereo/cas
- CAS mailing list guidelines: https://apereo.github.io/cas/Mailing-Lists.html
- CAS documentation website: https://apereo.github.io/cas
- CAS project website: https://github.com/apereo/cas
---
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+unsubscribe@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/c6c206cb-bc30-431a-8ca6-bab6525ba6a4%40apereo.org.


This email is sent on behalf of Northgate Public Services (UK) Limited and its associated companies including Rave Technologies (India) Pvt Limited (together "Northgate Public Services") and is strictly confidential and intended solely for the addressee(s). 
If you are not the intended recipient of this email you must: (i) not disclose, copy or distribute its contents to any other person nor use its contents in any way or you may be acting unlawfully;  (ii) contact Northgate Public Services immediately on +44(0)1908 264500 quoting the name of the sender and the addressee then delete it from your system.
Northgate Public Services has taken reasonable precautions to ensure that no viruses are contained in this email, but does not accept any responsibility once this email has been transmitted.  You should scan attachments (if any) for viruses.

Northgate Public Services (UK) Limited, registered in England and Wales under number 00968498 with a registered address of Peoplebuilding 2, Peoplebuilding Estate, Maylands Avenue, Hemel Hempstead, Hertfordshire, HP2 4NN.  Rave Technologies (India) Pvt Limited, registered in India under number 117068 with a registered address of 2nd Floor, Ballard House, Adi Marzban Marg, Ballard Estate, Mumbai, Maharashtra, India, 400001.

Jozef Kotlar - EEA.sk

unread,
Feb 2, 2017, 4:23:33 AM2/2/17
to CAS Community
That way I cannot distinguish between prod/dev/fix environments without modifying the application self.
Actually I am able to put that text to theme.properties, but still it is too constraining.

Jozef

Ben Howell-Thomas

unread,
Feb 3, 2017, 6:09:03 AM2/3/17
to cas-...@apereo.org
You could maybe get it from an environment variable and set that per environment eg http://stackoverflow.com/questions/23711541/get-spring-application-environment-in-thymeleaf

If that doesn't work another way to get it would be to write a custom bean under org.apereo.cas.web.flow that got the environment variable in Java, but that's a bit more work.

--
- CAS gitter chatroom: https://gitter.im/apereo/cas
- CAS mailing list guidelines: https://apereo.github.io/cas/Mailing-Lists.html
- CAS documentation website: https://apereo.github.io/cas
- CAS project website: https://github.com/apereo/cas
---
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+unsubscribe@apereo.org.

Jozef Kotlar - EEA.sk

unread,
Feb 10, 2017, 5:02:02 AM2/10/17
to CAS Community
Thanks,
I will try to write bean for that.

Jozef.
Reply all
Reply to author
Forward
0 new messages