You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by Massimiliano Masi <ma...@math.unifi.it> on 2007/10/24 11:13:52 UTC

Rampart throws NPE [was My fresh token is already invalid!!! (Rampart throws NPE)]

Hi all,

Sorry for the error: I sent the mail to the axis-user instead of rampart dev.

Debugging rampart, I found the problem of my NPE:

  if(sigTok.equals(encrTok) && sigTok instanceof IssuedToken) {

because both sigTok and encrTok are null.


How can I solve this?

Here the previous mail, for who is not subscribing axis-user.


Thanks,


Hi All,

I have the SAML2 token issuer. I request it using STSClient:

Token responseToken = stsClient.requestSecurityToken(servicePolicy,   
sts, stsPolicy,
service);

Then I add it to the TokenStorage:

TokenStorage store = TrustUtil.getTokenStore(ctx);
store.add(responseToken); // now store contains my SAML2 token

The problem is when I try to get the list of valid tokens:

Token[] tokens = store.getValidTokens();

for (int i=0; i<tokens.length; i++)
{
    l.info("Token in TokenStore " + tokens[i].getId());
}

I don't enter in the for loop. When I try to send the message to the  
endpoint, I got this:

16:21:15,931 INFO  [XUAAssertions] Payload<axis2ns1:RegistryStoredQuery
xmlns:axis2ns1="http://tiani/xds">WSO2 WSAS  
Rocks!!!</axis2ns1:RegistryStoredQuery>
16:21:15,954 ERROR [STDERR] java.lang.NullPointerException
16:21:15,956 ERROR [STDERR]     at
org.apache.rampart.builder.SymmetricBindingBuilder.initializeTokens(SymmetricBindingBuilder.java:681)
16:21:15,957 ERROR [STDERR]     at
org.apache.rampart.builder.SymmetricBindingBuilder.build(SymmetricBindingBuilder.java:73)


In SymmetricBindingBuilder at the line 681 I have:

SecureConversationToken secConvTok =
      (SecureConversationToken) sigTok;

      try {  <-- this is the 681
          String id = RampartUtil.getSecConvToken(rmd, secConvTok);
          rmd.setSecConvTokenId(id);

I'm using rampart 1.3, and the code is from three days ago. It shouldn't be
here. Is not WS-SecConv.

My policy is:

<wsp:Policy wsu:Id="ServicePolicy"

xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
         xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
         <wsp:ExactlyOne>
                 <wsp:All>
                         <sp:SymmetricBinding

xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                                 <wsp:Policy>
                                         <sp:ProtectionToken>
                                                 <wsp:Policy>

                                                         <sp:ProtectionToken>
                                                                 <wsp:Policy>
                                                                        
   <sp:IssuedToken

sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
                                                                        
           <Issuer

xmlns="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">

<address

       xmlns="http://www.w3.org/2005/08/addressing">

       http://foo.bar/we/don/t/process/this/yet

</Address>
                                                                        
           </Issuer>

<sp:RequestSecurityTokenTemplate>

<t:TokenType

       xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust">

       urn:oasis:names:tc:SAML:2.0:assertion

</t:TokenType>


</sp:RequestSecurityTokenTemplate>

                                                                        
   </sp:IssuedToken>
                                                                 </wsp:Policy>
                                                                 <wsp:Policy>

<sp:IncludeTimestamp />
                                                                 </wsp:Policy>
                                                         </sp:ProtectionToken>
                                                 </wsp:Policy>
                                         </sp:ProtectionToken>
                                 </wsp:Policy>
                         </sp:SymmetricBinding>
                 </wsp:All>
         </wsp:ExactlyOne>
</wsp:Policy>




----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.