Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit ea5223ce authored by Marco Amoia's avatar Marco Amoia
Browse files

Merge branch 'feature/fix-attribute-mapping' into 'develop'

Filter enabled ida to role mappings

See merge request !101
parents 0ba04b63 461bbdda
No related branches found
No related tags found
2 merge requests!106Release,!101Filter enabled ida to role mappings
Pipeline #219391 passed with warnings
......@@ -17,7 +17,7 @@ public class EchoDTO {
ConnectionStatus connectionStatus;
MTLSStatus mtlsStatus;
List<String> identityAttributes = new ArrayList<>();
List<String> userIdentityAttributes = new ArrayList<>();
@JsonUnwrapped
ParticipantWithIdentityAttributesDTO participant;
......
......@@ -70,7 +70,7 @@ public class AgentServiceImpl implements AgentService {
boolean hasCredential = credentialService.hasCredential();
echoDTO.setMtlsStatus(hasCredential ? EchoDTO.MTLSStatus.SECURED : EchoDTO.MTLSStatus.NOT_SECURED);
echoDTO.setConnectionStatus(EchoDTO.ConnectionStatus.NOT_CONNECTED);
echoDTO.setIdentityAttributes(jwtService.getIdentityAttributes());
echoDTO.setUserIdentityAttributes(jwtService.getIdentityAttributes());
if (hasCredential) {
try {
......
......@@ -146,6 +146,7 @@ public class RoleServiceImpl implements RoleService {
return roleRepository.findByNameIn(rolesName).stream()
.map(Role::getAssignedIdentityAttributes)
.flatMap(Collection::stream)
.filter(IdentityAttributeRoles::getEnabled)
.map(IdentityAttributeRoles::getIdaCode)
.distinct()
.toList();
......
......@@ -137,7 +137,7 @@ class AgentServiceImplTest {
var identityAttributes = List.of("CodeIA_004", "CodeIA_005");
String ephemeralProof = Gen.string().hex().get();
EchoDTO expectedEcho = an(EchoDTO.class);
expectedEcho.setIdentityAttributes(identityAttributes);
expectedEcho.setUserIdentityAttributes(identityAttributes);
if (shouldCallAuthority) {
given(authorityExchange.echo()).willReturn(expectedEcho.getParticipant());
......
......@@ -339,8 +339,8 @@ class RoleServiceImplTest {
@Test
void findIdentityAttributesForUser() {
var ida1 = new IdentityAttributeRoles().setIdaCode("ida1");
var ida2 = new IdentityAttributeRoles().setIdaCode("ida2");
var ida1 = new IdentityAttributeRoles().setIdaCode("ida1").setEnabled(true);
var ida2 = new IdentityAttributeRoles().setIdaCode("ida2").setEnabled(true);
var role = new Role().setName("role").setAssignedIdentityAttributes(List.of(ida1, ida2));
var roleList = List.of(role);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment