jsip
  1. jsip
  2. JSIP-381

Issues with Authentication-Info header

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: current
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      Mobicents SIP Servlets 1.4-SNAPSHOT (r14702) and JSIP (r1918)

      Description

      Issue - Authentication-Info header should be handled as a list-style header

      Following code:

      protected void doRequest(SipServletRequest request) throws ServletException, IOException {
      SipServletResponse response = request.createResponse(SipServletResponse.SC_UNAUTHORIZED);
      response.addHeader(SIPHeaderNames.AUTHENTICATION_INFO,
      "NTLM rspauth=\"01000000000000005CD422F0C750C7C6\", srand=\"0B9D33A2\", snum=\"1\", " +
      "opaque=\"BCDC0C9D\", qop=\"auth\", targetname=\"server.contoso.com\", " +
      "realm=\"SIP Communications Service\"");
      response.send();
      }

      throws an exception like:

      java.lang.IllegalArgumentException: Illegal args supplied
      at org.mobicents.servlet.sip.message.SipServletMessageImpl.addHeaderInternal(SipServletMessageImpl.java:307)
      at org.mobicents.servlet.sip.message.SipServletMessageImpl.addHeader(SipServletMessageImpl.java:344)
      ....

      Caused by: java.text.ParseException: List of headers of this type is not allowed in a message
      at gov.nist.javax.sip.header.HeaderFactoryImpl.createHeaders(HeaderFactoryImpl.java:1232)
      at org.mobicents.servlet.sip.message.SipServletMessageImpl.addHeaderInternal(SipServletMessageImpl.java:294)
      ... 18 more

      (The reason of this exception is that mobicents registered "Authentication-Info" as a "list" header while NIST parser returns "single" header)

      Potential workaround:

      You could do

      JainSipUtils.LIST_HEADER_NAMES.remove(SIPHeaderNames.AUTHENTICATION_INFO);

      Suggested fix:

      Let's register Authentication-Info header in gov.nist.javax.sip.message class

      Issue - Authentication-Info parser does not handle NTLM-style authentication

      The response send in example above looks like:

      SIP/2.0 401 Unauthorized
      To: <sip:user1@test.com>;tag=22003225_c71fdaf2_c52d3871-6bee-41c0-9f74-08f522babee9
      Via: SIP/2.0/TCP 172.16.11.124:5062;branch=z9hG4bK-780742261-1199;rport=5062
      CSeq: 1 REGISTER
      Call-ID: 6a639d301863-e44fbcee1256@172.16.11.124
      From: <sip:user1@test.com>;tag=38f60e1bbd4a
      Authentication-Info: NTLM
      Content-Length: 0

      As you could see, here is no NTLM attributes present, because AuthenticationInfoParser does not handle

      "NTLM" SPACE PARAM=VALUE[,PARAM=VALUE]*

      format

      Potential workaround:

      None

      Suggested fix

      Add a

      "NTLM" SPACE PARAM=VALUE[,PARAM=VALUE]*

      format support to the parser

      Proposed patch

      Please find proposed patch enclosed in attachment

        Activity

        Hide
        deruelle_jean added a comment -

        Issue - Authentication-Info header should be handled as a list-style header => Fixed in Mobicents as part of http://code.google.com/p/mobicents/issues/detail?id=2578

        Issue - Authentication-Info parser does not handle NTLM-style authentication => patch committed in revision 1920

        Thanks for the patch !

        Show
        deruelle_jean added a comment - Issue - Authentication-Info header should be handled as a list-style header => Fixed in Mobicents as part of http://code.google.com/p/mobicents/issues/detail?id=2578 Issue - Authentication-Info parser does not handle NTLM-style authentication => patch committed in revision 1920 Thanks for the patch !

          People

          • Assignee:
            Unassigned
            Reporter:
            Alex Saveliev
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: