parent
49c4b8ae38
commit
456c4db518
2 changed files with 5 additions and 1 deletions
|
@ -5,6 +5,7 @@ import java.util.Optional;
|
|||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.EntityGraph;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
@ -38,11 +39,13 @@ public interface OrganizationRepository extends ResilientJpaRepository<Organizat
|
|||
|
||||
/* Custom OrganizationRepository methods */
|
||||
/* ************************************* */
|
||||
@EntityGraph(attributePaths = "parent")
|
||||
Optional<Organization> findOneByUser(User user);
|
||||
|
||||
@Query("select organization from Organization organization where organization.outputInventory = true and organization.organizationType.nature = com.oguerreiro.resilient.domain.enumeration.OrganizationNature.ORGANIZATION order by (CASE WHEN organization.parent IS NULL THEN 0 ELSE 1 END), (CASE WHEN organization.sort IS NULL THEN 1 ELSE 0 END), organization.sort asc")
|
||||
List<Organization> findAllOrganizationForOutput();
|
||||
|
||||
@EntityGraph(attributePaths = "parent")
|
||||
Optional<Organization> findOneByCode(String code);
|
||||
|
||||
@Query("""
|
||||
|
|
|
@ -155,8 +155,9 @@ public class Saml2AuthenticationHandler implements AuthenticationSuccessHandler,
|
|||
}
|
||||
|
||||
// Create a ResilientUserDetails and replace Principal
|
||||
Organization parentOrganization = userOrganization.getParent();
|
||||
ResilientUserDetails userdetails = new ResilientUserDetails(username, "MOCK-PWD", authorities, securityGroup,
|
||||
userOrganization, "pt-PT");
|
||||
userOrganization.getParent(), "pt-PT");
|
||||
|
||||
Saml2Authentication newAuthentication = new Saml2Authentication(userdetails, samlXMLResponse,
|
||||
userdetails.getAuthorities());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue