Search in sources :

Example 1 with TicketGrantingCookieProperties

use of org.apereo.cas.configuration.model.support.cookie.TicketGrantingCookieProperties 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;
}
Also used : ChainingThemeResolver(org.apereo.cas.services.web.ChainingThemeResolver) FixedThemeResolver(org.springframework.web.servlet.theme.FixedThemeResolver) RequestHeaderThemeResolver(org.apereo.cas.services.web.RequestHeaderThemeResolver) CasConfigurationProperties(org.apereo.cas.configuration.CasConfigurationProperties) RegisteredServiceThemeResolver(org.apereo.cas.services.web.RegisteredServiceThemeResolver) TicketGrantingCookieProperties(org.apereo.cas.configuration.model.support.cookie.TicketGrantingCookieProperties) CookieThemeResolver(org.springframework.web.servlet.theme.CookieThemeResolver) SessionThemeResolver(org.springframework.web.servlet.theme.SessionThemeResolver) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with TicketGrantingCookieProperties

use of org.apereo.cas.configuration.model.support.cookie.TicketGrantingCookieProperties in project cas by apereo.

the class CasCookieConfiguration method ticketGrantingTicketCookieGenerator.

@Autowired
@Bean
@RefreshScope
public CookieRetrievingCookieGenerator ticketGrantingTicketCookieGenerator(@Qualifier("cookieCipherExecutor") final CipherExecutor cipherExecutor) {
    final TicketGrantingCookieProperties tgc = casProperties.getTgc();
    final int rememberMeMaxAge = Long.valueOf(tgc.getRememberMeMaxAge()).intValue();
    return new TGCCookieRetrievingCookieGenerator(cookieValueManager(cipherExecutor), tgc.getName(), tgc.getPath(), tgc.getDomain(), rememberMeMaxAge, tgc.isSecure(), tgc.getMaxAge());
}
Also used : TGCCookieRetrievingCookieGenerator(org.apereo.cas.web.support.TGCCookieRetrievingCookieGenerator) TicketGrantingCookieProperties(org.apereo.cas.configuration.model.support.cookie.TicketGrantingCookieProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Autowired(org.springframework.beans.factory.annotation.Autowired) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 3 with TicketGrantingCookieProperties

use of org.apereo.cas.configuration.model.support.cookie.TicketGrantingCookieProperties in project cas by apereo.

the class CasCookieConfiguration method ticketGrantingTicketCookieGenerator.

@Bean
@RefreshScope
public CookieRetrievingCookieGenerator ticketGrantingTicketCookieGenerator() {
    final TicketGrantingCookieProperties tgc = casProperties.getTgc();
    final int rememberMeMaxAge = (int) Beans.newDuration(tgc.getRememberMeMaxAge()).getSeconds();
    return new TGCCookieRetrievingCookieGenerator(cookieValueManager(), tgc.getName(), tgc.getPath(), tgc.getDomain(), rememberMeMaxAge, tgc.isSecure(), tgc.getMaxAge(), tgc.isHttpOnly());
}
Also used : TGCCookieRetrievingCookieGenerator(org.apereo.cas.web.support.TGCCookieRetrievingCookieGenerator) TicketGrantingCookieProperties(org.apereo.cas.configuration.model.support.cookie.TicketGrantingCookieProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

TicketGrantingCookieProperties (org.apereo.cas.configuration.model.support.cookie.TicketGrantingCookieProperties)3 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)3 Bean (org.springframework.context.annotation.Bean)3 TGCCookieRetrievingCookieGenerator (org.apereo.cas.web.support.TGCCookieRetrievingCookieGenerator)2 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)2 CasConfigurationProperties (org.apereo.cas.configuration.CasConfigurationProperties)1 ChainingThemeResolver (org.apereo.cas.services.web.ChainingThemeResolver)1 RegisteredServiceThemeResolver (org.apereo.cas.services.web.RegisteredServiceThemeResolver)1 RequestHeaderThemeResolver (org.apereo.cas.services.web.RequestHeaderThemeResolver)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 CookieThemeResolver (org.springframework.web.servlet.theme.CookieThemeResolver)1 FixedThemeResolver (org.springframework.web.servlet.theme.FixedThemeResolver)1 SessionThemeResolver (org.springframework.web.servlet.theme.SessionThemeResolver)1