@Override public ConditionOutcome getMatchOutcome( ConditionContext context, AnnotatedTypeMetadata metadata) { String managementEnabled = context.getEnvironment().getProperty("management.security.enabled", "true"); String basicEnabled = context.getEnvironment().getProperty("security.basic.enabled", "true"); return new ConditionOutcome( "true".equalsIgnoreCase(managementEnabled) && !"true".equalsIgnoreCase(basicEnabled), "Management security enabled and basic disabled"); }
private boolean isEnabled( org.springframework.context.annotation.ConditionContext context, java.lang.String prefix, boolean defaultValue) { RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(context.getEnvironment(), prefix); return resolver.getProperty("enabled", Boolean.class, defaultValue); }
@Override public ConditionOutcome getMatchOutcome( ConditionContext context, AnnotatedTypeMetadata metadata) { RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(context.getEnvironment(), "security.oauth2.resource.jwt."); String keyValue = resolver.getProperty("key-value"); String keyUri = resolver.getProperty("key-uri"); if (StringUtils.hasText(keyValue) || StringUtils.hasText(keyUri)) { return ConditionOutcome.match("public key is provided"); } return ConditionOutcome.noMatch("public key is not provided"); }
@Override public ConditionOutcome getMatchOutcome( ConditionContext context, AnnotatedTypeMetadata metadata) { Environment environment = context.getEnvironment(); RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(environment, "security.oauth2.resource."); Boolean preferTokenInfo = resolver.getProperty("prefer-token-info", Boolean.class); if (preferTokenInfo == null) { preferTokenInfo = environment .resolvePlaceholders("${OAUTH2_RESOURCE_PREFERTOKENINFO:true}") .equals("true"); } String tokenInfoUri = resolver.getProperty("token-info-uri"); String userInfoUri = resolver.getProperty("user-info-uri"); if (!StringUtils.hasLength(userInfoUri)) { return ConditionOutcome.match("No user info provided"); } if (StringUtils.hasLength(tokenInfoUri) && preferTokenInfo) { return ConditionOutcome.match( "Token info endpoint " + "is preferred and user info provided"); } return ConditionOutcome.noMatch("Token info endpoint is not provided"); }
private boolean isEnabled(ConditionContext context, String prefix, boolean defaultValue) { RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(context.getEnvironment(), prefix); return resolver.getProperty("enabled", Boolean.class, defaultValue); }
public boolean matches( ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) { return conditionContext.getEnvironment().getProperty("os.name").contains("Linux"); }