Uploaded image for project: 'OpenAM'
  1. OpenAM
  2. OPENAM-9325

Can't create service "Social Authentication Implementations" if one of the chains is empty

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 12.0.0, 12.0.1, 12.0.2, 12.0.3, 13.0.0, 13.5.0
    • Fix Version/s: 12.0.4, 13.5.1, 14.0.0
    • Component/s: None
    • Labels:
    • Sprint:
      AM Sustaining Sprint 26

      Description

      If one of your chain doesn't have any module configured in it, you won't be able to modify/create a "Social Authentication Implementations" service

      How to reproduce

      • Create a chain "test" without configuring any module
      • Try to create a "Social Authentication Implementations" service

      expected result

      The console view for this service

      Current result

      A 500, with "An error occurred while processing this request. Contact your administrator."

      And the following stacktrace

      java.util.NoSuchElementException
        at java.util.Collections$EmptyIterator.next(Collections.java:4189)
        at com.sun.identity.authentication.service.ConfiguredSocialAuthServices.filterConfigs(ConfiguredSocialAuthServices.java:67)
        at com.sun.identity.authentication.service.ConfiguredAuthServices.getChoiceValues(ConfiguredAuthServices.java:113)
        at com.sun.identity.authentication.service.ConfiguredSocialAuthServices.getChoiceValues(ConfiguredSocialAuthServices.java:45)
        at com.sun.identity.sm.AttributeSchemaImpl.getChoiceValues(AttributeSchemaImpl.java:249)
        at com.sun.identity.sm.AttributeSchema.getChoiceValues(AttributeSchema.java:368)
        at com.sun.identity.console.property.PropertyXMLBuilderBase.getSortedChoiceValues(PropertyXMLBuilderBase.java:944)
        at com.sun.identity.console.property.PropertyXMLBuilderBase.appendChoiceValueForSelectableComponent(PropertyXMLBuilderBase.java:988)
        at com.sun.identity.console.property.PropertyXMLBuilderBase.appendChoiceValues(PropertyXMLBuilderBase.java:845)
        at com.sun.identity.console.property.PropertyXMLBuilderBase.buildAttributeSchemaTypeXML(PropertyXMLBuilderBase.java:542)
        at com.sun.identity.console.property.PropertyXMLBuilderBase.buildSchemaTypeXML(PropertyXMLBuilderBase.java:1132)
        at com.sun.identity.console.property.PropertyXMLBuilderBase.buildSchemaTypeXML(PropertyXMLBuilderBase.java:1094)
        at com.sun.identity.console.property.PropertyXMLBuilder.getXML(PropertyXMLBuilder.java:338)
        at com.sun.identity.console.property.PropertyXMLBuilder.getXML(PropertyXMLBuilder.java:237)
        at com.sun.identity.console.base.model.AMServiceProfileModelImpl.getPropertySheetXML(AMServiceProfileModelImpl.java:142)
        at com.sun.identity.console.base.AMServiceProfileViewBeanBase.getPropertySheetXML(AMServiceProfileViewBeanBase.java:249)
        at com.sun.identity.console.base.AMServiceProfileViewBeanBase.createPropertyModel(AMServiceProfileViewBeanBase.java:235)
        at com.sun.identity.console.base.AMServiceProfileViewBeanBase.initialize(AMServiceProfileViewBeanBase.java:102)
        at com.sun.identity.console.realm.ServicesEditViewBean.forwardTo(ServicesEditViewBean.java:75)
        at com.sun.identity.console.realm.ServicesViewBean.handleTblDataActionHrefRequest(ServicesViewBean.java:293)
        at com.sun.identity.console.realm.ServicesTiledView.handleTblDataActionHrefRequest(ServicesTiledView.java:51)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at com.iplanet.jato.view.command.DefaultTiledRequestHandlingCommand.execute(DefaultTiledRequestHandlingCommand.java:182)
        at com.iplanet.jato.view.RequestHandlingTiledViewBase.handleRequest(RequestHandlingTiledViewBase.java:518)
        at com.iplanet.jato.view.ViewBeanBase.dispatchInvocation(ViewBeanBase.java:802)
        at com.iplanet.jato.view.ViewBeanBase.invokeRequestHandlerInternal(ViewBeanBase.java:740)
        at com.iplanet.jato.view.ViewBeanBase.invokeRequestHandlerInternal(ViewBeanBase.java:760)
        at com.iplanet.jato.view.ViewBeanBase.invokeRequestHandler(ViewBeanBase.java:571)
        at com.iplanet.jato.ApplicationServletBase.dispatchRequest(ApplicationServletBase.java:957)
        at com.iplanet.jato.ApplicationServletBase.processRequest(ApplicationServletBase.java:615)
        at com.iplanet.jato.ApplicationServletBase.doGet(ApplicationServletBase.java:459)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.forgerock.openam.validation.ResponseValidationFilter.doFilter(ResponseValidationFilter.java:44)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at com.sun.identity.setup.AMSetupFilter.doFilter(AMSetupFilter.java:106)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.forgerock.openam.audit.context.AuditContextFilter.doFilter(AuditContextFilter.java:51)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.forgerock.openam.audit.servlet.AuditAccessServletFilter.doFilter(AuditAccessServletFilter.java:62)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)
      

      Possible fix

      In ConfiguredSocialAuthServices.java

                      ServiceConfig authConfig = parentConfig.getSubConfig(config);
                      Set<String> chainConfig = (Set<String>) authConfig.getAttributes().get(AMAuthConfigUtils.ATTR_NAME);
                      AppConfigurationEntry[] chain = AMAuthConfigUtils.parseValues(chainConfig.iterator().next());
                      for (int i = 0; i < chain.length; i++) {
                          if (getType(authMgr, chain[i]).equals(OAUTH2_TYPE)) {
                              // There's an OAuth2 module in the chain, so this could be a social authn chain
                              configs.add(config);
                          }
                      }
      

      Let's check that there is at least one module before doing

      chainConfig.iterator().next()
      if (!chainConfig.isEmpty()) { 

      maybe?

        Attachments

          Activity

            People

            • Assignee:
              markdr Mark de Reeper
              Reporter:
              quentin.castel Quentin CASTEL [X] (Inactive)
              QA Assignee:
              Joanna Wasilewska [X] (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 0h
                0h
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 3h
                3h