Commit c38e7c6a by lepdou

add default configuration profile

parent 9f1740e0
......@@ -56,7 +56,8 @@ public class AuthConfiguration {
@Bean
public ServletListenerRegistrationBean singleSignOutHttpSessionListener() {
ServletListenerRegistrationBean singleSignOutHttpSessionListener = new ServletListenerRegistrationBean();
singleSignOutHttpSessionListener.setListener(listener("org.jasig.cas.client.session.SingleSignOutHttpSessionListener"));
singleSignOutHttpSessionListener
.setListener(listener("org.jasig.cas.client.session.SingleSignOutHttpSessionListener"));
return singleSignOutHttpSessionListener;
}
......@@ -101,7 +102,8 @@ public class AuthConfiguration {
filterInitParam.put("useRedis", "true");
filterInitParam.put("redisClusterName", "casClientPrincipal");
casValidationFilter.setFilter(filter("org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter"));
casValidationFilter
.setFilter(filter("org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter"));
casValidationFilter.setInitParameters(filterInitParam);
casValidationFilter.addUrlPatterns("/*");
casValidationFilter.setOrder(3);
......@@ -171,24 +173,15 @@ public class AuthConfiguration {
}
}
/**
* 默认实现
* spring.profiles.active != ctrip
*/
@Configuration
@Profile({"!ctrip"})
static class DefaultAuthAutoConfiguration {
@Bean
public FilterRegistrationBean openApiAuthenticationFilter(ConsumerAuthUtil consumerAuthUtil,
ConsumerAuditUtil consumerAuditUtil) {
FilterRegistrationBean openApiFilter = new FilterRegistrationBean();
openApiFilter.setFilter(new ConsumerAuthenticationFilter(consumerAuthUtil, consumerAuditUtil));
openApiFilter.addUrlPatterns("/openapi/*");
return openApiFilter;
}
@Bean
@ConditionalOnMissingBean(SsoHeartbeatHandler.class)
public SsoHeartbeatHandler defaultSsoHeartbeatHandler() {
return new DefaultSsoHeartbeatHandler();
......
package com.ctrip.framework.apollo.portal.spi.configuration;
import com.ctrip.framework.apollo.openapi.filter.ConsumerAuthenticationFilter;
import com.ctrip.framework.apollo.openapi.util.ConsumerAuditUtil;
import com.ctrip.framework.apollo.openapi.util.ConsumerAuthUtil;
import org.springframework.boot.context.embedded.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class AuthFilterConfiguration {
@Bean
public FilterRegistrationBean openApiAuthenticationFilter(ConsumerAuthUtil consumerAuthUtil,
ConsumerAuditUtil consumerAuditUtil) {
FilterRegistrationBean openApiFilter = new FilterRegistrationBean();
openApiFilter.setFilter(new ConsumerAuthenticationFilter(consumerAuthUtil, consumerAuditUtil));
openApiFilter.addUrlPatterns("/openapi/*");
return openApiFilter;
}
}
......@@ -14,9 +14,12 @@ import org.springframework.context.annotation.Profile;
@Configuration
public class EmailConfiguration {
/**
* spring.profiles.active = ctrip
*/
@Configuration
@Profile("ctrip")
public static class CtripEmailConfiguration{
public static class CtripEmailConfiguration {
@Bean
public EmailService ctripEmailService() {
......@@ -24,16 +27,25 @@ public class EmailConfiguration {
}
@Bean
public CtripEmailRequestBuilder emailRequestBuilder(){
public CtripEmailRequestBuilder emailRequestBuilder() {
return new CtripEmailRequestBuilder();
}
}
@Bean
@ConditionalOnMissingBean(EmailService.class)
public EmailService defaultEmailService() {
return new DefaultEmailService();
/**
* spring.profiles.active != ctrip
*/
@Configuration
@Profile({"!ctrip"})
public static class DefaultEmailConfiguration {
@Bean
@ConditionalOnMissingBean(EmailService.class)
public EmailService defaultEmailService() {
return new DefaultEmailService();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment