use of com.evolveum.midpoint.xml.ns._public.common.common_3.AuthenticationsPolicyType 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());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AuthenticationsPolicyType 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());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AuthenticationsPolicyType 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());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AuthenticationsPolicyType in project midpoint by Evolveum.
the class MidpointAnonymousAuthenticationFilter method createAuthentication.
protected Authentication createAuthentication(HttpServletRequest request) {
Authentication auth = createBasicAuthentication(request);
MidpointAuthentication authentication = new MidpointAuthentication(SecurityPolicyUtil.createDefaultSequence());
AuthenticationsPolicyType authenticationsPolicy;
try {
authenticationsPolicy = SecurityPolicyUtil.createDefaultAuthenticationPolicy(NO_CUSTOM_IGNORED_LOCAL_PATH, prismContext.getSchemaRegistry());
} catch (SchemaException e) {
LOGGER.error("Couldn't get default authentication policy");
throw new IllegalArgumentException("Couldn't get default authentication policy", e);
}
AuthenticationSequenceType sequence = SecurityPolicyUtil.createDefaultSequence();
AuthenticationChannel authenticationChannel = AuthSequenceUtil.buildAuthChannel(authChannelRegistry, sequence);
List<AuthModule> authModules = AuthSequenceUtil.buildModuleFilters(authRegistry, sequence, request, authenticationsPolicy.getModules(), null, new HashMap<>(), authenticationChannel);
authentication.setAuthModules(authModules);
if (authModules != null) {
ModuleAuthenticationImpl module = (ModuleAuthenticationImpl) authModules.get(0).getBaseModuleAuthentication();
module.setAuthentication(auth);
authentication.addAuthentications(module);
}
authentication.setPrincipal(auth.getPrincipal());
return authentication;
}
Aggregations