Search in sources :

Example 1 with AuthenticationSequenceType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AuthenticationSequenceType in project midpoint by Evolveum.

the class TestAuthSequenceUtil method getSequences.

private List<AuthenticationSequenceType> getSequences() {
    List<AuthenticationSequenceType> sequences = new ArrayList<>();
    AuthenticationSequenceType sequence = new AuthenticationSequenceType();
    sequence.setName("sequence1");
    sequence.getNodeGroup().add(getReference("1"));
    sequence.setChannel(getChannel("gui1"));
    sequences.add(sequence);
    sequence = new AuthenticationSequenceType();
    sequence.setName("sequence2");
    sequence.getNodeGroup().add(getReference("1"));
    sequence.getNodeGroup().add(getReference("2"));
    sequence.setChannel(getChannel("gui2"));
    sequences.add(sequence);
    sequence = new AuthenticationSequenceType();
    sequence.setName("sequence3");
    sequence.setChannel(getChannel("gui3"));
    sequences.add(sequence);
    return sequences;
}
Also used : AuthenticationSequenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.AuthenticationSequenceType) ArrayList(java.util.ArrayList)

Example 2 with AuthenticationSequenceType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AuthenticationSequenceType in project midpoint by Evolveum.

the class AbstractPageLogin method getSequenceName.

private String getSequenceName() {
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    if (authentication instanceof MidpointAuthentication) {
        MidpointAuthentication mpAuthentication = (MidpointAuthentication) authentication;
        AuthenticationSequenceType sequence = mpAuthentication.getSequence();
        if (sequence != null && sequence.getChannel() != null && !Boolean.TRUE.equals(sequence.getChannel().isDefault()) && SecurityPolicyUtil.DEFAULT_CHANNEL.equals(sequence.getChannel().getChannelId())) {
            return sequence.getDisplayName() != null ? sequence.getDisplayName() : sequence.getName();
        }
    }
    return null;
}
Also used : MidpointAuthentication(com.evolveum.midpoint.authentication.api.config.MidpointAuthentication) Authentication(org.springframework.security.core.Authentication) AuthenticationSequenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.AuthenticationSequenceType) MidpointAuthentication(com.evolveum.midpoint.authentication.api.config.MidpointAuthentication)

Example 3 with AuthenticationSequenceType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AuthenticationSequenceType in project midpoint by Evolveum.

the class TestAuthSequenceUtil method TestGetSequenceByEmptyNodeGroups.

@Test
public void TestGetSequenceByEmptyNodeGroups() {
    AuthenticationsPolicyType authenticationPolicy = new AuthenticationsPolicyType();
    authenticationPolicy.getSequence().addAll(getSequences());
    List<AuthenticationSequenceType> sequences = AuthSequenceUtil.getSequencesForNodeGroups(new ArrayList<>(), authenticationPolicy);
    assertEquals("Wrong sequences", 1, sequences.size());
}
Also used : AuthenticationSequenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.AuthenticationSequenceType) AuthenticationsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.AuthenticationsPolicyType) AbstractHigherUnitTest(com.evolveum.midpoint.test.AbstractHigherUnitTest) Test(org.testng.annotations.Test)

Example 4 with AuthenticationSequenceType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AuthenticationSequenceType in project midpoint by Evolveum.

the class TestAuthSequenceUtil method TestGetSequenceByNodeGroups.

@Test
public void TestGetSequenceByNodeGroups() {
    AuthenticationsPolicyType authenticationPolicy = new AuthenticationsPolicyType();
    authenticationPolicy.getSequence().addAll(getSequences());
    List<ObjectReferenceType> nodeGroups = new ArrayList<>();
    nodeGroups.add(getReference("1"));
    nodeGroups.add(getReference("2"));
    List<AuthenticationSequenceType> sequences = AuthSequenceUtil.getSequencesForNodeGroups(nodeGroups, authenticationPolicy);
    assertEquals("Wrong sequences", 3, sequences.size());
}
Also used : ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) AuthenticationSequenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.AuthenticationSequenceType) ArrayList(java.util.ArrayList) AuthenticationsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.AuthenticationsPolicyType) AbstractHigherUnitTest(com.evolveum.midpoint.test.AbstractHigherUnitTest) Test(org.testng.annotations.Test)

Example 5 with AuthenticationSequenceType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AuthenticationSequenceType in project midpoint by Evolveum.

the class TestAuthSequenceUtil method TestGetSequenceByNodeGroup.

@Test
public void TestGetSequenceByNodeGroup() {
    AuthenticationsPolicyType authenticationPolicy = new AuthenticationsPolicyType();
    authenticationPolicy.getSequence().addAll(getSequences());
    List<ObjectReferenceType> nodeGroups = new ArrayList<>();
    nodeGroups.add(getReference("2"));
    List<AuthenticationSequenceType> sequences = AuthSequenceUtil.getSequencesForNodeGroups(nodeGroups, authenticationPolicy);
    assertEquals("Wrong sequences", 2, sequences.size());
}
Also used : ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) AuthenticationSequenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.AuthenticationSequenceType) ArrayList(java.util.ArrayList) AuthenticationsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.AuthenticationsPolicyType) AbstractHigherUnitTest(com.evolveum.midpoint.test.AbstractHigherUnitTest) Test(org.testng.annotations.Test)

Aggregations

AuthenticationSequenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.AuthenticationSequenceType)6 AuthenticationsPolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.AuthenticationsPolicyType)4 AbstractHigherUnitTest (com.evolveum.midpoint.test.AbstractHigherUnitTest)3 ArrayList (java.util.ArrayList)3 Test (org.testng.annotations.Test)3 MidpointAuthentication (com.evolveum.midpoint.authentication.api.config.MidpointAuthentication)2 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)2 Authentication (org.springframework.security.core.Authentication)2 AuthModule (com.evolveum.midpoint.authentication.api.AuthModule)1 AuthenticationChannel (com.evolveum.midpoint.authentication.api.AuthenticationChannel)1 ModuleAuthenticationImpl (com.evolveum.midpoint.authentication.impl.module.authentication.ModuleAuthenticationImpl)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1