[IOT-2463] Fix CTT failure for Get /oic/sec/roles
authorIbrahim Esmat <iesmat@microsoft.com>
Tue, 1 Aug 2017 22:47:29 +0000 (15:47 -0700)
committerRandeep Singh <randeep.s@samsung.com>
Thu, 3 Aug 2017 06:23:01 +0000 (06:23 +0000)
commitd8daf9060c3ae02978c0358d19433169ccc97447
tree9df2e4072e359b34abac4972b01a347531b7ac17
parent28c09f7365cfae2d9d6b2a4d41c6f2da9614fd5b
[IOT-2463] Fix CTT failure for Get /oic/sec/roles

Currently the GET request to the /oic/sec/roles resource will fail
with a 400 Bad Request code if the client doesn't have a Public Key
(non-certificate auth) or if the Public Key doesn't match any roles
certificates.

However, that is incorrect since the GET request to the
/oic/sec/roles resource was correct, it just doesn't have any roles
associated with it.

Changed the /oic/sec/roles resource to return an empty "roles" array
if the client doesn't have a Public Key or if the Public Key doesn't
match any roles certificates. At minimum, the return should be:

{
  "roles": [ ],
  "rt": ["oic.r.roles"],
  "if": ["oic.if.baseline"]
}

Testcase: CT1.7.9.1 Verify Security Virtual Resources conform to OIC
Schema

Change-Id: Id71c233875a6ef9e251f2adccd48907e5dedb1a1
Signed-off-by: Ibrahim Esmat <iesmat@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/21733
Reviewed-by: Kevin Kane <kkane@microsoft.com>
Reviewed-by: Alex Kelley <alexke@microsoft.com>
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Randeep Singh <randeep.s@samsung.com>
resource/csdk/security/src/rolesresource.c