OpenIdentityPlatform / OpenAM

OpenAM is an open access management solution that includes Authentication, SSO, Authorization, Federation, Entitlements and Web Services Security.
https://www.openidentityplatform.org/openam
Other
768 stars 149 forks source link

Unable to create Session Service, Services fail to be listed after Session Service is registered #653

Closed sp193 closed 11 months ago

sp193 commented 11 months ago

Describe the bug The user is unable to create a "Session" service within a realm. Once created, the services cannot be listed for the realm, unless the realm is deleted.

To Reproduce Steps to reproduce the behavior:

  1. Go to a realm. Even the top-level realm will do.
  2. Click on 'Services'. A list of existing services is listed.
  3. Click on "Add a Service".
  4. From "Choose a service type", choose "Session".
  5. Click on "Create". A loading spinner briefly flashes, and then nothing happens.
  6. Since nothing happened, click on "Services" to go back to the services list. Nothing is loaded.

Expected behavior The form for setting up the session service should be displayed. The list of services for the realm should also be successfully displayed, when the service list is accessed.

Desktop (please complete the following information):

Additional context This issue may be related to 281c1d71, which was part of OPENAM-8616. For some reason, the logic for shouldBeIgnored() was changed. However, this reacts poorly with SmsJsonConverter.toJson(), where a NPE occurs if the input contains an attribute that is not part of the schema. In this case, the attribute was "cospriority". This attribute is added in classes like AMIdentity.java, but is not part of the amSession.xml schema.

At line 215, slightly before the NPE:

>
Breakpoint hit: "thread=http-nio-9090-exec-10", org.forgerock.openam.core.rest.sms.SmsJsonConverter.toJson(), line=215 bci=183

http-nio-9090-exec-10[1] locals
Method arguments:
realm = "/WISX/IOT_Platform"
attributeValuePairs = instance of java.util.HashMap(id=12868)
validate = true
parentJson = instance of org.forgerock.json.JsonValue(id=12869)
Local variables:
validAttributes = true
attributeName = "cospriority"
jsonResourceName = null
name = "cospriority"
attributeSchema = null
http-nio-9090-exec-10[1] print attributeSchema
 attributeSchema = null
http-nio-9090-exec-10[1]
http-nio-9090-exec-10[1] where
  [1] org.forgerock.openam.core.rest.sms.SmsJsonConverter.toJson (SmsJsonConverter.java:219)
  [2] org.forgerock.openam.core.rest.sms.SmsJsonConverter.toJson (SmsJsonConverter.java:167)
  [3] org.forgerock.openam.core.rest.sms.SmsSingletonProvider.addDynamicAttributes (SmsSingletonProvider.java:183)
  [4] org.forgerock.openam.core.rest.sms.SmsResourceProvider.getJsonValue (SmsResourceProvider.java:453)
  [5] org.forgerock.openam.core.rest.sms.SmsResourceProvider.getJsonValue (SmsResourceProvider.java:440)
  [6] org.forgerock.openam.core.rest.sms.SmsSingletonProvider.handleRead (SmsSingletonProvider.java:154)
...