[cas-user] Re: CAS7 bean creation override question

2024-05-06 Thread Yan Zhou
My thought is that this bean ( jdbcPasswordChangeService)  is already 
created somehow, see below logs, but I do not know how to find it who 
created it,  I set a breakpoint in the only occurrence of this bean 
definition,  JdbcPasswordManagementConfiguration, the method does not 
appear invoked in debugger.

2024-05-06 12:23:41,783 DEBUG [restartedMain] 
[org.springframework.beans.factory.support.DefaultListableBeanFactory] - 
  
 <== i have my class re-defined this and breakpoint is invoked successfully

2024-05-06 12:23:41,804 DEBUG [restartedMain] 
[org.springframework.beans.factory.support.DefaultListableBeanFactory] - 
  
<==  do Not know who created it.

2024-05-06 12:23:41,836 DEBUG [restartedMain] 
[org.springframework.beans.factory.support.DefaultListableBeanFactory] - 


any idea to find out who created this instance?

On Monday, May 6, 2024 at 11:53:07 AM UTC-4 Yan Zhou wrote:

> Hi,
>
> CAS 7.1.0 overlay, I need to override password change implementation, 
> using my own PasswordManagementService.
>
> I basically want to provide my own impl. of 
> JdbcPasswordManagementConfiguration. 
> See below QuestCasConfiguration, 
>
> also defined in META-INF/spring/...AutoImports
> org.apereo.cas.config.CasOverlayOverrideConfiguration
> org.apereo.cas.config.QuestCasConfiguration
>
>
> @EnableTransactionManagement(proxyTargetClass = false)
> @EnableConfigurationProperties(CasConfigurationProperties.class)
> @Configuration(value = "QuestCasConfiguration", proxyBeanMethods = false)
> public class QuestCasConfiguration {
>
> @Bean(name = "jdbcPasswordChangeService")
> public PasswordManagementService passwordChangeService(
> ...
> final PasswordHistoryService passwordHistoryService) {
> return new 
> QuestJdbcPasswordManagementService(passwordManagementCipherExecutor,
> casProperties.getServer().getPrefix(), casProperties.getAuthn().getPm(), 
> jdbcPasswordManagementDataSource,
> jdbcPasswordManagementTransactionTemplate, passwordHistoryService, encoder); 
> <=== this is Not called 
> }
>
> @Bean(name = "jdbcPasswordManagementDataSource")
> public DataSource jdbcPasswordManagementDataSource(final 
> CasConfigurationProperties 
> casProperties) {
> return JpaBeans.newDataSource
> (casProperties.getAuthn().getJdbc().getQuery().get(0)); <=== this is 
> called
> }
> }
>
> the problem is that the two bean methods, one (
> jdbcPasswordManagementDataSource) is called but the other(
> passwordChangeService) is not, not sure why. I set a breakpoint in my 
> class to see how the code is invoked.
>
> This means passwordChangeService is already created somewhere else, but I 
> cannot figure that out, either. 
>
> I set a breakpoint in CAS source code: JdbcPasswordManagementConfiguration, 
> I do not see any method stopped during debug when CAS starts up.
>
> what did I miss? here are related logs
>
> 2024-05-06 10:49:55,104 DEBUG [restartedMain] 
> [org.springframework.beans.factory.support.DefaultListableBeanFactory] - 
>  definition: replacing [Root bean: class [null]; scope=; abstract=false; 
> lazyInit=null; autowireMode=3; dependencyCheck=0; autowireCandidate=true; 
> primary=false; 
> factoryBeanName=org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration;
>  
> factoryMethodName=localeResolver; initMethodNames=null; 
> destroyMethodNames=[(inferred)]; defined in class path resource 
> [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]]
>  
> with [Root bean: class [null]; scope=refresh; abstract=false; 
> lazyInit=null; autowireMode=3; dependencyCheck=0; autowireCandidate=true; 
> primary=false; factoryBeanName=CasWebAppConfiguration; 
> factoryMethodName=localeResolver; initMethodNames=null; 
> destroyMethodNames=[(inferred)]; defined in class path resource 
> [org/apereo/cas/config/CasWebAppConfiguration.class]]>
> 2024-05-06 10:49:55,107 DEBUG [restartedMain] 
> [org.springframework.beans.factory.support.DefaultListableBeanFactory] - 
>  with a different definition: replacing [Root bean: class [null]; 
> scope=refresh; abstract=false; lazyInit=null; autowireMode=3; 
> dependencyCheck=0; autowireCandidate=true; primary=false; 
> factoryBeanName=JdbcPasswordManagementDataConfiguration; 
> factoryMethodName=jdbcPasswordManagementDataSource; initMethodNames=null; 
> destroyMethodNames=[(inferred)]; defined in class path resource 
> [org/apereo/cas/config/JdbcPasswordManagementConfiguration$JdbcPasswordManagementDataConfiguration.class]]
>  
> with [Root bean: class [null]; scope=; abstract=false; lazyInit=null; 
> autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; 
> factoryBeanName=QuestCasConfiguration; 
> factoryMethodName=jdbcPasswordManagementDataSource; initMethodNames=null; 
> destroyMethodNames=[(inferred)]; defined in class path resource 
> [org/apereo/cas/config/QuestCasConfiguration.class]]>
> 2024-05-06 10:49:55,257 DEBUG [restartedMain] 
> 

[cas-user] CAS7 bean creation override question

2024-05-06 Thread Yan Zhou
Hi,

CAS 7.1.0 overlay, I need to override password change implementation, using 
my own PasswordManagementService.

I basically want to provide my own impl. of 
JdbcPasswordManagementConfiguration. 
See below QuestCasConfiguration, 

also defined in META-INF/spring/...AutoImports
org.apereo.cas.config.CasOverlayOverrideConfiguration
org.apereo.cas.config.QuestCasConfiguration


@EnableTransactionManagement(proxyTargetClass = false)
@EnableConfigurationProperties(CasConfigurationProperties.class)
@Configuration(value = "QuestCasConfiguration", proxyBeanMethods = false)
public class QuestCasConfiguration {

@Bean(name = "jdbcPasswordChangeService")
public PasswordManagementService passwordChangeService(
...
final PasswordHistoryService passwordHistoryService) {
return new 
QuestJdbcPasswordManagementService(passwordManagementCipherExecutor,
casProperties.getServer().getPrefix(), casProperties.getAuthn().getPm(), 
jdbcPasswordManagementDataSource,
jdbcPasswordManagementTransactionTemplate, passwordHistoryService, encoder); 
<=== this is Not called 
}

@Bean(name = "jdbcPasswordManagementDataSource")
public DataSource jdbcPasswordManagementDataSource(final 
CasConfigurationProperties 
casProperties) {
return JpaBeans.newDataSource
(casProperties.getAuthn().getJdbc().getQuery().get(0)); <=== this is called
}
}

the problem is that the two bean methods, one (
jdbcPasswordManagementDataSource) is called but the other(
passwordChangeService) is not, not sure why. I set a breakpoint in my class 
to see how the code is invoked.

This means passwordChangeService is already created somewhere else, but I 
cannot figure that out, either. 

I set a breakpoint in CAS source code: JdbcPasswordManagementConfiguration, 
I do not see any method stopped during debug when CAS starts up.

what did I miss? here are related logs

2024-05-06 10:49:55,104 DEBUG [restartedMain] 
[org.springframework.beans.factory.support.DefaultListableBeanFactory] - 

2024-05-06 10:49:55,107 DEBUG [restartedMain] 
[org.springframework.beans.factory.support.DefaultListableBeanFactory] - 

2024-05-06 10:49:55,257 DEBUG [restartedMain] 
[org.springframework.beans.factory.support.DefaultListableBeanFactory] - 




   JdbcPasswordHistoryManagementConfiguration matched:
  - Requested features [PasswordManagementHistory] are enabled 
(CasFeatureEnabledCondition)

   JdbcPasswordManagementConfiguration matched:
  - Requested features [PasswordManagement] are enabled 
(CasFeatureEnabledCondition)

  
 
JdbcPasswordManagementConfiguration.JdbcPasswordManagementDataConfiguration#jdbcPasswordManagementDataSource
 
matched:
  - @ConditionalOnMissingBean (names: jdbcPasswordManagementDataSource; 
SearchStrategy: all) did not find any beans (OnBeanCondition)

  
 
JdbcPasswordManagementConfiguration.JdbcPasswordManagementServiceConfiguration#passwordChangeService
 
matched:
  - @ConditionalOnMissingBean (names: jdbcPasswordChangeService; 
SearchStrategy: all) did not find any beans (OnBeanCondition)

  
 
JdbcPasswordManagementConfiguration.JdbcPasswordManagementTransactionConfiguration#jdbcPasswordManagementTransactionTemplate
 
matched:
  - @ConditionalOnMissingBean (names: 
jdbcPasswordManagementTransactionTemplate; SearchStrategy: all) did not 
find any beans (OnBeanCondition)

thanks!
Yan

-- 
- 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+unsubscr...@apereo.org.
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/d9523583-4942-4c50-a755-fafb8434b2aan%40apereo.org.


[cas-user] Problem with a ChainingRegisteredServiceAccessStrategy service

2024-05-06 Thread Alfonso Veraluz
Hello,

I have a CAS 6.6.15 working in this configuration:
 In general, users that via Spnego when they are in some ip range, if not 
they go to the login form and that is configured with ldap.
 
 For a determined url, we have a service json that redirects to a 
Dualshield and returns when they are logged in.
 
 The problem is when i try to configure a service json that pretends: 
The user goes to extranet.company.com
If the user is in a test ip, it should go to Dualshield for authentication.
If the users is not in the test ip, it should go to the login form.

Pretty sure that should be configured with a 
ChainingRegisteredServiceAccessStrategy but the criteria of the strategies 
is not very clear at the Doc.

Like this testsite-1.json:
{
  "@class": "org.apereo.cas.services.CasRegisteredService",
  "serviceId": "https://extranet.company.com/.*;,
  "name": "testsite",
  "id": 1,
  "evaluationOrder": 1,
  "accessStrategy" :
  {
"@class": 
"org.apereo.cas.services.ChainingRegisteredServiceAccessStrategy",
   "strategies": [ "java.util.ArrayList",
  [ {
  "@class" : 
"org.apereo.cas.services.HttpRequestRegisteredServiceAccessStrategy",
  "ipAddress" : "192.168.1.55",
  "delegatedAuthenticationPolicy": {
 "@class": 
"org.apereo.cas.services.DefaultRegisteredServiceDelegatedAuthenticationPolicy",
 "allowedProviders": [ "java.util.ArrayList", [ "DualShield" ] 
],
 "permitUndefined": false,
 "exclusive": true
  }
   },
   {
  "@class": 
"org.apereo.cas.services.DefaultRegisteredServiceAccessStrategy",
  "enabled": true
   }
  ]
],
"operator": "OR"
  }
}

This kind of json and some variants tested fails in two ways:
1) I recieve an error 500 on the cas/login screen and in the log says:

 ERROR [org.springframework.boot.web.servlet.support.ErrorPageFilter] - 

org.springframework.webflow.execution.ActionExecutionException: Exception 
thrown executing 
org.apereo.cas.web.flow.actions.DelegatedAuthenticationGenerateClientsAction@28a6a1b0
 
in state 'viewLoginForm' of flow 'login' -- action execution attributes 
were 'map[[empty]]'
at 
org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:62)
 
~[spring-webflow-2.5.1.RELEASE.jar:2.5.1.RELEASE]
at 
org.springframework.webflow.action.EvaluateAction.doExecute(EvaluateAction.java:77)
 
~[spring-webflow-2.5.1.RELEASE.jar:2.5.1.RELEASE]
at 
org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188)
 
~[spring-webflow-2.5.1.RELEASE.jar:2.5.1.RELEASE]
at 
org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51)
 
~[spring-webflow-2.5.1.RELEASE.jar:2.5.1.RELEASE]
at 
org.springframework.webflow.engine.ActionList.execute(ActionList.java:154) 
~[spring-webflow-2.5.1.RELEASE.jar:2.5.1.RELEASE]
at 
org.springframework.webflow.engine.ViewState.render(ViewState.java:291) 
~[spring-webflow-2.5.1.RELEASE.jar:2.5.1.RELEASE]
at 
org.springframework.webflow.engine.ViewState.doEnter(ViewState.java:185) 
~[spring-webflow-2.5.1.RELEASE.jar:2.5.1.RELEASE]
...
Caused by: java.lang.NullPointerException
at 
org.apereo.cas.pac4j.client.DefaultDelegatedClientIdentityProviderRedirectionStrategy.select(DefaultDelegatedClientIdentityProviderRedirectionStrategy.java:63)
 
~[cas-server-support-pac4j-core-6.6.15.jar:6.6.15]
at 
org.apereo.cas.pac4j.client.ChainingDelegatedClientIdentityProviderRedirectionStrategy.lambda$select$0(ChainingDelegatedClientIdentityProviderRedirectionStrategy.java:40)
 
~[cas-server-support-pac4j-core-6.6.15.jar:6.6.15]
at 
java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) 
~[?:?]
at 
java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1632) 
~[?:?]
at 
java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
 
~[?:?]
at 
java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502) 
~[?:?]
at 
java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488) ~[?:?]
at 
java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) 
~[?:?]
at 
java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150) ~[?:?]
at 
java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
at 
java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543) 
~[?:?]
at 
org.apereo.cas.pac4j.client.ChainingDelegatedClientIdentityProviderRedirectionStrategy.select(ChainingDelegatedClientIdentityProviderRedirectionStrategy.java:43)
 
~[cas-server-support-pac4j-core-6.6.15.jar:6.6.15]
at 
org.apereo.cas.web.flow.DefaultDelegatedClientIdentityProviderConfigurationProducer.produce(DefaultDelegatedClientIdentityProviderConfigurationProducer.java:64)
 
~[cas-server-support-pac4j-core-6.6.15.jar:6.6.15]
at 

[cas-user] Re: Intermittent Deadlock On Startup for cas v7.0.0 on GCP environments

2024-05-06 Thread Shavi Teotia
Hi All, 
have attached the thread dump for the previous mail, Could you please help 
regarding this?


On Thursday 2 May 2024 at 17:29:27 UTC+5:30 Shavi Teotia wrote:

> I recently migrated to the GCP environment, I am facing the issue that my 
> application have to be started multiple times before it actually starts 
> working, sometimes it gets stuck sometimes it works fine. 
>
> I have gone through the threaddump and found a deadlock. Below are the 
> screenshots from thread dump analyzer.  Please guide if i am missing some 
> specific setting that needs to be configured.
> [image: Thread Dump1.png]
>

-- 
- 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+unsubscr...@apereo.org.
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/69fceee0-3011-4055-ae20-e5258009e93bn%40apereo.org.