CAS 7.2.5, why this condition is Not met, entries exist in application.properties

22 views
Skip to first unread message

Yan Zhou

unread,
Sep 30, 2025, 1:48:24 PM (3 days ago) Sep 30
to CAS Community
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();
}

Yan Zhou

unread,
Sep 30, 2025, 9:06:28 PM (2 days ago) Sep 30
to CAS Community, Yan Zhou
Never mind, I did not correctly specify the location of the JSON file.

Yan

Reply all
Reply to author
Forward
0 new messages