@Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { ConditionMessage.Builder message = ConditionMessage .forCondition("OAuth JWT Condition"); Environment environment = context.getEnvironment(); String keyValue = environment .getProperty("security.oauth2.resource.jwt.key-value"); String keyUri = environment .getProperty("security.oauth2.resource.jwt.key-uri"); if (StringUtils.hasText(keyValue) || StringUtils.hasText(keyUri)) { return ConditionOutcome .match(message.foundExactly("provided public key")); } return ConditionOutcome .noMatch(message.didNotFind("provided public key").atAll()); }
@Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { ConditionMessage.Builder message = ConditionMessage.forCondition("Okta Api Token Condition"); String tokenValue = context.getEnvironment().getProperty("okta.client.token"); if (StringUtils.hasText(tokenValue)) { return ConditionOutcome.match(message.foundExactly("provided API token")); } return ConditionOutcome.noMatch(message.didNotFind("provided API token").atAll()); } }
private ConditionOutcome getMatchOutcomeForBasename(ConditionContext context, String basename) { ConditionMessage.Builder message = ConditionMessage .forCondition("ResourceBundle"); for (String name : StringUtils.commaDelimitedListToStringArray( StringUtils.trimAllWhitespace(basename))) { for (Resource resource : getResources(context.getClassLoader(), name)) { if (resource.exists()) { return ConditionOutcome .match(message.found("bundle").items(resource)); } } } return ConditionOutcome.noMatch( message.didNotFind("bundle with basename " + basename).atAll()); }
@Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { ConditionMessage.Builder message = ConditionMessage .forCondition("OAuth JWT KeyStore Condition"); Environment environment = context.getEnvironment(); String keyStore = environment .getProperty("security.oauth2.resource.jwt.key-store"); if (StringUtils.hasText(keyStore)) { return ConditionOutcome .match(message.foundExactly("provided key store location")); } return ConditionOutcome .noMatch(message.didNotFind("key store location not provided").atAll()); }
@Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { ConditionMessage.Builder message = ConditionMessage .forCondition("OAuth JWK Condition"); Environment environment = context.getEnvironment(); String keyUri = environment .getProperty("security.oauth2.resource.jwk.key-set-uri"); if (StringUtils.hasText(keyUri)) { return ConditionOutcome .match(message.foundExactly("provided jwk key set URI")); } return ConditionOutcome .noMatch(message.didNotFind("key jwk set URI not provided").atAll()); }
@Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { ConditionMessage.Builder message = ConditionMessage .forCondition("OAuth JWT Condition"); Environment environment = context.getEnvironment(); String keyValue = environment .getProperty("security.oauth2.authorization.jwt.key-value"); if (StringUtils.hasText(keyValue)) { return ConditionOutcome .match(message.foundExactly("provided private or symmetric key")); } return ConditionOutcome .noMatch(message.didNotFind("provided private or symmetric key").atAll()); }
@Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { ConditionMessage.Builder message = ConditionMessage .forCondition("OAuth JWT Condition"); Environment environment = context.getEnvironment(); String keyValue = environment .getProperty("security.oauth2.authorization.jwt.key-value"); if (StringUtils.hasText(keyValue)) { return ConditionOutcome .match(message.foundExactly("provided private or symmetric key")); } return ConditionOutcome.noMatch( message.didNotFind("provided private or symmetric key").atAll()); }
@Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { ConditionMessage.Builder message = ConditionMessage .forCondition("OAuth JWT KeyStore Condition"); Environment environment = context.getEnvironment(); String keyStore = environment .getProperty("security.oauth2.resource.jwt.key-store"); if (StringUtils.hasText(keyStore)) { return ConditionOutcome .match(message.foundExactly("provided key store location")); } return ConditionOutcome.noMatch( message.didNotFind("key store location not provided").atAll()); }
@Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { ConditionMessage.Builder message = ConditionMessage .forCondition("OAuth JWK Condition"); Environment environment = context.getEnvironment(); String keyUri = environment .getProperty("security.oauth2.resource.jwk.key-set-uri"); if (StringUtils.hasText(keyUri)) { return ConditionOutcome .match(message.foundExactly("provided jwk key set URI")); } return ConditionOutcome .noMatch(message.didNotFind("key jwk set URI not provided").atAll()); }
@Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { String[] enablers = context.getBeanFactory() .getBeanNamesForAnnotation(EnableWebSecurity.class); ConditionMessage.Builder message = ConditionMessage .forCondition("@EnableWebSecurity Condition"); if (enablers != null && enablers.length > 0) { return ConditionOutcome.match(message .found("@EnableWebSecurity annotation on Application") .items(enablers)); } return ConditionOutcome.noMatch(message.didNotFind( "@EnableWebSecurity annotation " + "on Application") .atAll()); } }
@Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { String clientId = context.getEnvironment() .getProperty("security.oauth2.client.client-id"); ConditionMessage.Builder message = ConditionMessage .forCondition("OAuth Client ID"); if (StringUtils.hasLength(clientId)) { return ConditionOutcome.match(message .foundExactly("security.oauth2.client.client-id property")); } return ConditionOutcome.noMatch(message .didNotFind("security.oauth2.client.client-id property").atAll()); }
@Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { String clientId = context.getEnvironment() .getProperty("security.oauth2.client.client-id"); ConditionMessage.Builder message = ConditionMessage .forCondition("OAuth Client ID"); if (StringUtils.hasLength(clientId)) { return ConditionOutcome.match(message .foundExactly("security.oauth2.client.client-id property")); } return ConditionOutcome.noMatch(message .didNotFind("security.oauth2.client.client-id property").atAll()); }
@Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { String[] enablers = context.getBeanFactory() .getBeanNamesForAnnotation(EnableResourceServer.class); ConditionMessage.Builder message = ConditionMessage .forCondition("@EnableResourceServer Condition"); if (enablers != null && enablers.length > 0) { return ConditionOutcome.match(message .found("@EnableResourceServer annotation on Application") .items(enablers)); } return ConditionOutcome.noMatch(message.didNotFind( "@EnableResourceServer annotation " + "on Application") .atAll()); } }
@Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { ConditionMessage.Builder message = ConditionMessage .forCondition("OAuth JWT KeyStore Condition"); Environment environment = context.getEnvironment(); String keyStore = environment .getProperty("security.oauth2.authorization.jwt.key-store"); if (StringUtils.hasText(keyStore)) { return ConditionOutcome .match(message.foundExactly("provided key store location")); } return ConditionOutcome .noMatch(message.didNotFind("provided key store location").atAll()); }
private ConditionOutcome getMatchOutcomeForBasename(ConditionContext context, String basename) { ConditionMessage.Builder message = ConditionMessage .forCondition("ResourceBundle"); for (String name : StringUtils.commaDelimitedListToStringArray( StringUtils.trimAllWhitespace(basename))) { for (Resource resource : getResources(context.getClassLoader(), name)) { if (resource.exists()) { return ConditionOutcome .match(message.found("bundle").items(resource)); } } } return ConditionOutcome.noMatch( message.didNotFind("bundle with basename " + basename).atAll()); }
@Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { ConditionMessage.Builder message = ConditionMessage.forCondition("FlexyPoolConfigurationAvailable"); String propertiesFilePath = System.getProperty(PropertyLoader.PROPERTIES_FILE_PATH); if (propertiesFilePath != null && ClassLoaderUtils.getResource(propertiesFilePath) != null) { return ConditionOutcome.match(message.found("FlexyPool configuration file").items(propertiesFilePath)); } if (ClassLoaderUtils.getResource(PropertyLoader.PROPERTIES_FILE_NAME) != null) { return ConditionOutcome.match(message.found("FlexyPool configuration file").items(PropertyLoader.PROPERTIES_FILE_NAME)); } return ConditionOutcome.noMatch(message.didNotFind("FlexyPool configuration file").atAll()); } }
@Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { ConditionMessage.Builder message = ConditionMessage .forCondition("OAuth JWT KeyStore Condition"); Environment environment = context.getEnvironment(); String keyStore = environment .getProperty("security.oauth2.authorization.jwt.key-store"); if (StringUtils.hasText(keyStore)) { return ConditionOutcome .match(message.foundExactly("provided key store location")); } return ConditionOutcome .noMatch(message.didNotFind("provided key store location").atAll()); }
@Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { ConditionMessage.Builder message = ConditionMessage.forCondition("Okta Api Token Condition"); String tokenValue = context.getEnvironment().getProperty("okta.client.token"); if (StringUtils.hasText(tokenValue)) { return ConditionOutcome.match(message.foundExactly("provided API token")); } return ConditionOutcome.noMatch(message.didNotFind("provided API token").atAll()); } }
@Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { String[] commands = context.getBeanFactory().getBeanNamesForAnnotation(Command.class); ConditionMessage.Builder message = ConditionMessage.forCondition("@Command Condition"); if (commands.length == 0) { return ConditionOutcome.noMatch(message.didNotFind("@Command beans").atAll()); } else { return ConditionOutcome.match(message.found("@Command beans").items((Object[]) commands)); } }