Package org.zoolu.sip.header

Examples of org.zoolu.sip.header.AuthorizationHeader


   Message err_resp=null;

      //String username=msg.getFromHeader().getNameAddress().getAddress().getUserName();
      //String user=username+"@"+realm;

      AuthorizationHeader ah;
      if (type==SERVER_AUTHENTICATION) ah=msg.getAuthorizationHeader();
      else ah=msg.getProxyAuthorizationHeader();
        
      if (ah!=null && ah.getNonceParam().equals(HEX(rand)))
      {
         //String username=ah.getUsernameParam();
         String realm=ah.getRealmParam();
         String nonce=ah.getNonceParam();
         String username=ah.getUsernameParam();
         String scheme=ah.getAuthScheme();
        
         String user=username+"@"+realm;
        
         if (authentication_service.hasUser(user))
         { 
View Full Code Here


   }


   /** Gets a new AuthorizationHeader based on current authentication attributes. */
   public AuthorizationHeader getAuthorizationHeader()
   {  AuthorizationHeader ah=new AuthorizationHeader("Digest");
      ah.addUsernameParam(username);
      ah.addRealmParam(realm);
      ah.addNonceParam(nonce);
      ah.addUriParam(uri);
      if (algorithm!=null) ah.addAlgorithParam(algorithm);
      if (opaque!=null) ah.addOpaqueParam(opaque);
      /*
      if (qop!=null) ah.addQopParam(qop);
      if (nc!=null) ah.addNcParam(nc);
      */

      if (qop!=null)
          {
            ah.addQopParam(qop);
            if (qop.equalsIgnoreCase("auth-int") || qop.equalsIgnoreCase("auth"))
            {
              // qop requires cnonce and nc as per rfc2617
              cnonce=HEX(MD5(Long.toString(System.currentTimeMillis()))); // unique hopefully
              ah.addCnonceParam(cnonce);
              nc="00000001"; // always 1 since cnonce should be unique - avoids having to have a static counter
              ah.addNcParam(nc);
            }
      }


      String response=getResponse();
      ah.addResponseParam(response);
      return ah;
   }
View Full Code Here

      System.out.println(" ");


      String ah_str="Digest username=\"Mufasa\", realm=\"testrealm@host.com\", nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", uri=\"/dir/index.html\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", response=\"6629fae49393a05397450978507c4ef1\", opaque=\"5ccc069c403ebaf9f0171e9517f40e41\"\n";

      AuthorizationHeader ah=new AuthorizationHeader(ah_str);
      a=new DigestAuthentication("GET",ah,null,"Circle Of Life");
      response1=a.getResponse();
      response2="6629fae49393a05397450978507c4ef1";
      System.out.println(response1);
      System.out.println(response2);
View Full Code Here

         else wah=msg.getProxyAuthenticateHeader();
         String qop_options=wah.getQopOptionsParam();
         qop=(qop_options!=null)? "auth" : null;
         RequestLine rl=req.getRequestLine();
         DigestAuthentication digest=new DigestAuthentication(rl.getMethod(),rl.getAddress().toString(),wah,qop,null,username,passwd);
         AuthorizationHeader ah;
         if (code==401) ah=digest.getAuthorizationHeader();
         else ah=digest.getProxyAuthorizationHeader();
         req.setAuthorizationHeader(ah);

         if (req.isInvite()) // make sure it's an invite
View Full Code Here

TOP

Related Classes of org.zoolu.sip.header.AuthorizationHeader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.