File tree 4 files changed +53
-0
lines changed
java/com/cspinformatique/redis/server
4 files changed +53
-0
lines changed Original file line number Diff line number Diff line change 65
65
<groupId >com.cspinformatique.redis.message</groupId >
66
66
<artifactId >redis-message-core</artifactId >
67
67
</dependency >
68
+ <dependency >
69
+ <groupId >org.springframework.security</groupId >
70
+ <artifactId >spring-security-web</artifactId >
71
+ </dependency >
72
+ <dependency >
73
+ <groupId >org.springframework.security</groupId >
74
+ <artifactId >spring-security-config</artifactId >
75
+ </dependency >
68
76
</dependencies >
69
77
</project >
Original file line number Diff line number Diff line change
1
+ package com .cspinformatique .redis .server .config ;
2
+
3
+ import org .springframework .beans .factory .annotation .Autowired ;
4
+ import org .springframework .context .annotation .Configuration ;
5
+ import org .springframework .context .annotation .PropertySource ;
6
+ import org .springframework .core .env .Environment ;
7
+ import org .springframework .security .config .annotation .authentication .builders .AuthenticationManagerBuilder ;
8
+ import org .springframework .security .config .annotation .web .builders .HttpSecurity ;
9
+ import org .springframework .security .config .annotation .web .configuration .EnableWebSecurity ;
10
+ import org .springframework .security .config .annotation .web .configuration .WebSecurityConfigurerAdapter ;
11
+
12
+ @ Configuration
13
+ @ EnableWebSecurity
14
+ @ PropertySource ("classpath:security/credentials.properties" )
15
+ public class SecurityConfig extends WebSecurityConfigurerAdapter {
16
+ @ Autowired
17
+ private Environment env ;
18
+
19
+ @ Autowired
20
+ public void configureGlobal (AuthenticationManagerBuilder auth )
21
+ throws Exception {
22
+ auth .inMemoryAuthentication ()
23
+ .withUser (env .getRequiredProperty ("redis.notifier.user" ))
24
+ .password (env .getRequiredProperty ("redis.notifier.password" ))
25
+ .roles ("NOTIFIER" );
26
+ }
27
+
28
+ @ Override
29
+ protected void configure (HttpSecurity http ) throws Exception {
30
+ http .authorizeRequests ().antMatchers ("/**" )
31
+ .access ("hasRole('ROLE_NOTIFIER')" ).and ().httpBasic ();
32
+
33
+ http .csrf ().disable ();
34
+ }
35
+ }
Original file line number Diff line number Diff line change
1
+ package com .cspinformatique .redis .server .security ;
2
+
3
+ import org .springframework .security .web .context .AbstractSecurityWebApplicationInitializer ;
4
+
5
+ public class SpringSecurityInitializer extends
6
+ AbstractSecurityWebApplicationInitializer {
7
+
8
+ }
Original file line number Diff line number Diff line change
1
+ redis.notifier.user =notifier
2
+ redis.notifier.password =3Sf8!29nZ
You can’t perform that action at this time.
0 commit comments