-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fails locally. Hope it works on the cloud .. said no one
- Loading branch information
Showing
19 changed files
with
229 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...cations/flights-ms/src/main/java/com/pcf/tripit/flights/DisableSecurityConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.pcf.tripit.flights; | ||
|
||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.security.config.annotation.web.builders.HttpSecurity; | ||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | ||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | ||
|
||
@EnableWebSecurity | ||
@Configuration | ||
@ConditionalOnProperty(value="enable-oauth", havingValue = "false") | ||
public class DisableSecurityConfiguration extends WebSecurityConfigurerAdapter { | ||
|
||
@Override | ||
protected void configure(HttpSecurity http) throws Exception { | ||
http.authorizeRequests().anyRequest().permitAll().and().csrf().disable(); | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
...ications/flights-ms/src/main/java/com/pcf/tripit/flights/EnableSecurityConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.pcf.tripit.flights; | ||
|
||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.boot.autoconfigure.security.SecurityProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.core.annotation.Order; | ||
import org.springframework.security.config.annotation.web.builders.HttpSecurity; | ||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | ||
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; | ||
|
||
@EnableResourceServer | ||
@Configuration | ||
@ConditionalOnProperty(value = "enable-oauth", matchIfMissing = true) | ||
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER) | ||
public class EnableSecurityConfiguration extends WebSecurityConfigurerAdapter { | ||
@Override | ||
public void configure(HttpSecurity http) throws Exception { | ||
http.authorizeRequests().anyRequest().authenticated(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
applications/hotels-ms/src/main/java/com/pcf/tripit/hotels/DisableSecurityConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.pcf.tripit.hotels; | ||
|
||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.security.config.annotation.web.builders.HttpSecurity; | ||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | ||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | ||
|
||
@EnableWebSecurity | ||
@Configuration | ||
@ConditionalOnProperty(value="enable-oauth", havingValue = "false") | ||
public class DisableSecurityConfiguration extends WebSecurityConfigurerAdapter { | ||
|
||
@Override | ||
protected void configure(HttpSecurity http) throws Exception { | ||
http.authorizeRequests().anyRequest().permitAll().and().csrf().disable(); | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
applications/hotels-ms/src/main/java/com/pcf/tripit/hotels/EnableSecurityConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.pcf.tripit.hotels; | ||
|
||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.boot.autoconfigure.security.SecurityProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.core.annotation.Order; | ||
import org.springframework.security.config.annotation.web.builders.HttpSecurity; | ||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | ||
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; | ||
|
||
@EnableResourceServer | ||
@Configuration | ||
@ConditionalOnProperty(value = "enable-oauth", matchIfMissing = true) | ||
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER) | ||
public class EnableSecurityConfiguration extends WebSecurityConfigurerAdapter { | ||
@Override | ||
public void configure(HttpSecurity http) throws Exception { | ||
http.authorizeRequests().anyRequest().authenticated(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
applications/tripit/src/main/java/com/pcf/tripit/DisableSecurityConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.pcf.tripit; | ||
|
||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.cloud.client.loadbalancer.LoadBalanced; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.security.config.annotation.web.builders.HttpSecurity; | ||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | ||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | ||
import org.springframework.web.client.RestOperations; | ||
import org.springframework.web.client.RestTemplate; | ||
|
||
@EnableWebSecurity | ||
@Configuration | ||
@ConditionalOnProperty(value="enable-oauth", havingValue = "false") | ||
public class DisableSecurityConfiguration extends WebSecurityConfigurerAdapter { | ||
|
||
@Override | ||
protected void configure(HttpSecurity http) throws Exception { | ||
http.authorizeRequests().anyRequest().permitAll().and().csrf().disable(); | ||
} | ||
|
||
@LoadBalanced | ||
@Bean | ||
public RestOperations restOperations() { | ||
return new RestTemplate(); | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
applications/tripit/src/main/java/com/pcf/tripit/EnableSecurityConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.pcf.tripit; | ||
|
||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.boot.autoconfigure.security.SecurityProperties; | ||
import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; | ||
import org.springframework.cloud.client.loadbalancer.LoadBalanced; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.core.annotation.Order; | ||
import org.springframework.security.config.annotation.web.builders.HttpSecurity; | ||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | ||
import org.springframework.security.oauth2.client.OAuth2ClientContext; | ||
import org.springframework.security.oauth2.client.OAuth2RestTemplate; | ||
import org.springframework.security.oauth2.client.resource.OAuth2ProtectedResourceDetails; | ||
import org.springframework.web.client.RestOperations; | ||
|
||
@EnableOAuth2Sso | ||
@Configuration | ||
@ConditionalOnProperty(value = "enable-oauth", matchIfMissing = true) | ||
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER) | ||
public class EnableSecurityConfiguration extends WebSecurityConfigurerAdapter { | ||
|
||
@Override | ||
public void configure(HttpSecurity http) throws Exception { | ||
http.authorizeRequests().anyRequest().authenticated(); | ||
} | ||
|
||
@LoadBalanced | ||
@Bean | ||
public RestOperations restOperations(OAuth2ProtectedResourceDetails resourceDetails, OAuth2ClientContext oauth2ClientContext) { | ||
return new OAuth2RestTemplate(resourceDetails, oauth2ClientContext); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
applications/tripit/src/main/resources/application.properties
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
spring: | ||
|
||
application: | ||
name: tripit | ||
|
||
mvc.view: | ||
prefix: /WEB-INF/ | ||
suffix: .jsp | ||
|
||
logging.level: | ||
root: WARN | ||
com.pcf.tripit.hotelui.HotelUI: DEBUG | ||
|
||
hystrix: | ||
command: | ||
default: | ||
execution: | ||
isolation: | ||
thread: | ||
timeoutInMilliseconds: 5000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.