Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
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
spring-cloud-netflix
Commits
c9e7d81e
Unverified
Commit
c9e7d81e
authored
Sep 26, 2017
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix security in mock eureka server application
parent
312a1d70
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
EurekaServerMockApplication.java
...loud/netflix/eureka/http/EurekaServerMockApplication.java
+32
-0
No files found.
spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/EurekaServerMockApplication.java
View file @
c9e7d81e
...
@@ -19,8 +19,15 @@ package org.springframework.cloud.netflix.eureka.http;
...
@@ -19,8 +19,15 @@ package org.springframework.cloud.netflix.eureka.http;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.core.Ordered
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
;
import
org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
;
import
org.springframework.security.core.userdetails.User
;
import
org.springframework.security.core.userdetails.UserDetailsService
;
import
org.springframework.security.provisioning.InMemoryUserDetailsManager
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
...
@@ -114,4 +121,29 @@ public class EurekaServerMockApplication {
...
@@ -114,4 +121,29 @@ public class EurekaServerMockApplication {
@PathVariable
String
id
)
{
@PathVariable
String
id
)
{
return
INFO
;
return
INFO
;
}
}
@Configuration
@Order
(
Ordered
.
HIGHEST_PRECEDENCE
)
protected
static
class
TestSecurityConfiguration
extends
WebSecurityConfigurerAdapter
{
TestSecurityConfiguration
()
{
super
(
true
);
}
@Bean
public
UserDetailsService
userDetailsService
()
{
InMemoryUserDetailsManager
manager
=
new
InMemoryUserDetailsManager
();
manager
.
createUser
(
User
.
withUsername
(
"test"
).
password
(
"test"
).
roles
(
"USER"
).
build
());
return
manager
;
}
@Override
protected
void
configure
(
HttpSecurity
http
)
throws
Exception
{
// super.configure(http);
http
.
antMatcher
(
"/apps/**"
)
.
httpBasic
();
}
}
}
}
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