ldap-openldap.feature 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. # SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  2. # SPDX-License-Identifier: AGPL-3.0-or-later
  3. Feature: LDAP
  4. Background:
  5. Given using api version "2"
  6. And having a valid LDAP configuration
  7. Scenario: Test valid configuration by logging in
  8. Given Logging in using web as "alice"
  9. And Sending a "GET" to "/remote.php/webdav/welcome.txt" with requesttoken
  10. Then the HTTP status code should be "200"
  11. Scenario: Test valid configuration with port in the hostname by logging in
  12. Given modify LDAP configuration
  13. | ldapHost | openldap:389 |
  14. And cookies are reset
  15. And Logging in using web as "alice"
  16. And Sending a "GET" to "/remote.php/webdav/welcome.txt" with requesttoken
  17. Then the HTTP status code should be "200"
  18. Scenario: Test valid configuration with LDAP protocol by logging in
  19. Given modify LDAP configuration
  20. | ldapHost | ldap://openldap |
  21. And cookies are reset
  22. And Logging in using web as "alice"
  23. And Sending a "GET" to "/remote.php/webdav/welcome.txt" with requesttoken
  24. Then the HTTP status code should be "200"
  25. Scenario: Test valid configuration with LDAP protocol and port by logging in
  26. Given modify LDAP configuration
  27. | ldapHost | ldap://openldap:389 |
  28. And cookies are reset
  29. And Logging in using web as "alice"
  30. And Sending a "GET" to "/remote.php/webdav/welcome.txt" with requesttoken
  31. Then the HTTP status code should be "200"
  32. Scenario: Look for a known LDAP user
  33. Given As an "admin"
  34. And sending "GET" to "/cloud/users?search=alice"
  35. Then the OCS status code should be "200"
  36. And looking up details for the first result matches expectations
  37. | email | alice@nextcloud.ci |
  38. | displayname | Alice |
  39. Scenario: Test group filter with one specific group
  40. Given modify LDAP configuration
  41. | ldapGroupFilter | cn=RedGroup |
  42. | ldapGroupMemberAssocAttr | member |
  43. | ldapBaseGroups | ou=Groups,ou=Ordinary,dc=nextcloud,dc=ci |
  44. And As an "admin"
  45. And sending "GET" to "/cloud/groups"
  46. Then the OCS status code should be "200"
  47. And the "groups" result should match
  48. | RedGroup | 1 |
  49. | GreenGroup | 0 |
  50. | BlueGroup | 0 |
  51. | PurpleGroup | 0 |
  52. Scenario: Test group filter with two specific groups
  53. Given modify LDAP configuration
  54. | ldapGroupFilter | (\|(cn=RedGroup)(cn=GreenGroup)) |
  55. | ldapGroupMemberAssocAttr | member |
  56. | ldapBaseGroups | ou=Groups,ou=Ordinary,dc=nextcloud,dc=ci |
  57. And As an "admin"
  58. And sending "GET" to "/cloud/groups"
  59. Then the OCS status code should be "200"
  60. And the "groups" result should match
  61. | RedGroup | 1 |
  62. | GreenGroup | 1 |
  63. | BlueGroup | 0 |
  64. | PurpleGroup | 0 |
  65. Scenario: Test group filter ruling out a group from a different base
  66. Given modify LDAP configuration
  67. | ldapGroupFilter | (objectClass=groupOfNames) |
  68. | ldapGroupMemberAssocAttr | member |
  69. | ldapBaseGroups | ou=Groups,ou=Ordinary,dc=nextcloud,dc=ci |
  70. And As an "admin"
  71. And sending "GET" to "/cloud/groups"
  72. Then the OCS status code should be "200"
  73. And the "groups" result should match
  74. | RedGroup | 1 |
  75. | GreenGroup | 1 |
  76. | BlueGroup | 1 |
  77. | PurpleGroup | 1 |
  78. | SquareGroup | 0 |
  79. Scenario: Test backup server
  80. Given modify LDAP configuration
  81. | ldapBackupHost | openldap |
  82. | ldapBackupPort | 389 |
  83. | ldapHost | foo.bar |
  84. | ldapPort | 2456 |
  85. And Logging in using web as "alice"
  86. Then the HTTP status code should be "200"
  87. Scenario: Test backup server offline
  88. Given modify LDAP configuration
  89. | ldapBackupHost | off.line |
  90. | ldapBackupPort | 3892 |
  91. | ldapHost | foo.bar |
  92. | ldapPort | 2456 |
  93. Then Expect ServerException on failed web login as "alice"
  94. Scenario: Test LDAP server offline, no backup server
  95. Given modify LDAP configuration
  96. | ldapHost | foo.bar |
  97. | ldapPort | 2456 |
  98. Then Expect ServerException on failed web login as "alice"
  99. Scenario: Test LDAP group membership with intermediate groups not matching filter
  100. Given modify LDAP configuration
  101. | ldapBaseGroups | ou=OtherGroups,dc=nextcloud,dc=ci |
  102. | ldapGroupFilter | (&(cn=Gardeners)(objectclass=groupOfNames)) |
  103. | ldapNestedGroups | 1 |
  104. | useMemberOfToDetectMembership | 1 |
  105. | ldapUserFilter | (&(objectclass=inetorgperson)(!(uid=alice))) |
  106. | ldapExpertUsernameAttr | uid |
  107. | ldapGroupMemberAssocAttr | member |
  108. And As an "admin"
  109. # for population
  110. And sending "GET" to "/cloud/groups"
  111. And sending "GET" to "/cloud/groups/Gardeners/users"
  112. Then the OCS status code should be "200"
  113. And the "users" result should match
  114. | alice | 0 |
  115. | clara | 1 |
  116. | elisa | 1 |
  117. | gustaf | 1 |
  118. | jesper | 1 |
  119. Scenario: Test LDAP group membership with intermediate groups not matching filter and without memberof
  120. Given modify LDAP configuration
  121. | ldapBaseGroups | ou=OtherGroups,dc=nextcloud,dc=ci |
  122. | ldapGroupFilter | (&(cn=Gardeners)(objectclass=groupOfNames)) |
  123. | ldapNestedGroups | 1 |
  124. | useMemberOfToDetectMembership | 0 |
  125. | ldapUserFilter | (&(objectclass=inetorgperson)(!(uid=alice))) |
  126. | ldapExpertUsernameAttr | uid |
  127. | ldapGroupMemberAssocAttr | member |
  128. And As an "admin"
  129. # for population
  130. And sending "GET" to "/cloud/groups"
  131. And sending "GET" to "/cloud/groups/Gardeners/users"
  132. Then the OCS status code should be "200"
  133. And the "users" result should match
  134. | alice | 0 |
  135. | clara | 1 |
  136. | elisa | 1 |
  137. | gustaf | 1 |
  138. | jesper | 1 |
  139. Scenario: Test LDAP group membership with intermediate groups not matching filter, numeric group ids
  140. Given modify LDAP configuration
  141. | ldapBaseGroups | ou=NumericGroups,dc=nextcloud,dc=ci |
  142. | ldapGroupFilter | (&(cn=2000)(objectclass=groupOfNames)) |
  143. | ldapNestedGroups | 1 |
  144. | useMemberOfToDetectMembership | 1 |
  145. | ldapUserFilter | (&(objectclass=inetorgperson)(!(uid=alice))) |
  146. | ldapExpertUsernameAttr | uid |
  147. | ldapGroupMemberAssocAttr | member |
  148. And As an "admin"
  149. # for population
  150. And sending "GET" to "/cloud/groups"
  151. And sending "GET" to "/cloud/groups/2000/users"
  152. Then the OCS status code should be "200"
  153. And the "users" result should match
  154. | alice | 0 |
  155. | clara | 1 |
  156. | elisa | 1 |
  157. | gustaf | 1 |
  158. | jesper | 1 |