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/d339f033-130a-4efb-9722-61e4fe97f7dbn%40apereo.org.

Reply via email to