Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
BackEnd-V2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Joel Andres Molina Velez
BackEnd-V2
Commits
f34c5847
Commit
f34c5847
authored
Jul 07, 2023
by
Joel Andres Molina Velez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Se corrigen warnings
parent
64b4ddf6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
CustomUserDetails.java
...spe/movilidad/MovilidadWS/Security/CustomUserDetails.java
+7
-4
CustomUserDetailsService.java
...ilidad/MovilidadWS/Security/CustomUserDetailsService.java
+3
-3
No files found.
src/main/java/ec/edu/espe/movilidad/MovilidadWS/Security/CustomUserDetails.java
View file @
f34c5847
package
ec
.
edu
.
espe
.
movilidad
.
MovilidadWS
.
Security
;
import
ec.edu.espe.movilidad.MovilidadWS.Model.ModelUzyTUsuario
;
import
lombok.AllArgsConstructor
;
import
org.springframework.security.core.GrantedAuthority
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
java.util.Collection
;
@AllArgsConstructor
public
class
CustomUserDetails
implements
UserDetails
{
//private final ModelUzyTUsuario usuario;
private
final
ModelUzyTUsuario
usuario
;
public
CustomUserDetails
(
Object
o
)
{
public
CustomUserDetails
(
ModelUzyTUsuario
usuari
o
)
{
this
.
usuario
=
usuario
;
}
@Override
...
...
@@ -27,7 +30,7 @@ public class CustomUserDetails implements UserDetails {
@Override
public
String
getUsername
()
{
return
null
;
return
usuario
.
getUzytusuario_email
()
;
}
@Override
...
...
src/main/java/ec/edu/espe/movilidad/MovilidadWS/Security/CustomUserDetailsService.java
View file @
f34c5847
...
...
@@ -20,9 +20,9 @@ public class CustomUserDetailsService implements UserDetailsService {
}
@Override
public
UserDetails
loadUserByUsername
(
String
findBySpridenID
)
throws
UsernameNotFoundException
{
ModelUzyTUsuario
usuario
=
daoUzyTUsuario
.
findBy
SpridenID
(
findBySpridenID
)
.
orElseThrow
(()
->
new
UsernameNotFoundException
(
"Usuario no encontrado: "
+
findBySpridenID
));
public
UserDetails
loadUserByUsername
(
String
email
)
throws
UsernameNotFoundException
{
ModelUzyTUsuario
usuario
=
daoUzyTUsuario
.
findBy
Email
(
email
);
logger
.
info
(
"Tipo de usuario {}"
,
usuario
);
return
new
CustomUserDetails
(
usuario
);
...
...
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