use of io.scalecube.services.sut.security.UserProfile in project scalecube by scalecube.
the class ServiceAuthRemoteTest method beforeAll.
@BeforeAll
static void beforeAll() {
StepVerifier.setDefaultTimeout(TIMEOUT);
principalMapper = authData -> new UserProfile(authData.get("name"), authData.get("role"));
service = Microservices.builder().discovery(serviceEndpoint -> new ScalecubeServiceDiscovery().transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())).options(opts -> opts.metadata(serviceEndpoint))).transport(() -> new RSocketServiceTransport().authenticator(authenticator)).services(ServiceInfo.fromServiceInstance(new SecuredServiceImpl()).principalMapper(principalMapper).build()).startAwait();
serviceWithoutAuthenticator = Microservices.builder().discovery(serviceEndpoint -> new ScalecubeServiceDiscovery().transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())).options(opts -> opts.metadata(serviceEndpoint))).transport(RSocketServiceTransport::new).services(ServiceInfo.fromServiceInstance(new AnotherSecuredServiceImpl()).principalMapper(principalMapper).build()).startAwait();
partiallySecuredService = Microservices.builder().discovery(serviceEndpoint -> new ScalecubeServiceDiscovery().transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())).options(opts -> opts.metadata(serviceEndpoint))).transport(() -> new RSocketServiceTransport().authenticator(authenticator)).services(ServiceInfo.fromServiceInstance(new PartiallySecuredServiceImpl()).principalMapper(principalMapper).build()).startAwait();
}
Aggregations