camunda-workflow 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/README.md +20 -2
- data/lib/camunda/model.rb +2 -0
- data/lib/camunda/task.rb +2 -7
- data/lib/camunda/workflow.rb +4 -0
- data/lib/camunda/workflow/version.rb +5 -0
- data/lib/generators/camunda/spring_boot/USAGE +1 -1
- data/lib/generators/camunda/spring_boot/templates/Camunda.java +17 -0
- data/lib/generators/camunda/spring_boot/templates/application.properties +2 -0
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c08d0a47fdc375095f8a12a412e8fd338cba6c01de753777a2c007a184d6caa
|
4
|
+
data.tar.gz: 34141274cb6a630312651883a7502819e9b236fb870275a82d9561f4adae6561
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa811d101d80ea3e5bd6408c17e28215118a2c223d469bb9e60a7f8ad5ebcc991264fb3f19cd31a2a6f5fccc8f5e085220e04421fd4fa183327297fb18a28535
|
7
|
+
data.tar.gz: 833f866515b6555a0e05f893aef5d3a6603b6f933708ed5b77641fb8d9b4db4b06935bb632ef04973097a013fdc7a35858a0d1d8d918f3f0c680f616f4ca1c29
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## [Unreleased](https://github.com/amalagaura/camunda-workflow/tree/HEAD)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/amalagaura/camunda-workflow/compare/fc9ab266909628118a892082abdff953f3bc7eca...HEAD)
|
6
|
+
|
7
|
+
**Merged pull requests:**
|
8
|
+
|
9
|
+
- added authentication via templates for spring\_boot generator and Her [\#4](https://github.com/amalagaura/camunda-workflow/pull/4) ([curatingbits](https://github.com/curatingbits))
|
10
|
+
- Refactor to return proper Her models after responses [\#3](https://github.com/amalagaura/camunda-workflow/pull/3) ([amalagaura](https://github.com/amalagaura))
|
11
|
+
- Added tests for Camunda workflow [\#2](https://github.com/amalagaura/camunda-workflow/pull/2) ([curatingbits](https://github.com/curatingbits))
|
12
|
+
|
13
|
+
|
14
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
[](https://travis-ci.com/amalagaura/camunda-workflow)
|
1
|
+
[](https://travis-ci.com/amalagaura/camunda-workflow)
|
2
|
+
[](https://badge.fury.io/rb/camunda-workflow)
|
3
|
+
[](http://inch-ci.org/github/amalagaura/camunda-workflow)
|
2
4
|
# Camunda Workflow
|
3
5
|
|
4
6
|
## An opinionated interface to Camunda for Ruby/Rails apps
|
@@ -82,7 +84,21 @@ Camunda::Workflow.configure do |config|
|
|
82
84
|
config.engine_route_prefix = 'rest'
|
83
85
|
end
|
84
86
|
```
|
87
|
+
#### Enable HTTP Basic Auth for Java Spring Boot app
|
88
|
+
To add authentication to Camunda's REST API within the Java Spring Boot app change the `camunda.authentication` variable located in the
|
89
|
+
`application.properties` (bpmn/java_app/src/main/resources) file to `true`. Creating an environment variable `ENV['CAMUNDA_AUTH']` and setting a value of `true` or `false` will
|
90
|
+
set the value as well. When HTTP Basic Auth is enabled, it's required that a user with the appropriate permissions is setup in Camunda.
|
91
|
+
Otherwise, the request will return as `401 unauthorized`. Users are set up within the admin dashboard of Camunda and used to authenticate by passing an Authorization header during requests to the REST API. Below is how to configure
|
92
|
+
the `camunda_user` and `camunda_password` to be used in the header request to authenticate using HTTP Basic Auth.
|
85
93
|
|
94
|
+
```ruby
|
95
|
+
# filename initializers/camunda.rb
|
96
|
+
Camunda::Workflow.configure do |config|
|
97
|
+
config.engine_route_prefix = 'rest'
|
98
|
+
config.camunda_user = ENV['CAMUNDA_USER']
|
99
|
+
config.camunda_password = ENV['CAMUNDA_PASSWORD']
|
100
|
+
end
|
101
|
+
```
|
86
102
|
#### Generating a jar for deployment
|
87
103
|
`mvn package spring-boot:repackage`
|
88
104
|
|
@@ -155,7 +171,9 @@ For testing from the console
|
|
155
171
|
### User Tasks
|
156
172
|
#### Mark a user task complete
|
157
173
|
```ruby
|
158
|
-
Camunda::Task.
|
174
|
+
task = Camunda::Task.find_by_business_key_and_task_definition_key!(instance_business_key, task_key)
|
175
|
+
# Or you can query Camunda::Task with other parameters like assignee
|
176
|
+
task.complete!(var1: 'value')
|
159
177
|
```
|
160
178
|
|
161
179
|
### Rspec Helpers
|
data/lib/camunda/model.rb
CHANGED
@@ -8,6 +8,8 @@ class Camunda::Model
|
|
8
8
|
# Request
|
9
9
|
c.use Faraday::Request::Multipart
|
10
10
|
c.use FaradayMiddleware::EncodeJson
|
11
|
+
c.use Faraday::Request::BasicAuthentication, Camunda::Workflow.configuration.camunda_user,
|
12
|
+
Camunda::Workflow.configuration.camunda_password
|
11
13
|
# Response
|
12
14
|
c.use Faraday::Response::Logger, ActiveSupport::Logger.new(STDOUT), bodies: true if Rails.env.development?
|
13
15
|
c.use Her::Middleware::FirstLevelParseJSON
|
data/lib/camunda/task.rb
CHANGED
@@ -3,7 +3,7 @@ class Camunda::Task < Camunda::Model
|
|
3
3
|
collection_path 'task'
|
4
4
|
|
5
5
|
def self.find_by_business_key_and_task_definition_key!(instance_business_key, task_key)
|
6
|
-
find_by(
|
6
|
+
find_by(processInstanceBusinessKey: instance_business_key, taskDefinitionKey: task_key).tap do |ct|
|
7
7
|
unless ct
|
8
8
|
raise MissingTask, "Could not find Camunda Task with processInstanceBusinessKey: #{instance_business_key} " \
|
9
9
|
"and taskDefinitionKey #{task_key}"
|
@@ -11,12 +11,7 @@ class Camunda::Task < Camunda::Model
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
15
|
-
ct = find_by_business_key_and_task_definition_key!(instance_business_key, task_key)
|
16
|
-
ct.complete! variables
|
17
|
-
end
|
18
|
-
|
19
|
-
def complete!(vars)
|
14
|
+
def complete!(vars={})
|
20
15
|
self.class.post_raw("#{self.class.collection_path}/#{id}/complete", variables: serialize_variables(vars))[:response]
|
21
16
|
.tap do |response|
|
22
17
|
raise MissingTask unless response.success?
|
data/lib/camunda/workflow.rb
CHANGED
@@ -16,10 +16,14 @@ module Camunda
|
|
16
16
|
attr_accessor :max_polling_tasks
|
17
17
|
attr_accessor :long_polling_duration
|
18
18
|
attr_accessor :tenant_id
|
19
|
+
attr_accessor :camunda_user
|
20
|
+
attr_accessor :camunda_password
|
19
21
|
|
20
22
|
def initialize
|
21
23
|
@engine_url = 'http://localhost:8080'
|
22
24
|
@engine_route_prefix = 'rest-engine'
|
25
|
+
@camunda_user = ''
|
26
|
+
@camunda_password = ''
|
23
27
|
@worker_id = '0'
|
24
28
|
@lock_duration = 14.days
|
25
29
|
@max_polling_tasks = 2
|
@@ -16,8 +16,13 @@ package camunda;
|
|
16
16
|
* limitations under the License.
|
17
17
|
*/
|
18
18
|
import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication;
|
19
|
+
import org.camunda.bpm.engine.rest.security.auth.ProcessEngineAuthenticationFilter;
|
19
20
|
import org.springframework.boot.SpringApplication;
|
20
21
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
22
|
+
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
23
|
+
import org.springframework.context.annotation.Bean;
|
24
|
+
import org.springframework.beans.factory.annotation.Value;
|
25
|
+
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
21
26
|
|
22
27
|
@SpringBootApplication
|
23
28
|
@EnableProcessApplication("camunda-bpm-springboot")
|
@@ -25,4 +30,16 @@ public class Camunda {
|
|
25
30
|
public static void main(String... args) {
|
26
31
|
SpringApplication.run(Camunda.class, args);
|
27
32
|
}
|
33
|
+
|
34
|
+
@Bean
|
35
|
+
@ConditionalOnProperty(name="camunda.authentication", havingValue="true")
|
36
|
+
public FilterRegistrationBean authenticationFilter() {
|
37
|
+
FilterRegistrationBean registration = new FilterRegistrationBean();
|
38
|
+
registration.setFilter(new ProcessEngineAuthenticationFilter());
|
39
|
+
registration.addUrlPatterns("/rest/*");
|
40
|
+
registration.addInitParameter("authentication-provider", "org.camunda.bpm.engine.rest.security.auth.impl.HttpBasicAuthenticationProvider");
|
41
|
+
registration.setName("camunda-auth");
|
42
|
+
registration.setOrder(1);
|
43
|
+
return registration;
|
44
|
+
}
|
28
45
|
}
|
@@ -46,3 +46,5 @@ spring.datasource.driverClassName=org.h2.Driver
|
|
46
46
|
#camunda.bpm.license-file=file:${user.home}/.camunda/license.txt
|
47
47
|
|
48
48
|
server.port=${CAMUNDA_PORT:8080}
|
49
|
+
#To turn on HTTP Basic Auth for Camunda, set the below variable to true or set an environment variable.
|
50
|
+
camunda.authentication=${CAMUNDA_AUTH:false}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: camunda-workflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ankur Sethi
|
@@ -123,6 +123,20 @@ dependencies:
|
|
123
123
|
- - "~>"
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: 3.9.0
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: rubocop
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - "~>"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 0.75.1
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: 0.75.1
|
126
140
|
- !ruby/object:Gem::Dependency
|
127
141
|
name: simplecov
|
128
142
|
requirement: !ruby/object:Gem::Requirement
|
@@ -158,6 +172,7 @@ executables: []
|
|
158
172
|
extensions: []
|
159
173
|
extra_rdoc_files: []
|
160
174
|
files:
|
175
|
+
- CHANGELOG.md
|
161
176
|
- CONTRIBUTING.md
|
162
177
|
- LICENSE.md
|
163
178
|
- README.md
|
@@ -176,6 +191,7 @@ files:
|
|
176
191
|
- lib/camunda/task.rb
|
177
192
|
- lib/camunda/variable_serialization.rb
|
178
193
|
- lib/camunda/workflow.rb
|
194
|
+
- lib/camunda/workflow/version.rb
|
179
195
|
- lib/generators/camunda/bpmn_classes/USAGE
|
180
196
|
- lib/generators/camunda/bpmn_classes/bpmn_classes_generator.rb
|
181
197
|
- lib/generators/camunda/bpmn_classes/templates/bpmn_class.rb.template
|
@@ -203,7 +219,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
203
219
|
requirements:
|
204
220
|
- - ">="
|
205
221
|
- !ruby/object:Gem::Version
|
206
|
-
version: '2.
|
222
|
+
version: '2.5'
|
207
223
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
208
224
|
requirements:
|
209
225
|
- - ">="
|