Java Code Examples for org.springframework.core.env.Environment#getRequiredProperty()

The following examples show how to use org.springframework.core.env.Environment#getRequiredProperty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShibcasAuthServlet.java    From shib-cas-authn3 with Apache License 2.0 6 votes vote down vote up
/**
 * Check the idp's idp.properties file for the configuration
 *
 * @param environment a Spring Application Context's Environment object (tied to the IdP's root context)
 */
private void parseProperties(final Environment environment) {
    logger.debug("reading properties from the idp.properties file");
    casServerPrefix = environment.getRequiredProperty("shibcas.casServerUrlPrefix");
    logger.debug("shibcas.casServerUrlPrefix: {}", casServerPrefix);

    casLoginUrl = environment.getRequiredProperty("shibcas.casServerLoginUrl");
    logger.debug("shibcas.casServerLoginUrl: {}", casLoginUrl);

    serverName = environment.getRequiredProperty("shibcas.serverName");
    logger.debug("shibcas.serverName: {}", serverName);

    ticketValidatorName = environment.getProperty("shibcas.ticketValidatorName", "cas30");
    logger.debug("shibcas.ticketValidatorName: {}", ticketValidatorName);

    entityIdLocation = environment.getProperty("shibcas.entityIdLocation", "append");
    logger.debug("shibcas.entityIdLocation: {}", entityIdLocation);
}
 
Example 2
Source File: ShibcasAuthServlet.java    From shib-cas-authn3 with Apache License 2.0 6 votes vote down vote up
/**
 * Check the idp's idp.properties file for the configuration
 *
 * @param environment a Spring Application Context's Environment object (tied to the IdP's root context)
 */
private void parseProperties(final Environment environment) {
    logger.debug("reading properties from the idp.properties file");
    casServerPrefix = environment.getRequiredProperty("shibcas.casServerUrlPrefix");
    logger.debug("shibcas.casServerUrlPrefix: {}", casServerPrefix);

    casLoginUrl = environment.getRequiredProperty("shibcas.casServerLoginUrl");
    logger.debug("shibcas.casServerLoginUrl: {}", casLoginUrl);

    serverName = environment.getRequiredProperty("shibcas.serverName");
    logger.debug("shibcas.serverName: {}", serverName);

    ticketValidatorName = environment.getProperty("shibcas.ticketValidatorName", "cas30");
    logger.debug("shibcas.ticketValidatorName: {}", ticketValidatorName);

    entityIdLocation = environment.getProperty("shibcas.entityIdLocation", "append");
    logger.debug("shibcas.entityIdLocation: {}", entityIdLocation);
}
 
Example 3
Source File: SystemBootAutoConfiguration.java    From super-cloudops with Apache License 2.0 5 votes vote down vote up
/**
 * Initialzing API error prompt.
 * 
 * @param env
 */
protected void initErrorPrompt(Environment env) {
	String appName = env.getRequiredProperty("spring.application.name");
	if (appName.length() < PROMPT_MAX_LEN) {
		ErrorPromptMessageBuilder.setPrompt(appName);
	} else {
		ErrorPromptMessageBuilder.setPrompt(appName.substring(0, 4));
	}

}
 
Example 4
Source File: HstsSecurityFilter.java    From super-cloudops with Apache License 2.0 5 votes vote down vote up
public HstsSecurityFilter(AbstractIamProperties<? extends ParamProperties> config, Environment environment) {
	notNullOf(config, "config");
	notNullOf(environment, "environment");
	this.config = config;
	this.environment = environment;

	// Http Strict-Transport-Security:
	String active = environment.getRequiredProperty("spring.profiles.active");
	Optional<String> hstsOpt = safeList(config.getDomain().getHstsProfilesActive()).stream()
			.filter(a -> equalsIgnoreCase(a, active)).findAny();
	this.enableHstsWithProfilesActive = hstsOpt.isPresent();
}
 
Example 5
Source File: AbstractEncryptingService.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Override
public void setEnvironment(Environment environment) {
    String ivString = environment.getRequiredProperty("security.encryption.credentialsIVSpec");
    String secretString = environment.getRequiredProperty("security.encryption.credentialsSecretSpec");

    try {
        initializationVectorSpec = new IvParameterSpec(ivString.getBytes(UTF8_ENCODING));
        secretKeySpec = new SecretKeySpec(secretString.getBytes(UTF8_ENCODING), AES_KEY);
    } catch (UnsupportedEncodingException e) {
        // Should never happen, UTF-8 is supported on all java platforms
        throw new RuntimeException(e);
    }
}
 
Example 6
Source File: Config.java    From vics with MIT License 5 votes vote down vote up
@Bean
public CorsConfig allowedHostsForCORS(Environment env) {
    String allowedHosts = env.getRequiredProperty("canvass.cors.hosts");
    String methods = env.getRequiredProperty("canvass.cors.methods");
    Set<String> hosts = new HashSet<>(asList(allowedHosts.split(",")));
    return new CorsConfig(hosts, methods);
}
 
Example 7
Source File: BitcoinAverage.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * @param symbolSet "global" or "local"; see https://apiv2.bitcoinaverage.com/#supported-currencies
 */
public BitcoinAverage(String name, String prefix, double pctMaxRequests, String symbolSet, Environment env) {
    super(name, prefix, refreshIntervalFor(pctMaxRequests));
    this.symbolSet = symbolSet;
    this.pubKey = env.getRequiredProperty("BITCOIN_AVG_PUBKEY");
    this.mac = initMac(env.getRequiredProperty("BITCOIN_AVG_PRIVKEY"));
}
 
Example 8
Source File: LogViewEndpointAutoconfig.java    From spring-boot-actuator-logview with MIT License 4 votes vote down vote up
@ConditionalOnProperty(LOGGING_PATH)
@ConditionalOnMissingBean(LogViewEndpoint.class)
@Bean
public LogViewEndpoint logViewEndpointWithDefaultPath(Environment environment, EndpointConfiguration configuration) {
    return new LogViewEndpoint(environment.getRequiredProperty(LOGGING_PATH), configuration.getStylesheets());
}