【问题标题】:CAS switch the themes based on different servicesCAS根据不同服务切换主题
【发布时间】:2020-05-28 01:15:18
【问题描述】:

尝试基于服务配置自定义主题在 CAS 6.2.0 中是一项艰巨的任务。我们使用 car-overlay-template (https://github.com/apereo/cas-overlay-template) 来配置和构建项目。

文档非常清楚地将主题放在哪里以及在 cas.properties 文件中使用哪些属性:https://apereo.github.io/cas/development/ux/User-Interface-Customization-Views.html

指定模板位置的属性值设置为:

#spring.thymeleaf.encoding=UTF-8
#spring.thymeleaf.prefix=file:///etc/cas/templates/
cas.view.templatePrefixes=file:///etc/cas/templates/

并且我在服务配置中指定的上述模板目录中有适当的目录,但我继续收到错误:

2020-04-19 06:35:06,268 WARN [org.apereo.cas.services.web.RegisteredServiceThemeResolver] - <Custom theme [foobar] for service [AbstractRegisteredService(serviceId=^(https|imaps)://.*, name=HTTPS and IMAPS, theme=epc, informationUrl=null, privacyUrl=null, responseType=null, id=10000001, description=This service definition authorizes all application urls that support HTTPS and IMAPS protocols., expirationPolicy=DefaultRegisteredServiceExpirationPolicy(deleteWhenExpired=false, notifyWhenDeleted=false, notifyWhenExpired=false, expirationDate=null), acceptableUsagePolicy=DefaultRegisteredServiceAcceptableUsagePolicy(enabled=true, messageCode=null, text=null), proxyPolicy=org.apereo.cas.services.RefuseRegisteredServiceProxyPolicy@1, proxyTicketExpirationPolicy=null, proxyGrantingTicketExpirationPolicy=null, serviceTicketExpirationPolicy=null, singleSignOnParticipationPolicy=null, evaluationOrder=10000, usernameAttributeProvider=org.apereo.cas.services.DefaultRegisteredServiceUsernameProvider@87297e2, logoutType=BACK_CHANNEL, environments=[], attributeReleasePolicy=ReturnAllowedAttributeReleasePolicy(super=AbstractRegisteredServiceAttributeReleasePolicy(attributeFilter=null, principalAttributesRepository=DefaultPrincipalAttributesRepository(), consentPolicy=DefaultRegisteredServiceConsentPolicy(enabled=true, excludedAttributes=null, includeOnlyAttributes=null, order=0), authorizedToReleaseCredentialPassword=false, authorizedToReleaseProxyGrantingTicket=false, excludeDefaultAttributes=false, authorizedToReleaseAuthenticationAttributes=true, principalIdAttribute=null, order=0), allowedAttributes=[]), multifactorPolicy=DefaultRegisteredServiceMultifactorPolicy(multifactorAuthenticationProviders=[], failureMode=UNDEFINED, principalAttributeNameTrigger=null, principalAttributeValueToMatch=null, bypassEnabled=false, forceExecution=false, bypassTrustedDeviceEnabled=false, bypassPrincipalAttributeName=null, bypassPrincipalAttributeValue=null, script=null), logo=null, logoutUrl=null, redirectUrl=null, accessStrategy=DefaultRegisteredServiceAccessStrategy(order=0, enabled=true, ssoEnabled=true, unauthorizedRedirectUrl=null, delegatedAuthenticationPolicy=DefaultRegisteredServiceDelegatedAuthenticationPolicy(allowedProviders=[], permitUndefined=true, exclusive=false), requireAllAttributes=true, requiredAttributes={}, rejectedAttributes={}, caseInsensitive=false), publicKey=null, authenticationPolicy=DefaultRegisteredServiceAuthenticationPolicy(requiredAuthenticationHandlers=[], criteria=null), properties={}, contacts=[])] cannot be located. Falling back to default theme...>

文档中没有任何地方提到主题/文件名或格式的目录结构。我知道该项目正在使用 Thymeleaf,但我们仍然需要文件名,我想更好地了解如何设置主题路径以便 CAS 可以找到主题。

如果您有任何运气配置它,如果您分享我们缺少的配置部分,那就太好了。

【问题讨论】:

    标签: cas


    【解决方案1】:

    经过大量测试和配置,我终于让它按我预期的那样工作。我已经把一个小项目放在一起,以防其他人遇到这个问题并需要一个快速教程。您可以在以下位置查看该项目:https://github.com/dannymk/cas-dynamic-style

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-31
      • 2021-04-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多