title: Custom Claim Handling Failed In Single Sign On
body: <p>I am using the WSO2 Identity Server for Single Sign-On Implementations.</p>
  
  <p>In my demo applications, I am trying to get Custom claim attributes of authenticated Users from my own JDBC Database.</p>
  
  <p>I followed this <a href="http://pushpalankajaya.blogspot.in/2014/07/adding-custom-claims-to-saml-response.html#comment-form" rel="noreferrer">blog</a> of Pushpalanka.</p>
  
  <p>This worked fine for the Identity Server 5.0.0</p>
  
  <p>But when I updated Identity Server with the latest Update <strong>"WSO2-IS-5.0.0-SP01"</strong>, Custom Claim Handling stopped working.</p>
  
  <p>Following is the error stack :</p>
  
  <blockquote>
    <p>[2015-04-22 19:09:43,311] ERROR
    {org.wso2.carbon.identity.application.authentication.framework.handler.sequence.impl.DefaultStepBasedSequenceHandler}
    -  Claim handling failed! org.wso2.carbon.identity.application.authentication.framework.exception.FrameworkException:
    Index: 0, Size: 0     at
    com.wso2.sample.claim.handler.CustomClaimHandler.handleLocalClaims(CustomClaimHandler.java:200)
      at
    com.wso2.sample.claim.handler.CustomClaimHandler.handleClaimMappings(CustomClaimHandler.java:66)
      at
    org.wso2.carbon.identity.application.authentication.framework.handler.sequence.impl.DefaultStepBasedSequenceHandler.handleClaimMappings(DefaultStepBasedSequenceHandler.java:604)
      at
    org.wso2.carbon.identity.application.authentication.framework.handler.sequence.impl.DefaultStepBasedSequenceHandler.handlePostAuthentication(DefaultStepBasedSequenceHandler.java:394)
      at
    org.wso2.carbon.identity.application.authentication.framework.handler.sequence.impl.DefaultStepBasedSequenceHandler.handle(DefaultStepBasedSequenceHandler.java:134)
      at
    org.wso2.carbon.identity.application.authentication.framework.handler.request.impl.DefaultAuthenticationRequestHandler.handle(DefaultAuthenticationRequestHandler.java:121)
      at
    org.wso2.carbon.identity.application.authentication.framework.handler.request.impl.DefaultRequestCoordinator.handle(DefaultRequestCoordinator.java:94)
      at
    org.wso2.carbon.identity.application.authentication.framework.servlet.CommonAuthenticationServlet.doPost(CommonAuthenticationServlet.java:54)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)     at
    javax.servlet.http.HttpServlet.service(HttpServlet.java:848)  at
    org.eclipse.equinox.http.helper.ContextPathServletAdaptor.service(ContextPathServletAdaptor.java:37)
      at
    org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
      at
    org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
      at
    org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)     at
    org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:68)
      at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at
    org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(CharacterSetFilter.java:61)
      at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      at
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at
    org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:178)
      at
    org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
      at
    org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:56)
      at
    org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
      at
    org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:141)
      at
    org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:156)
      at
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
      at
    org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:52)
      at
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
      at
    org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
      at
    org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      at
    org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
      at
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:745) Caused by:
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0    at
    java.util.ArrayList.rangeCheck(ArrayList.java:635)    at
    java.util.ArrayList.get(ArrayList.java:411)   at
    org.wso2.carbon.claim.mgt.ClaimManagerHandler.validateClaims(ClaimManagerHandler.java:668)
      at
    org.wso2.carbon.claim.mgt.ClaimManagerHandler.getMappingsFromOtherDialectToCarbon(ClaimManagerHandler.java:529)
      at
    org.wso2.carbon.claim.mgt.ClaimManagerHandler.getMappingsMapFromOtherDialectToCarbon(ClaimManagerHandler.java:614)
      at
    com.wso2.sample.claim.handler.CustomClaimHandler.handleLocalClaims(CustomClaimHandler.java:141).</p>
  </blockquote>
  
  <p>According to my study on the source code of Identity Server this problem is in the Authentication Framework at <strong>org.wso2.identity.application.authentication.framework component</strong>. </p>
  
  <p>The problem might be in validating claims but I didn't found any method named validateClaims in the source code.</p>
  
  <p>In the source code given in the blog post, <strong>Authentication Framework version - 4.2.2</strong> is used.</p>
  
  <p>I tried using the latest version of <strong>Authentication Framework - 4.2.3</strong>.</p>
  
  <p>But the problem is still in the same component.</p>
  
  <p>Am I missing something?</p>