Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pricing-pod-poc
Project
Project
Details
Activity
Releases
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
Jagadeshwar
pricing-pod-poc
Commits
bfe2431a
Commit
bfe2431a
authored
Dec 05, 2022
by
gkhan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
security changes added
parent
0d2603e2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
31 deletions
+6
-31
SecurityConfig.java
src/main/java/com/safeway/pricing/config/SecurityConfig.java
+4
-30
AppRouterConfig.java
...main/java/com/safeway/pricing/router/AppRouterConfig.java
+2
-1
No files found.
src/main/java/com/safeway/pricing/config/SecurityConfig.java
View file @
bfe2431a
package
com
.
safeway
.
pricing
.
config
;
import
com.safeway.pricing.handler.PricingHandler
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.server.reactive.HttpHandler
;
import
org.springframework.http.server.reactive.ReactorHttpHandlerAdapter
;
import
org.springframework.security.authentication.ReactiveAuthenticationManager
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity
;
import
org.springframework.security.config.web.server.ServerHttpSecurity
;
import
org.springframework.security.web.server.SecurityWebFilterChain
;
import
org.springframework.security.web.server.authentication.WebFilterChainServerAuthenticationSuccessHandler
;
import
org.springframework.web.reactive.DispatcherHandler
;
import
org.springframework.web.reactive.config.EnableWebFlux
;
import
org.springframework.web.reactive.config.WebFluxConfigurer
;
import
org.springframework.web.reactive.result.method.annotation.ArgumentResolverConfigurer
;
import
org.springframework.web.server.WebFilter
;
import
org.springframework.web.server.adapter.WebHttpHandlerBuilder
;
import
reactor.ipc.netty.NettyContext
;
import
reactor.ipc.netty.http.server.HttpServer
;
@EnableWebFluxSecurity
public
class
SecurityConfig
{
@Autowired
PricingHandler
pricingHandler
;
@Bean
public
SecurityWebFilterChain
configure
(
ServerHttpSecurity
http
)
throws
Exception
{
http
.
csrf
().
disable
().
authorizeExchange
()
.
pathMatchers
(
HttpMethod
.
POST
,
"/oauth2/**"
,
"/login/**"
).
permitAll
()
//.hasAnyRole()
.
pathMatchers
(
HttpMethod
.
GET
,
"/getDefaultFilterDetails"
).
permitAll
()
.
anyExchange
().
authenticated
().
and
().
oauth2Login
()
.
authenticationSuccessHandler
(
new
WebFilterChainServerAuthenticationSuccessHandler
());
.
pathMatchers
(
"/oauth2/**"
,
"/login/**"
).
permitAll
()
.
pathMatchers
(
HttpMethod
.
GET
,
"/getDefaultFilterDetails"
).
permitAll
()
.
pathMatchers
(
HttpMethod
.
GET
,
"/api/**"
)
.
authenticated
().
and
().
oauth2Login
();
return
http
.
build
();
}
...
...
src/main/java/com/safeway/pricing/router/AppRouterConfig.java
View file @
bfe2431a
...
...
@@ -19,7 +19,8 @@ public class AppRouterConfig {
public
RouterFunction
<
ServerResponse
>
routerFunction
(){
return
RouterFunctions
.
route
()
.
GET
(
"/getDefaultFilterDetails"
,
pricingHandler:
:
getDefaultFilterDetails
)
.
GET
(
"/getCRCDetails"
,
pricingHandler:
:
getCRCDetails
)
.
GET
(
"/api/getCRCDetails"
,
pricingHandler:
:
getCRCDetails
)
.
GET
(
"/api/getCRCDetails2"
,
pricingHandler:
:
getCRCDetails
)
.
build
();
}
}
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