use of org.springframework.web.servlet.theme.CookieThemeResolver in project cas by apereo.
the class CasThemesConfiguration method themeResolver.
@ConditionalOnMissingBean(name = "themeResolver")
@Bean
public ThemeResolver themeResolver() {
final String defaultThemeName = casProperties.getTheme().getDefaultThemeName();
final FixedThemeResolver fixedResolver = new FixedThemeResolver();
fixedResolver.setDefaultThemeName(defaultThemeName);
final SessionThemeResolver sessionThemeResolver = new SessionThemeResolver();
sessionThemeResolver.setDefaultThemeName(defaultThemeName);
final TicketGrantingCookieProperties tgc = casProperties.getTgc();
final CookieThemeResolver cookieThemeResolver = new CookieThemeResolver();
cookieThemeResolver.setDefaultThemeName(defaultThemeName);
cookieThemeResolver.setCookieDomain(tgc.getDomain());
cookieThemeResolver.setCookieHttpOnly(tgc.isHttpOnly());
cookieThemeResolver.setCookieMaxAge(tgc.getMaxAge());
cookieThemeResolver.setCookiePath(tgc.getPath());
cookieThemeResolver.setCookieSecure(tgc.isSecure());
final RegisteredServiceThemeResolver serviceThemeResolver = new RegisteredServiceThemeResolver(servicesManager, serviceThemeResolverSupportedBrowsers(), authenticationRequestServiceSelectionStrategies, this.resourceLoader, new CasConfigurationProperties());
serviceThemeResolver.setDefaultThemeName(defaultThemeName);
final RequestHeaderThemeResolver header = new RequestHeaderThemeResolver();
header.setDefaultThemeName(defaultThemeName);
final ChainingThemeResolver chainingThemeResolver = new ChainingThemeResolver();
chainingThemeResolver.addResolver(cookieThemeResolver).addResolver(sessionThemeResolver).addResolver(header).addResolver(serviceThemeResolver).addResolver(fixedResolver);
chainingThemeResolver.setDefaultThemeName(defaultThemeName);
return chainingThemeResolver;
}
Aggregations