use of org.apache.syncope.client.lib.AnonymousAuthenticationHandler in project syncope by apache.
the class VirSchemaITCase method anonymous.
@Test
public void anonymous() {
SchemaService unauthenticated = clientFactory.create().getService(SchemaService.class);
try {
unauthenticated.search(new SchemaQuery.Builder().type(SchemaType.VIRTUAL).build());
fail("This should not happen");
} catch (AccessControlException e) {
assertNotNull(e);
}
SchemaService anonymous = clientFactory.create(new AnonymousAuthenticationHandler(ANONYMOUS_UNAME, ANONYMOUS_KEY)).getService(SchemaService.class);
assertFalse(anonymous.search(new SchemaQuery.Builder().type(SchemaType.VIRTUAL).build()).isEmpty());
}
use of org.apache.syncope.client.lib.AnonymousAuthenticationHandler in project syncope by apache.
the class SAML2ITCase method setup.
@BeforeAll
public static void setup() {
anonymous = new SyncopeClientFactoryBean().setAddress(ADDRESS).create(new AnonymousAuthenticationHandler(ANONYMOUS_UNAME, ANONYMOUS_KEY));
WSSConfig.init();
OpenSAMLUtil.initSamlEngine(false);
}
use of org.apache.syncope.client.lib.AnonymousAuthenticationHandler in project syncope by apache.
the class GroupITCase method anonymous.
@Test
public void anonymous() {
GroupService unauthenticated = clientFactory.create().getService(GroupService.class);
try {
unauthenticated.search(new AnyQuery.Builder().realm("/even").build());
fail("This should not happen");
} catch (AccessControlException e) {
assertNotNull(e);
}
SyncopeClient anonymous = clientFactory.create(new AnonymousAuthenticationHandler(ANONYMOUS_UNAME, ANONYMOUS_KEY));
try {
anonymous.getService(GroupService.class).search(new AnyQuery.Builder().realm("/even").build());
fail("This should not happen");
} catch (ForbiddenException e) {
assertNotNull(e);
}
assertFalse(anonymous.getService(SyncopeService.class).searchAssignableGroups("/even", null, 1, 100).getResult().isEmpty());
}
use of org.apache.syncope.client.lib.AnonymousAuthenticationHandler in project syncope by apache.
the class SyncopeConsoleApplication method getDomains.
public List<String> getDomains() {
synchronized (LOG) {
if (domains == null) {
domains = newClientFactory().create(new AnonymousAuthenticationHandler(anonymousUser, anonymousKey)).getService(DomainService.class).list().stream().map(EntityTO::getKey).collect(Collectors.toList());
domains.add(0, SyncopeConstants.MASTER_DOMAIN);
domains = ListUtils.unmodifiableList(domains);
}
}
return domains;
}
use of org.apache.syncope.client.lib.AnonymousAuthenticationHandler in project syncope by apache.
the class SAML2SPAgentSetup method contextInitialized.
@Override
public void contextInitialized(final ServletContextEvent sce) {
// read saml2spagent.properties
Properties props = PropertyUtils.read(getClass(), SAML2SP_AGENT_PROPERTIES, "conf.directory").getLeft();
String anonymousUser = props.getProperty("anonymousUser");
assertNotNull(anonymousUser, "<anonymousUser>");
String anonymousKey = props.getProperty("anonymousKey");
assertNotNull(anonymousKey, "<anonymousKey>");
String scheme = props.getProperty("scheme");
assertNotNull(scheme, "<scheme>");
String host = props.getProperty("host");
assertNotNull(host, "<host>");
String port = props.getProperty("port");
assertNotNull(port, "<port>");
String rootPath = props.getProperty("rootPath");
assertNotNull(rootPath, "<rootPath>");
String useGZIPCompression = props.getProperty("useGZIPCompression");
assertNotNull(useGZIPCompression, "<useGZIPCompression>");
SyncopeClientFactoryBean clientFactory = new SyncopeClientFactoryBean().setAddress(scheme + "://" + host + ":" + port + "/" + rootPath).setUseCompression(BooleanUtils.toBoolean(useGZIPCompression));
sce.getServletContext().setAttribute(Constants.SYNCOPE_CLIENT_FACTORY, clientFactory);
sce.getServletContext().setAttribute(Constants.SYNCOPE_ANONYMOUS_CLIENT, clientFactory.create(new AnonymousAuthenticationHandler(anonymousUser, anonymousKey)));
}
Aggregations