root/resilient#8 Inicializar o User. Corrigir as ROLES na autenticação
This commit is contained in:
parent
feda206b0e
commit
7a69e6c491
1 changed files with 2 additions and 2 deletions
|
@ -82,7 +82,7 @@ public class Saml2AuthenticationHandler implements AuthenticationSuccessHandler,
|
|||
return;
|
||||
}
|
||||
|
||||
User user = userRepository.findOneByLogin(username).orElse(null);
|
||||
User user = userRepository.findOneWithAuthoritiesByLogin(username).orElse(null);
|
||||
if (user != null) {
|
||||
// This user can login with SAML2 ?
|
||||
if (!user.getAllowSamlAuthentication()) {
|
||||
|
@ -159,7 +159,7 @@ public class Saml2AuthenticationHandler implements AuthenticationSuccessHandler,
|
|||
userOrganization, "pt-PT");
|
||||
|
||||
Saml2Authentication newAuthentication = new Saml2Authentication(userdetails, samlXMLResponse,
|
||||
authentication.getAuthorities());
|
||||
userdetails.getAuthorities());
|
||||
SecurityContextHolder.getContext().setAuthentication(newAuthentication);
|
||||
|
||||
// This is a sugar-code when in development environment.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue