use of org.apereo.cas.services.InMemoryServiceRegistry in project cas by apereo.
the class ManageRegisteredServicesMultiActionControllerTests method setUp.
@Before
public void setUp() throws Exception {
this.servicesManager = new DefaultServicesManager(new InMemoryServiceRegistry());
this.registeredServiceFactory = new DefaultRegisteredServiceFactory(new DefaultAccessStrategyMapper(), policyMapper, new DefaultProxyPolicyMapper(), new DefaultRegisteredServiceMapper(), new DefaultUsernameAttributeProviderMapper(), Collections.emptyList());
this.controller = new ManageRegisteredServicesMultiActionController(this.servicesManager, this.registeredServiceFactory, new WebApplicationServiceFactory(), "https://cas.example.org");
}
use of org.apereo.cas.services.InMemoryServiceRegistry in project cas by apereo.
the class CasCoreServicesConfiguration method serviceRegistry.
@ConditionalOnMissingBean(name = "serviceRegistry")
@Bean
@RefreshScope
public ServiceRegistry serviceRegistry() {
final List<ServiceRegistryExecutionPlanConfigurer> configurers = ObjectUtils.defaultIfNull(serviceRegistryDaoConfigurers.getIfAvailable(), new ArrayList<>(0));
final DefaultServiceRegistryExecutionPlan plan = new DefaultServiceRegistryExecutionPlan();
configurers.forEach(c -> {
final String name = StringUtils.removePattern(c.getClass().getSimpleName(), "\\$.+");
LOGGER.debug("Configuring service registry [{}]", name);
c.configureServiceRegistry(plan);
});
final Predicate filter = Predicates.not(Predicates.instanceOf(ImmutableServiceRegistry.class));
if (plan.getServiceRegistries(filter).isEmpty()) {
final List<RegisteredService> services = new ArrayList<>();
LOGGER.warn("Runtime memory is used as the persistence storage for retrieving and persisting service definitions. " + "Changes that are made to service definitions during runtime WILL be LOST when the web server is restarted. " + "Ideally for production, you need to choose a storage option (JDBC, etc) to store and track service definitions.");
if (applicationContext.containsBean("inMemoryRegisteredServices")) {
services.addAll(applicationContext.getBean("inMemoryRegisteredServices", List.class));
LOGGER.debug("Found a list of registered services in the application context. Registering services [{}]", services);
}
plan.registerServiceRegistry(new InMemoryServiceRegistry(services));
}
return new ChainingServiceRegistry(plan.getServiceRegistries());
}
use of org.apereo.cas.services.InMemoryServiceRegistry in project cas by apereo.
the class SamlRegisteredServiceTests method checkPattern.
@Test
public void checkPattern() {
final SamlRegisteredService service = new SamlRegisteredService();
service.setName(SAML_SERVICE);
service.setServiceId("^http://.+");
service.setMetadataLocation(METADATA_LOCATION);
final InMemoryServiceRegistry dao = new InMemoryServiceRegistry();
dao.setRegisteredServices(Collections.singletonList(service));
final DefaultServicesManager impl = new DefaultServicesManager(dao, mock(ApplicationEventPublisher.class));
impl.load();
final RegisteredService s = impl.findServiceBy(new WebApplicationServiceFactory().createService("http://mmoayyed.unicon.net:8081/sp/saml/SSO"));
assertNotNull(s);
}
use of org.apereo.cas.services.InMemoryServiceRegistry in project cas by apereo.
the class RegisteredServiceAuthenticationPolicySingleSignOnParticipationStrategyTests method getSingleSignOnStrategy.
private static SingleSignOnParticipationStrategy getSingleSignOnStrategy(final RegisteredService svc, final TicketRegistry ticketRegistry) {
val appCtx = new StaticApplicationContext();
appCtx.refresh();
val context = ServicesManagerConfigurationContext.builder().serviceRegistry(new InMemoryServiceRegistry(appCtx, List.of(svc), List.of())).applicationContext(appCtx).environments(new HashSet<>(0)).servicesCache(Caffeine.newBuilder().build()).registeredServiceLocators(List.of(new DefaultServicesManagerRegisteredServiceLocator())).build();
val servicesManager = new DefaultServicesManager(context);
servicesManager.load();
val authenticationExecutionPlan = new DefaultAuthenticationEventExecutionPlan();
authenticationExecutionPlan.registerAuthenticationHandler(new SimpleTestUsernamePasswordAuthenticationHandler());
return new RegisteredServiceAuthenticationPolicySingleSignOnParticipationStrategy(servicesManager, new DefaultTicketRegistrySupport(ticketRegistry), new DefaultAuthenticationServiceSelectionPlan(new DefaultAuthenticationServiceSelectionStrategy()), authenticationExecutionPlan, appCtx);
}
use of org.apereo.cas.services.InMemoryServiceRegistry in project cas by apereo.
the class DefaultDelegatedClientIdentityProviderRedirectionStrategyTests method setup.
@BeforeEach
public void setup() {
val appCtx = new StaticApplicationContext();
appCtx.refresh();
val context = ServicesManagerConfigurationContext.builder().serviceRegistry(new InMemoryServiceRegistry(appCtx)).applicationContext(appCtx).environments(new HashSet<>(0)).servicesCache(Caffeine.newBuilder().build()).registeredServiceLocators(List.of(new DefaultServicesManagerRegisteredServiceLocator())).build();
this.servicesManager = new DefaultServicesManager(context);
this.casCookieBuilder = mock(CasCookieBuilder.class);
}
Aggregations