-
Notifications
You must be signed in to change notification settings - Fork 160
/
UserServiceI9n.feature
187 lines (176 loc) · 8.02 KB
/
UserServiceI9n.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
###############################################################################
# Copyright (c) 2017, 2019 Eurotech and/or its affiliates and others
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Eurotech - initial API and implementation
###############################################################################
@user
@userService
@integration
Feature: User Service Integration
User Service integration scenarios
Scenario: Init Security Context for all scenarios
Given Init Security Context
Scenario: Start event broker for all scenarios
Given Start Event Broker
Scenario: Deleting user in account that is lower in hierarchy
Using user A in in different scope than user B, try to delete user B. Scope of user A is one
level higher than scope of B. Scope of A is parent of scope B. This allows user A to delete
user B.
When I login as user with name "kapua-sys" and password "kapua-password"
And I configure account service
| type | name | value |
| boolean | infiniteChildEntities | true |
| integer | maxNumberChildEntities | 50 |
And I configure user service
| type | name | value |
| boolean | infiniteChildEntities | true |
| integer | maxNumberChildEntities | 5 |
| boolean | lockoutPolicy.enabled | false |
| integer | lockoutPolicy.maxFailures | 3 |
| integer | lockoutPolicy.resetAfter | 300 |
| integer | lockoutPolicy.lockDuration | 3 |
Given Account
| name | scopeId |
| account-a | 1 |
And I configure account service
| type | name | value |
| boolean | infiniteChildEntities | true |
| integer | maxNumberChildEntities | 5 |
And I configure user service
| type | name | value |
| boolean | infiniteChildEntities | true |
| integer | maxNumberChildEntities | 5 |
| boolean | lockoutPolicy.enabled | false |
| integer | lockoutPolicy.maxFailures | 3 |
| integer | lockoutPolicy.resetAfter | 300 |
| integer | lockoutPolicy.lockDuration | 3 |
And User A
| name | displayName | email | phoneNumber | status | userType |
| kapua-a | Kapua User A | kapua_a@kapua.com | +386 31 323 444 | ENABLED | INTERNAL |
And Credentials
| name | password | enabled |
| kapua-a | ToManySecrets123# | true |
And Add permissions to the last created user
| domain | action |
| user | read |
| user | write |
| user | delete |
And A generic user
| name | displayName | email | phoneNumber | status | userType |
| kapua-g | Kapua User G | kapua_g@kapua.com | +386 31 323 444 | ENABLED | INTERNAL |
And Account
| name |
| account-b |
And I configure user service
| type | name | value |
| boolean | infiniteChildEntities | true |
| integer | maxNumberChildEntities | 5 |
| boolean | lockoutPolicy.enabled | false |
| integer | lockoutPolicy.maxFailures | 3 |
| integer | lockoutPolicy.resetAfter | 300 |
| integer | lockoutPolicy.lockDuration | 3 |
And User B
| name | displayName | email | phoneNumber | status | userType |
| kapua-b | Kapua User B | kapua_b@kapua.com | +386 31 323 555 | ENABLED | INTERNAL |
And Credentials
| name | password |
| kapua-b | ToManySecrets123# |
And Add permissions to the last created user
| domain | action |
| user | read |
| user | write |
| user | delete |
And I logout
When I login as user with name "kapua-a" and password "ToManySecrets123#"
When I try to delete user "kapua-g"
Then No exception was thrown
Given I expect the exception "SubjectUnauthorizedException" with the text "Missing permission: user:read:"
When I try to delete user "kapua-b"
Then An exception was thrown
And I logout
Scenario: Deleting user in account that is higher in hierarchy
Using user B in in different scope than user A, try to delete user A. Scope of user B is one
level lower than scope of A. Scope of A is parent of scope B. Subordinate scope should not be
allowed to delete user in parent scope, unless it has permissions in that scope.
When I login as user with name "kapua-sys" and password "kapua-password"
And I configure account service
| type | name | value |
| boolean | infiniteChildEntities | true |
| integer | maxNumberChildEntities | 50 |
And I configure user service
| type | name | value |
| boolean | infiniteChildEntities | true |
| integer | maxNumberChildEntities | 50 |
| boolean | lockoutPolicy.enabled | false |
| integer | lockoutPolicy.maxFailures | 3 |
| integer | lockoutPolicy.resetAfter | 300 |
| integer | lockoutPolicy.lockDuration | 3 |
Given Account
| name | scopeId |
| account-a | 1 |
And I configure account service
| type | name | value |
| boolean | infiniteChildEntities | true |
| integer | maxNumberChildEntities | 10 |
And I configure user service
| type | name | value |
| boolean | infiniteChildEntities | true |
| integer | maxNumberChildEntities | 5 |
| boolean | lockoutPolicy.enabled | false |
| integer | lockoutPolicy.maxFailures | 3 |
| integer | lockoutPolicy.resetAfter | 300 |
| integer | lockoutPolicy.lockDuration | 3 |
And User A
| name | displayName | email | phoneNumber | status | userType |
| kapua-a | Kapua User A | kapua_a@kapua.com | +386 31 323 444 | ENABLED | INTERNAL |
And Credentials
| name | password | enabled |
| kapua-a | ToManySecrets123# | true |
And Add permissions to the last created user
| domain | action |
| user | read |
| user | write |
| user | delete |
Given Account
| name |
| account-b |
And I configure account service
| type | name | value |
| boolean | infiniteChildEntities | true |
| integer | maxNumberChildEntities | 10 |
And I configure user service
| type | name | value |
| boolean | infiniteChildEntities | true |
| integer | maxNumberChildEntities | 5 |
| boolean | lockoutPolicy.enabled | false |
| integer | lockoutPolicy.maxFailures | 3 |
| integer | lockoutPolicy.resetAfter | 300 |
| integer | lockoutPolicy.lockDuration | 3 |
And User B
| name | displayName | email | phoneNumber | status | userType |
| kapua-b | Kapua User B | kapua_b@kapua.com | +386 31 323 555 | ENABLED | INTERNAL |
And Credentials
| name | password | enabled |
| kapua-b | ToManySecrets123# | true |
And Add permissions to the last created user
| domain | action |
| user | read |
| user | write |
| user | delete |
And I logout
When I login as user with name "kapua-b" and password "ToManySecrets123#"
Then No exception was thrown
Given I expect the exception "SubjectUnauthorizedException" with the text "Missing permission: user:read:"
When I try to delete user "kapua-a"
Then An exception was thrown
And I logout
Scenario: Stop event broker for all scenarios
Given Stop Event Broker
Scenario: Reset Security Context for all scenarios
Given Reset Security Context