[cas-user] couchdb issues 6.4.4.2 or 6.5 RC4

9 views
Skip to first unread message

Matthew Gordon

unread,
Jan 12, 2022, 2:26:05 PM1/12/22
to CAS Community
Hello I am building CAS with the following:
support-ldap,support-git-service-registry,support-gauth,support-couchdb-core,support-gauth-couchdb,support-saml,support-saml-idp,support-oidc,support-couchdb-ticket-registry,support-surrogate-webflow,support-surrogate-authentication-couchdb,webapp

Connected to Active Directory as the LDAP.

Authentication works.

I regularly see this in the cas.log, and don't know if it is the underlying issue?:
2022-01-12 13:59:50,300 WARN [org.springframework.web.context.support.SpringBeanAutowiringSupport] - <Current WebApplicationContext is not available for processing of GoogleAuthenticatorCouchDbTokenRepository: Make sure this class gets constructed in a Spring web application after the Spring WebApplicationContext has been initialized. Proceeding without injection.>

I get this when I try to log out or if I disable single login in on a CAS service, and attempt to login to it with MFA enabled. Both cases generate:
org.springframework.webflow.execution.ActionExecutionException: Exception thrown executing org.apereo.cas.web.flow.login.CreateTicketGrantingTicketAction@26daf146 in state 'createTicketGrantingTicket' of flow 'login' -- action execution attributes were 'map[[empty]]'

It basically looks like it can't find the ST or MFA info in couchdb that it expects, so fail.

Also couchdb does not create any of the required design documents or views in the Databases it creates that generate other errors, if you don't create them from the code repo. More about that here: https://groups.google.com/a/apereo.org/g/cas-user/c/NjJsaQQXekY

Is this the best place to get help, or should I report issues somewhere else?

Is anyone successfully using couchdb in prod, for their ticket repo, mfa, or anything?

Thank you,
Matt


--
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
---
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+u...@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/b03afb42-8e05-46ea-9949-b213b7b91e25n%40apereo.org.

Matthew Gordon

unread,
Jan 12, 2022, 3:39:49 PM1/12/22
to CAS Community, Matthew Gordon
Full Stack:

org.springframework.webflow.execution.ActionExecutionException: Exception thrown executing org.apereo.cas.web.flow.logout.TerminateSessionAction@2e33cdba in state 'terminateSession' of flow 'logout' -- action execution attributes were 'map[[empty]]' at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:62) at org.springframework.webflow.action.EvaluateAction.doExecute(EvaluateAction.java:77) at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188) at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51) at org.springframework.webflow.engine.ActionState.doEnter(ActionState.java:101) at org.springframework.webflow.engine.State.enter(State.java:194) at org.springframework.webflow.engine.Flow.start(Flow.java:527) at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:368) at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:223) at org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(FlowExecutorImpl.java:139) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282) at org.springframework.cloud.context.scope.GenericScope$LockedScopedProxyFactoryBean.invoke(GenericScope.java:485) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) at com.sun.proxy.$Proxy351.launchExecution(Unknown Source) at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:264) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1064) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.apereo.cas.web.support.AuthenticationCredentialsThreadLocalBinderClearingFilter.doFilter(AuthenticationCredentialsThreadLocalBinderClearingFilter.java:28) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.apereo.cas.web.support.filters.RequestParameterPolicyEnforcementFilter.doFilter(RequestParameterPolicyEnforcementFilter.java:401) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.apereo.cas.web.support.filters.ResponseHeadersEnforcementFilter.doFilter(ResponseHeadersEnforcementFilter.java:200) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.apereo.cas.web.support.filters.AddResponseHeadersFilter.doFilter(AddResponseHeadersFilter.java:62) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:204) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:96) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.apereo.cas.logging.web.ThreadContextMDCServletFilter.doFilter(ThreadContextMDCServletFilter.java:99) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.apereo.inspektr.common.web.ClientInfoThreadLocalFilter.doFilter(ClientInfoThreadLocalFilter.java:66) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:126) at org.springframework.boot.web.servlet.support.ErrorPageFilter.access$000(ErrorPageFilter.java:64) at org.springframework.boot.web.servlet.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:101) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:119) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1707) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.base/java.lang.Thread.run(Thread.java:829) Caused by: org.ektorp.DocumentNotFoundException: nothing found on db path: /ticket_registry/ST-9--PuizaODkiWXDZYrvpC2Wq-9cXQ-CAST1, Response body: null at org.ektorp.http.StdResponseHandler.createDbAccessException(StdResponseHandler.java:40) at org.ektorp.http.StdResponseHandler.error(StdResponseHandler.java:91) at org.ektorp.http.RestTemplate.handleResponse(RestTemplate.java:126) at org.ektorp.http.RestTemplate.head(RestTemplate.java:109) at org.ektorp.impl.StdCouchDbConnector.getCurrentRevision(StdCouchDbConnector.java:328) at org.apereo.cas.couchdb.tickets.TicketRepository.getCurrentRevision(TicketRepository.java:47) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282) at org.springframework.cloud.context.scope.GenericScope$LockedScopedProxyFactoryBean.invoke(GenericScope.java:485) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:692) at org.apereo.cas.couchdb.tickets.TicketRepository$$EnhancerBySpringCGLIB$$cfd778ae.getCurrentRevision(<generated>) at org.apereo.cas.ticket.registry.CouchDbTicketRegistry.deleteSingleTicket(CouchDbTicketRegistry.java:40) at org.apereo.cas.ticket.registry.AbstractTicketRegistry.lambda$deleteChildren$2(AbstractTicketRegistry.java:195) at java.base/java.util.LinkedHashMap$LinkedKeySet.forEach(LinkedHashMap.java:559) at org.apereo.cas.ticket.registry.AbstractTicketRegistry.deleteChildren(AbstractTicketRegistry.java:194) at org.apereo.cas.ticket.registry.AbstractTicketRegistry.deleteTicket(AbstractTicketRegistry.java:134) at org.apereo.cas.ticket.registry.AbstractTicketRegistry.deleteTicket(AbstractTicketRegistry.java:125) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282) at org.springframework.cloud.context.scope.GenericScope$LockedScopedProxyFactoryBean.invoke(GenericScope.java:485) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) at com.sun.proxy.$Proxy140.deleteTicket(Unknown Source) at org.apereo.cas.AbstractCentralAuthenticationService.deleteTicket(AbstractCentralAuthenticationService.java:167) at org.apereo.cas.AbstractCentralAuthenticationService$$FastClassBySpringCGLIB$$ba3315a1.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:779) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:89) at org.apereo.inspektr.audit.AuditTrailManagementAspect.handleAuditTrail(AuditTrailManagementAspect.java:186) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:634) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:624) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:72) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:692) at org.apereo.cas.DefaultCentralAuthenticationService$$EnhancerBySpringCGLIB$$ee1c3230.deleteTicket(<generated>) at org.apereo.cas.web.flow.logout.TerminateSessionAction.initiateSingleLogout(TerminateSessionAction.java:207) at org.apereo.cas.web.flow.logout.TerminateSessionAction.terminate(TerminateSessionAction.java:131) at org.apereo.cas.web.flow.logout.TerminateSessionAction.doExecute(TerminateSessionAction.java:96) at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282) at org.springframework.cloud.context.scope.GenericScope$LockedScopedProxyFactoryBean.invoke(GenericScope.java:485) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) at com.sun.proxy.$Proxy315.execute(Unknown Source) at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51) ... 98 more
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/cf1e9123-ee90-4db0-9cbc-f7fa97109dafn%40apereo.org.

Vittore Zen

unread,
Feb 23, 2022, 4:34:23 AM2/23/22
to CAS Community, Matthew Gordon
Same problem. 
TGT is saved into couchdb but ST is not saved; TS is saved only inside TGT.
If I disable couchdb storage all works fine.

v.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/a14bda9f-a675-4477-a98a-14cae5a11a3cn%40apereo.org.

Pablo Vidaurri

unread,
Feb 28, 2022, 5:37:57 PM2/28/22
to CAS Community, Vittore Zen, Matthew Gordon
Db, Schema has changed, not sure if it happened in 6.4.5 or another 6.4.x version. Have you set your autoDll to drop and recreate the tables? I believe all tickets are now stored in cas_tickets table.

-psv

To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/d75acd67-0835-4077-b8ef-e97ab642c176n%40apereo.org.

Vittore Zen

unread,
Mar 4, 2022, 2:41:13 AM3/4/22
to Pablo Vidaurri, CAS Community, Matthew Gordon

Catalin

unread,
Apr 15, 2022, 12:16:33 PM4/15/22
to CAS Community, Vittore Zen, CAS Community, Matthew Gordon, Pablo Vidaurri
hey,

I'm a bit late to the party. I encountered the same behaviour on CAS 6.4.6.2 and 6.5.1

"TGT is saved into couchdb but ST is not saved; TS is saved only inside TGT."   -> this was my first thought as well, but the STs are saved as well and since their "ephemeral" purpose they are deleted right away, but not from inside the TGC (this one is correct)


The CouchDB ticket registry must adhere to a similar logic as the DefaultTicketRegistry, and here the difference would be deleting from CouchDB vs something non-existing in a map like structure

In order to make the single logout functionality to work I did the following

1) a custom ticket registry extended from CouchDbTicketRegistry(CAS), with try catch,
ofc a best solution would be to override completely the deleteSingleTicket since there the exceptions are not correctly treated in case if a document is not found


-------------------------------------------------------------
public class CouchDBTicketRegistry extends CouchDbTicketRegistry {

private static final Logger LOGGER = LoggerFactory.getLogger(CouchDBTicketRegistry.class);

public CouchDBTicketRegistry(TicketRepository couchDb, int conflictRetries) {
super(couchDb, conflictRetries);
}

@Override
public boolean deleteSingleTicket(final String ticketIdToDelete) {
try {
      return super.deleteSingleTicket(ticketIdToDelete);   // this will throw the error
} catch (Exception e) {
      LOGGER.error("Error deleting ticket {}", ticketIdToDelete, e);
      return false;
}
}
}
-----------------------------------------------------------
2) the way to inject the custom ticket registry with spring boot

-----------------------------------------------------------
@Configuration
@EnableConfigurationProperties(CasConfigurationProperties.class)
@ComponentScan("..........")
public class CouchDBTicketRegistryAutoConfiguration {

private static final Logger LOGGER = LoggerFactory.getLogger(CouchDBTicketRegistryAutoConfiguration.class);

private final CasConfigurationProperties casProperties;
private final Optional<TicketRepository> ticketRepository;

public CouchDBTicketRegistryAutoConfiguration(CasConfigurationProperties casProperties, Optional<TicketRepository> ticketRepository) {      //The Optional wrapping is in case the cas-server-support-couchdb-ticket-registry is not present or you will disable this functionality with spring.autoconfigure.exclude
LOGGER.info("injecting '{}' into CAS", this.getClass().getSimpleName());
this.ticketRepository = ticketRepository;
this.casProperties = casProperties;
}

@RefreshScope
@Bean(name = {"couchDbTicketRegistry", "ticketRegistry"})    // with this you override the default ticket registry and the one provided by CAS, they both are with ConditionalOnMissingBean, don't know why they have 2 different names
public TicketRegistry ticketRegistry() {
if (ticketRepository.isPresent()) {
      final var couchDb = casProperties.getTicket().getRegistry().getCouchDb();
      final var c = new CouchDBTicketRegistry(ticketRepository.get(), couchDb.getRetries());
      c.setCipherExecutor(CoreTicketUtils.newTicketRegistryCipherExecutor(couchDb.getCrypto(), "couch-db"));
return c;
}
return null;
}
}
------------------------------------------------------------
3) in spring.factories of your custom CAS declare: org.springframework.boot.autoconfigure.EnableAutoConfiguration=a.b.b.CouchDBTicketRegistryAutoConfiguration
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/09af8c3c-357d-41d3-9c24-dad9ff679d4cn%40apereo.org.
Reply all
Reply to author
Forward
0 new messages