public ZeebeService(IEnvReader envReader, ILogger <ZeebeService> logger)
        {
            _logger = logger;
            var authServer   = envReader.GetStringValue("ZEEBE_AUTHORIZATION_SERVER_URL");
            var clientId     = envReader.GetStringValue("ZEEBE_CLIENT_ID");
            var clientSecret = envReader.GetStringValue("ZEEBE_CLIENT_SECRET");
            var zeebeUrl     = envReader.GetStringValue("ZEEBE_ADDRESS");

            char[] port =
            {
                '4', '3', ':'
            };
            var audience = zeebeUrl?.TrimEnd(port);

            _client =
                ZeebeClient.Builder()
                .UseGatewayAddress(zeebeUrl)
                .UseTransportEncryption()
                .UseAccessTokenSupplier(
                    CamundaCloudTokenProvider.Builder()
                    .UseAuthServer(authServer)
                    .UseClientId(clientId)
                    .UseClientSecret(clientSecret)
                    .UseAudience(audience)
                    .Build())
                .Build();
        }
Ejemplo n.º 2
0
        public ZeebeService(IConfiguration config, ILogger <ZeebeService> logger)
        {
            Configuration = config;
            var authServer   = Configuration["ZEEBE_AUTHORIZATION_SERVER_URL"];
            var clientId     = Configuration["ZEEBE_CLIENT_ID"];
            var clientSecret = Configuration["ZEEBE_CLIENT_SECRET"];
            var zeebeUrl     = Configuration["ZEEBE_ADDRESS"];

            char[] port =
            {
                '4', '3', ':'
            };
            var audience = zeebeUrl?.TrimEnd(port);

            _logger = logger;

            _client =
                ZeebeClient.Builder()
                .UseLoggerFactory(new NLogLoggerFactory())
                .UseGatewayAddress(zeebeUrl)
                .UseTransportEncryption()
                .UseAccessTokenSupplier(
                    CamundaCloudTokenProvider.Builder()
                    .UseAuthServer(authServer)
                    .UseClientId(clientId)
                    .UseClientSecret(clientSecret)
                    .UseAudience(audience)
                    .Build())
                .Build();
        }
 /// <summary>
 /// Adds the Zeebe builders to the IServiceCollection
 /// </summary>
 /// <param name="services">the collection where the zeebe services are appended</param>
 /// <returns>the service collection</returns>
 public static IServiceCollection AddZeebeBuilders(this IServiceCollection services)
 {
     services.AddTransient(serviceProvider =>
     {
         var loggerFactory = serviceProvider.GetService <ILoggerFactory>();
         return(ZeebeClient.Builder().UseLoggerFactory(loggerFactory));
     });
     services.AddTransient(serviceProvider =>
     {
         var loggerFactory = serviceProvider.GetService <ILoggerFactory>();
         return(CamundaCloudTokenProvider.Builder().UseLoggerFactory(loggerFactory));
     });
     return(services);
 }
Ejemplo n.º 4
0
        public void Init()
        {
            TokenProvider = CamundaCloudTokenProvider
                            .Builder()
                            .UseAuthServer("https://local.de")
                            .UseClientId("ID")
                            .UseClientSecret("SECRET")
                            .UseAudience("AUDIENCE")
                            .Build();

            MessageHandlerStub = new HttpMessageHandlerStub();
            TokenProvider.HttpMessageHandler = MessageHandlerStub;
            TokenStoragePath = Path.GetTempPath() + ".zeebe/";
            TokenProvider.TokenStoragePath = TokenStoragePath;
            ExpiresIn = 3600;
            Token     = "REQUESTED_TOKEN";
        }
Ejemplo n.º 5
0
        public ZeebeService(BpmServerConnectionSettings bpmOptions)
        {
            var validator = new BpmServerConnectionSettingsValidator();

            validator.ValidateAndThrow(bpmOptions);

            //Discard any potential :443 port at the end
            char[] port     = { '4', '3', ':' };
            var    audience = bpmOptions.Address.TrimEnd(port);

            _client =
                ZeebeClient.Builder()
                .UseGatewayAddress(bpmOptions.Address)
                .UseTransportEncryption()
                .UseAccessTokenSupplier(
                    CamundaCloudTokenProvider.Builder()
                    .UseAuthServer(bpmOptions.AuthServer)
                    .UseClientId(bpmOptions.ClientId)
                    .UseClientSecret(bpmOptions.ClientSecret)
                    .UseAudience(audience)
                    .Build())
                .Build();
        }