Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Antonio Rueda
/
UJACoin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c7e765a3
authored
Nov 25, 2022
by
Antonio Rueda
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Revisión y pequeños cambios en controlador REST
parent
d77a464b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
16 additions
and
24 deletions
nbproject/project.properties
pom.xml
src/main/java/es/ujaen/dae/ujacoin/entidades/Cliente.java
src/main/java/es/ujaen/dae/ujacoin/rest/ControladorREST.java
src/main/java/es/ujaen/dae/ujacoin/seguridad/ServicioDatosCliente.java
src/main/java/es/ujaen/dae/ujacoin/seguridad/ServicioSeguridadUjaCoin.java
src/main/resources/application.yml
nbproject/project.properties
deleted
100644 → 0
View file @
d77a464b
File mode changed
pom.xml
View file @
c7e765a3
...
...
@@ -7,8 +7,8 @@
<packaging>
jar
</packaging>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<maven.compiler.source>
1
6
</maven.compiler.source>
<maven.compiler.target>
1
6
</maven.compiler.target>
<maven.compiler.source>
1
8
</maven.compiler.source>
<maven.compiler.target>
1
8
</maven.compiler.target>
</properties>
<parent>
...
...
src/main/java/es/ujaen/dae/ujacoin/entidades/Cliente.java
View file @
c7e765a3
...
...
@@ -113,7 +113,7 @@ public class Cliente implements Serializable {
}
/**
* Compara la clave con la del cliente, codificándola
en Md5
* Compara la clave con la del cliente, codificándola
con el algoritmo establecido
* @param clave
* @return
*/
...
...
src/main/java/es/ujaen/dae/ujacoin/rest/ControladorREST.java
View file @
c7e765a3
...
...
@@ -22,7 +22,6 @@ import java.time.LocalDateTime;
import
java.time.format.DateTimeParseException
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
import
javax.validation.ConstraintViolationException
;
import
javax.validation.constraints.Positive
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -73,12 +72,6 @@ public class ControladorREST {
}
}
// Just for testing
@GetMapping
(
"/clientes/hola"
)
String
hola
()
{
return
"Hola"
;
}
/** Login de clientes (temporal hasta incluir autenticación mediante Spring Security */
@GetMapping
(
"/clientes/{dni}"
)
ResponseEntity
<
DTOCliente
>
verCliente
(
@PathVariable
String
dni
)
{
...
...
@@ -105,7 +98,7 @@ public class ControladorREST {
@ResponseStatus
(
HttpStatus
.
OK
)
List
<
DTOTarjeta
>
verTarjetas
(
@PathVariable
String
dni
)
{
return
servicios
.
verTarjetas
(
dni
).
stream
()
.
map
(
t
->
new
DTOTarjeta
(
t
)).
collect
(
Collectors
.
toList
()
);
.
map
(
t
->
new
DTOTarjeta
(
t
)).
toList
(
);
}
/** Obtener una tarjeta concreta */
...
...
@@ -130,7 +123,7 @@ public class ControladorREST {
@ResponseStatus
(
HttpStatus
.
OK
)
List
<
DTOCuenta
>
verCuentas
(
@PathVariable
String
dni
)
{
return
servicios
.
verCuentas
(
dni
).
stream
()
.
map
(
c
->
new
DTOCuenta
(
c
)).
collect
(
Collectors
.
toList
()
);
.
map
(
c
->
new
DTOCuenta
(
c
)).
toList
(
);
}
/** Obtener una cuenta concreta */
...
...
@@ -204,6 +197,6 @@ public class ControladorREST {
.
skip
((
pag
-
1
)
*
num
)
.
limit
(
num
)
.
map
(
m
->
DTOMovimiento
.
dtoMovimiento
(
m
))
.
collect
(
Collectors
.
toList
()
));
.
toList
(
));
}
}
src/main/java/es/ujaen/dae/ujacoin/seguridad/ServicioDatosCliente.java
View file @
c7e765a3
...
...
@@ -26,6 +26,7 @@ public class ServicioDatosCliente implements UserDetailsService {
@Autowired
ServicioUjaCoin
servicioUjaCoin
;
/*
PasswordEncoder encoder;
public ServicioDatosCliente() {
...
...
@@ -35,6 +36,7 @@ public class ServicioDatosCliente implements UserDetailsService {
PasswordEncoder getEncoder() {
return encoder;
}
*/
@Override
public
UserDetails
loadUserByUsername
(
String
dni
)
throws
UsernameNotFoundException
{
...
...
src/main/java/es/ujaen/dae/ujacoin/seguridad/ServicioSeguridadUjaCoin.java
View file @
c7e765a3
...
...
@@ -6,7 +6,6 @@
package
es
.
ujaen
.
dae
.
ujacoin
.
seguridad
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.CacheManager
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder
;
...
...
@@ -47,7 +46,7 @@ public class ServicioSeguridadUjaCoin extends WebSecurityConfigurerAdapter {
// Activar seguridad HTTP Basic
httpSecurity
.
httpBasic
();
//httpSecurity.authorizeRequests().antMatchers("/ujacoin/**").permitAll();
//
httpSecurity.authorizeRequests().antMatchers("/ujacoin/**").permitAll();
// Definir protección por URL
httpSecurity
.
authorizeRequests
().
antMatchers
(
HttpMethod
.
POST
,
"/ujacoin/clientes"
).
permitAll
();
...
...
src/main/resources/application.yml
View file @
c7e765a3
## Fichero de configuración para UjaCoin
## MySQL local
#
spring.datasource.url: jdbc:mysql://localhost:33060/ujacoin
#
spring.datasource.username: ujacoin
#
spring.datasource.password: secret
spring.datasource.url
:
jdbc:mysql://localhost:33060/ujacoin
spring.datasource.username
:
ujacoin
spring.datasource.password
:
secret
## H2 embedded
spring.datasource.url
:
jdbc:h2:file:~/data/ujacoin;MODE=MYSQL;DATABASE_TO_LOWER=TRUE;DB_CLOSE_DELAY=-1
spring.jpa.properties.javax.persistence.schema-generation.database.action
:
drop-and-create
## H2 file
#spring.datasource.url: jdbc:h2:file:~/data/ujacoin;MODE=MYSQL;DATABASE_TO_LOWER=TRUE;DB_CLOSE_DELAY=-1
spring.jpa.properties.javax.persistence.schema-generation.database.action
:
none
spring.data.jpa.repositories.bootstrap-mode
:
default
spring.jpa.open-in-view
:
false
#spring.cache.type: NONE
spring.cache.type
:
NONE
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