Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
IntegrationProjet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abbenhoumi
IntegrationProjet
Commits
d1758dd5
Commit
d1758dd5
authored
Mar 29, 2020
by
benhoumine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
request post
parent
442fcd30
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
68 deletions
+8
-68
pom.xml
pom.xml
+2
-9
src/main/java/isima/f2/config/SecurityConfig.java
src/main/java/isima/f2/config/SecurityConfig.java
+0
-54
src/main/java/isima/f2/controllers/PoubelleController.java
src/main/java/isima/f2/controllers/PoubelleController.java
+6
-5
No files found.
pom.xml
View file @
d1758dd5
...
...
@@ -54,20 +54,13 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-security
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.security
</groupId>
<artifactId>
spring-security-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.json
</groupId>
<artifactId>
json
</artifactId>
<version>
20190722
</version>
</dependency>
</dependencies>
<build>
...
...
src/main/java/isima/f2/config/SecurityConfig.java
deleted
100644 → 0
View file @
442fcd30
package
isima.f2.config
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder
;
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
;
@Configuration
@EnableWebSecurity
public
class
SecurityConfig
extends
WebSecurityConfigurerAdapter
{
public
static
final
String
[]
PUBLIC_MATCHES
=
{
"**/**"
};
@Override
public
void
configure
(
HttpSecurity
http
)
throws
Exception
{
http
.
authorizeRequests
()
.
antMatchers
(
PUBLIC_MATCHES
).
permitAll
();
}
/*
@Override
protected void configure(HttpSecurity http) throws Exception {
http
//HTTP Basic authentication
.httpBasic()
.and()
.authorizeRequests()
.antMatchers(HttpMethod.GET, "/actions/**").hasRole("USER")
.antMatchers(HttpMethod.POST, "/actions").hasRole("ADMIN")
.antMatchers(HttpMethod.PUT, "/actions/**").hasRole("ADMIN")
.antMatchers(HttpMethod.PATCH, "/actions/**").hasRole("ADMIN")
.antMatchers(HttpMethod.DELETE, "/actions/**").hasRole("ADMIN")
.and()
.csrf().disable()
.formLogin().disable();
}
*/
// 2 utilisateur pour le demos
@Override
protected
void
configure
(
AuthenticationManagerBuilder
auth
)
throws
Exception
{
auth
.
inMemoryAuthentication
()
.
withUser
(
"user"
).
password
(
"{noop}password"
).
roles
(
"USER"
)
.
and
()
.
withUser
(
"admin"
).
password
(
"{noop}password"
).
roles
(
"USER"
,
"ADMIN"
);
}
}
src/main/java/isima/f2/controllers/PoubelleController.java
View file @
d1758dd5
package
isima.f2.controllers
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
...
...
@@ -9,6 +10,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
isima.f2.model.Poubelle
;
import
isima.f2.services.ImpPoubelle
;
...
...
@@ -31,10 +33,9 @@ public class PoubelleController {
}
@
PostMapping
(
value
=
"/testpost"
)
public
void
testPost
(
@RequestParam
String
id
)
{
System
.
out
.
println
(
"Test Post Id "
+
id
);
@PostMapping
(
"/testpost"
)
@
ResponseBody
public
String
testpost
(
@RequestParam
Map
<
String
,
String
>
allParams
)
{
return
"Les paramètres sont"
+
allParams
.
entrySet
(
);
}
}
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