Skip to content

Commit 52a914d

Browse files
VicNguVictor Nguyen
andauthored
Fixed Auth not setting properties field (#54)
Signed-off-by: Victor Nguyen <victor.nguyen@acronis.com> Co-authored-by: Victor Nguyen <victor.nguyen@acronis.com>
1 parent 397ae25 commit 52a914d

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

model/auth.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ func (a *Auth) UnmarshalJSON(data []byte) error {
9393
if err := unmarshalKey("properties", auth, authProperties); err != nil {
9494
return err
9595
}
96+
97+
a.Properties = authProperties
9698
return nil
9799
}
98100

parser/parser_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ func TestFromFile(t *testing.T) {
112112
assert.NotNil(t, operationState)
113113
assert.NotEmpty(t, operationState.Actions)
114114
assert.Equal(t, "startApplicationWorkflowId", operationState.Actions[0].SubFlowRef.WorkflowID)
115+
assert.NotNil(t, w.Auth)
116+
assert.Equal(t, "testAuth", w.Auth.Name)
117+
assert.Equal(t, model.AuthTypeBearer, w.Auth.Scheme)
118+
bearerProperties := w.Auth.Properties.(*model.BearerAuthProperties).Token
119+
assert.Equal(t, "test_token", bearerProperties)
115120
},
116121
"./testdata/workflows/applicationrequest.rp.json": func(t *testing.T, w *model.Workflow) {
117122
assert.IsType(t, &model.DataBasedSwitchState{}, w.States[0])

parser/testdata/workflows/applicationrequest.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
"description": "Determine if applicant request is valid",
66
"start": "CheckApplication",
77
"specVersion": "0.7",
8+
"auth": {
9+
"name": "testAuth",
10+
"scheme": "bearer",
11+
"properties": {
12+
"token": "test_token"
13+
}
14+
},
815
"functions": [
916
{
1017
"name": "sendRejectionEmailFunction",

0 commit comments

Comments
 (0)