Skip to content

Commit 3d33aaa

Browse files
author
Frank Martinez
authoredMay 14, 2019
Merge pull request #52 from fm-tibco/master
update rest activity defaults
2 parents cf6cec4 + e5897b9 commit 3d33aaa

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed
 

‎activity/rest/README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,16 @@ flogo install github.com/project-flogo/contrib/activity/rest
2626
| sslConfig | object | SSL configuration
2727

2828

29-
#### *sslConfig* Object:
29+
#### *sslConfig* Object:
3030
| Property | Type | Description
3131
|:--- | :--- | :---
32-
| skipVerify | bool | Skip SSL validation, defaults to false
33-
| useSystemCert | bool | Use the systems root certificate file, defaults to false
32+
| skipVerify | bool | Skip SSL validation, defaults to true
33+
| useSystemCert | bool | Use the systems root certificate file, defaults to true
3434
| caFile | string | The path to PEM encoded root certificates file
3535
| certFile | string | The path to PEM encoded client certificate
3636
| keyFile | string | The path to PEM encoded client key
3737

38+
*Note: used if URI is https*
3839
### Input:
3940
| Name | Type | Description
4041
|:--- | :--- | :---

‎activity/rest/activity.go

+17-3
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,23 @@ func New(ctx activity.InitContext) (activity.Activity, error) {
6262
if strings.HasPrefix(s.Uri, "https") {
6363

6464
cfg := &ssl.Config{}
65-
err := cfg.FromMap(s.SSLConfig)
66-
if err != nil {
67-
return nil, err
65+
66+
if len(s.SSLConfig) != 0 {
67+
err := cfg.FromMap(s.SSLConfig)
68+
if err != nil {
69+
return nil, err
70+
}
71+
72+
if _, set := s.SSLConfig["skipVerify"]; !set {
73+
cfg.SkipVerify = true
74+
}
75+
if _, set := s.SSLConfig["useSystemCert"]; !set {
76+
cfg.UseSystemCert = true
77+
}
78+
} else {
79+
//using ssl but not configured, use defaults
80+
cfg.SkipVerify = true
81+
cfg.UseSystemCert = true
6882
}
6983

7084
tlsConfig, err := ssl.NewClientTLSConfig(cfg)

‎activity/rest/descriptor.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@
4242
{
4343
"name": "skipVerify",
4444
"type": "boolean",
45-
"value": "false",
45+
"value": "true",
4646
"description" : "Skip SSL validation"
4747
},
4848
{
4949
"name": "useSystemCert",
5050
"type": "boolean",
51-
"value": "false",
51+
"value": "true",
5252
"description" : "Use the systems root certificate file"
5353
},
5454
{

0 commit comments

Comments
 (0)
Please sign in to comment.