Skip to content

Commit

Permalink
chore: try to fix unstable spring dependency wiring problem (dhis2#6058)
Browse files Browse the repository at this point in the history
* Add ifTest check in OIDC condition (config enabler) this was starting the DefaultDhisConfigurationProvider in the integrations tests

Signed-off-by: Morten Svanaes <[email protected]>
  • Loading branch information
netroms authored Sep 2, 2020
1 parent 6012e61 commit e1c0824
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,15 @@
/**
* @author Morten Svanæs <[email protected]>
*/
public class OidcDisabledCondition extends PropertiesAwareConfigurationCondition
public class OidcEnabledCondition extends PropertiesAwareConfigurationCondition
{
@Override
public boolean matches( ConditionContext context, AnnotatedTypeMetadata metadata )
{
if ( isTestRun( context ) )
{
return false;
}
String isEnabled = getConfiguration().getProperty( ConfigurationKey.OIDC_OAUTH2_LOGIN_ENABLED );
return isEnabled.equalsIgnoreCase( "on" );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.hisp.dhis.security.oauth2.DefaultClientDetailsService;
import org.hisp.dhis.security.oidc.DhisClientRegistrationRepository;
import org.hisp.dhis.security.oidc.DhisOAuth2AuthorizationRequestResolver;
import org.hisp.dhis.security.oidc.OidcDisabledCondition;
import org.hisp.dhis.security.oidc.OidcEnabledCondition;
import org.hisp.dhis.webapi.filter.CorsFilter;
import org.hisp.dhis.webapi.filter.CustomAuthenticationFilter;
import org.hisp.dhis.webapi.oprovider.DhisOauthAuthenticationProvider;
Expand Down Expand Up @@ -187,7 +187,7 @@ public void configure( final AuthorizationServerEndpointsConfigurer endpoints )
*/
@Configuration
@Order( 1010 )
@Conditional( value = OidcDisabledCondition.class )
@Conditional( value = OidcEnabledCondition.class )
public class OidcSecurityConfig extends WebSecurityConfigurerAdapter
{
@Autowired
Expand Down

0 comments on commit e1c0824

Please sign in to comment.