Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
apollo
Commits
c38e7c6a
Commit
c38e7c6a
authored
Dec 06, 2016
by
lepdou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add default configuration profile
parent
9f1740e0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
21 deletions
+52
-21
AuthConfiguration.java
...rk/apollo/portal/spi/configuration/AuthConfiguration.java
+7
-14
AuthFilterConfiguration.java
...llo/portal/spi/configuration/AuthFilterConfiguration.java
+26
-0
EmailConfiguration.java
...k/apollo/portal/spi/configuration/EmailConfiguration.java
+19
-7
No files found.
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/AuthConfiguration.java
View file @
c38e7c6a
...
...
@@ -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
();
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/AuthFilterConfiguration.java
0 → 100644
View file @
c38e7c6a
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
;
}
}
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/EmailConfiguration.java
View file @
c38e7c6a
...
...
@@ -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
();
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment