All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sap.cloud.yaas.servicesdk.springboot.jersey.SecurityFeatureAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 4.17.1
Show newest version
/*
 * © 2017 SAP SE or an SAP affiliate company.
 * All rights reserved.
 * Please see http://www.sap.com/corporate-en/legal/copyright/index.epx for additional trademark information and
 * notices.
 */
package com.sap.cloud.yaas.servicesdk.springboot.jersey;

import javax.ws.rs.core.Feature;

import com.sap.cloud.yaas.servicesdk.jerseysupport.features.SecurityFeature;

import org.glassfish.jersey.server.ResourceConfig;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * Registers the SDK's {@link SecurityFeature}, which handles the {@link javax.annotation.security.RolesAllowed} logic.
 */
@Configuration
@ConditionalOnWebApplication
@ConditionalOnClass(ResourceConfig.class)
@ConditionalOnMissingBean(ResourceConfig.class)
@AutoConfigureAfter(JsonFeatureAutoConfiguration.class)
@AutoConfigureBefore(JerseyAutoConfiguration.class)
public class SecurityFeatureAutoConfiguration
{
	/**
	 * Registers the Jersey {@link SecurityFeature}.
	 *
	 * @return the Jersey {@link SecurityFeature}
	 */
	@Bean
	@ConditionalOnClass(SecurityFeature.class)
	@ConditionalOnMissingBean(SecurityFeature.class)
	@ConditionalOnProperty(prefix = "yaas.service.jersey", name = "enable-security-feature", matchIfMissing = true)
	public Feature securityFeature()
	{
		return new SecurityFeature();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy