Never mind, I did not correctly specify the location of the JSON file.

Yan

On Tuesday, September 30, 2025 at 1:48:24 PM UTC-4 Yan Zhou wrote:

> hi there,
>
> This likely is something missing on my part.
>
> In my CAS 7.2.5 overlay,  I verified that the bean 
> DefaultDelegatedAuthenticationDynamicDiscoveryProviderLocator is not 
> created below because of these conditions are Not met, instead, a proxy is 
> created. Without the right bean, dynamically look up delegated authN 
> provide will not work.
>
> .when(CONDITION.given(applicationContext.getEnvironment()))
> .and(CONDITION_JSON.given(applicationContext.getEnvironment()))
>
> however, in my application.properties, I clearly defined them as:
>
> cas.authn.pac4j.core.discovery-selection.selection-type=DYNAMIC
>
> cas.authn.pac4j.core.discovery-selection.json.location=classpath:delegated-discovery.json
>
> my application.properties is right under ./config, I start cas overlay 
> like this:
>
> gradlew bootRun -Dcas.standalone.configuration-directory=./config
>
> any idea?
>
> Thx!
>
> @ConditionalOnFeatureEnabled(feature = 
> CasFeatureModule.FeatureCatalog.DelegatedAuthentication, module = 
> "dynamic-discovery")
> @Configuration(value = 
> "DelegatedAuthenticationDynamicDiscoverySelectionConfiguration", 
> proxyBeanMethods = false)
> class DelegatedAuthenticationDynamicDiscoverySelectionConfiguration {
> private static final BeanCondition CONDITION = BeanCondition.on(
> "cas.authn.pac4j.core.discovery-selection.selection-type").havingValue(
> "DYNAMIC");
> private static final BeanCondition CONDITION_JSON = BeanCondition.on(
> "cas.authn.pac4j.core.discovery-selection.json.location").exists();
>
> @Bean
> @RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
> @ConditionalOnMissingBean(name = 
> "delegatedAuthenticationDynamicDiscoveryProviderLocator")
> public DelegatedAuthenticationDynamicDiscoveryProviderLocator 
> delegatedAuthenticationDynamicDiscoveryProviderLocator(
> @Qualifier("clientPrincipalFactory")
> final PrincipalFactory clientPrincipalFactory,
> @Qualifier(PrincipalResolver.BEAN_NAME_PRINCIPAL_RESOLVER)
> final PrincipalResolver defaultPrincipalResolver,
> final ConfigurableApplicationContext applicationContext,
> @Qualifier(DelegatedClientAuthenticationConfigurationContext.BEAN_NAME)
> final DelegatedClientAuthenticationConfigurationContext configContext,
> final CasConfigurationProperties casProperties) {
>
> return 
> BeanSupplier.of(DelegatedAuthenticationDynamicDiscoveryProviderLocator.
> class)
> .when(CONDITION.given(applicationContext.getEnvironment()))
> .and(CONDITION_JSON.given(applicationContext.getEnvironment()))
> .supply(() -> new 
> DefaultDelegatedAuthenticationDynamicDiscoveryProviderLocator(
> configContext.getDelegatedClientIdentityProvidersProducer(), 
> configContext.getIdentityProviders(),
> defaultPrincipalResolver, clientPrincipalFactory, casProperties))
> .otherwiseProxy()
> .get();
> }
>

-- 
- Website: https://apereo.github.io/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 [email protected].
To view this discussion visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/570553ae-b314-4645-9770-19296540cfc1n%40apereo.org.

Reply via email to