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

org.zodiac.autoconfigure.web.crypto.ServletWebApiCryptoAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.autoconfigure.web.crypto;

import java.util.List;

import org.springframework.boot.SpringBootConfiguration;
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.condition.ConditionalOnWebApplication.Type;
import org.springframework.context.annotation.Bean;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.zodiac.autoconfigure.web.PlatformApiCryptoProperties;

@SpringBootConfiguration
@ConditionalOnWebApplication(type = Type.SERVLET)
@ConditionalOnClass(value = {org.zodiac.core.web.remote.crypto.config.PlatformApiCryptoInfo.class})
@ConditionalOnProperty(value = org.zodiac.core.web.remote.crypto.constants.ApiCryptoSystemPropertiesConstants.PLATFORM_API_CRYPTO_ENABLED, havingValue = "true")
public class ServletWebApiCryptoAutoConfiguration implements WebMvcConfigurer {

    private final PlatformApiCryptoProperties platformApiCryptoProperties;

    public ServletWebApiCryptoAutoConfiguration(PlatformApiCryptoProperties platformApiCryptoProperties) {
        this.platformApiCryptoProperties = platformApiCryptoProperties;
    }

    @Override
    public void addArgumentResolvers(List argumentResolvers) {
        argumentResolvers.add(new org.zodiac.core.web.remote.crypto.core.servlet.ApiDecryptParamResolver(platformApiCryptoProperties));
    }

    @Bean
    @ConditionalOnMissingBean
    protected org.zodiac.core.web.remote.crypto.core.servlet.ApiDecryptRequestBodyAdvice apiDecryptRequestBodyAdvice() {
        return new org.zodiac.core.web.remote.crypto.core.servlet.ApiDecryptRequestBodyAdvice(platformApiCryptoProperties);
    }

    @Bean
    @ConditionalOnMissingBean
    protected org.zodiac.core.web.remote.crypto.core.servlet.ApiEncryptResponseBodyAdvice apiEncryptResponseBodyAdvice() {
        return new org.zodiac.core.web.remote.crypto.core.servlet.ApiEncryptResponseBodyAdvice(platformApiCryptoProperties);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy