Examples of DigestAuthentication


Examples of org.eclipse.jetty.client.util.DigestAuthentication

        HttpClient client = new HttpClient();

        try
        {
            AuthenticationStore authStore = client.getAuthenticationStore();
            authStore.addAuthentication(new DigestAuthentication(new URI(srvUrl), "test", "testuser", "password"));
            client.start();

            Request request = client.newRequest(srvUrl);
            request.method(HttpMethod.POST);
            request.content(new BytesContentProvider(__message.getBytes("UTF8")));
View Full Code Here

Examples of org.eclipse.jetty.client.util.DigestAuthentication

        String srvUrl = "http://127.0.0.1:" + ((NetworkConnector)_server.getConnectors()[0]).getLocalPort() + "/test/";      
        HttpClient client = new HttpClient();
        try
        {
            AuthenticationStore authStore = client.getAuthenticationStore();
            authStore.addAuthentication(new DigestAuthentication(new URI(srvUrl), "test", "testuser", "password"));  
            client.start();

            String sent = IO.toString(new FileInputStream("src/test/resources/message.txt"));
           
            Request request = client.newRequest(srvUrl);
View Full Code Here

Examples of org.eclipse.jetty.client.util.DigestAuthentication

    @Test
    public void test_DigestAuthentication() throws Exception
    {
        startDigest(new EmptyServerHandler());
        URI uri = URI.create(scheme + "://localhost:" + connector.getLocalPort());
        test_Authentication(new DigestAuthentication(uri, realm, "digest", "digest"));
    }
View Full Code Here

Examples of org.zoolu.sip.authentication.DigestAuthentication

      authHeader.addRealmParam(realm);
      authHeader.addNonceParam(nextNonce);
      authHeader.addUriParam(req.getRequestLine().getAddress().toString());
      authHeader.addQopParam(qop);
     
      String response = (new DigestAuthentication(SipMethods.REGISTER,
          authHeader, null, passwd)).getResponse();
      authHeader.addResponseParam(response);
     
      req.setAuthorizationHeader(authHeader);
    }
View Full Code Here

Examples of org.zoolu.sip.authentication.DigestAuthentication

        req.removeViaHeader();
        via.setBranch(SipProvider.pickBranch());
        req.addViaHeader(via);
        qop = (qopOptions != null) ? "auth" : null;

        DigestAuthentication digest = new DigestAuthentication(SipMethods.REGISTER,
            req.getRequestLine().getAddress().toString(), wwwAuthHeader, qop, null, username, passwd);
       
        AuthorizationHeader authHeader;
        if (code == 401)
          authHeader = digest.getAuthorizationHeader();
        else
          authHeader = digest.getProxyAuthorizationHeader();

        req.setAuthorizationHeader(authHeader);
        TransactionClient t = new TransactionClient(sipProvider, req, this);
        t.request();
View Full Code Here

Examples of org.zoolu.sip.authentication.DigestAuthentication

         ah.addUsernameParam(username);
         ah.addRealmParam(realm);
         ah.addNonceParam(next_nonce);
         ah.addUriParam(req.getRequestLine().getAddress().toString());
         ah.addQopParam(qop);
         String response=(new DigestAuthentication(SipMethods.REGISTER,ah,null,passwd)).getResponse();
         ah.addResponseParam(response);
         req.setAuthorizationHeader(ah);
      }
      if (expire_time>0) printLog("Registering contact "+contact+" (it expires in "+expire_time+" secs)",LogLevel.HIGH);
      else printLog("Unregistering contact "+contact,LogLevel.HIGH);
View Full Code Here

Examples of org.zoolu.sip.authentication.DigestAuthentication

            req.setCSeqHeader(req.getCSeqHeader().incSequenceNumber());
            WwwAuthenticateHeader wah=resp.getWwwAuthenticateHeader();
            String qop_options=wah.getQopOptionsParam();
            //printLog("DEBUG: qop-options: "+qop_options,LogLevel.MEDIUM);
            qop=(qop_options!=null)? "auth" : null;
            AuthorizationHeader ah=(new DigestAuthentication(SipMethods.REGISTER,req.getRequestLine().getAddress().toString(),wah,qop,null,username,passwd)).getAuthorizationHeader();
            req.setAuthorizationHeader(ah);
            TransactionClient t=new TransactionClient(sip_provider,req,this);
            t.request();
         }
         else
View Full Code Here

Examples of org.zoolu.sip.authentication.DigestAuthentication

      authHeader.addRealmParam(realm);
      authHeader.addNonceParam(nextNonce);
      authHeader.addUriParam(req.getRequestLine().getAddress().toString());
      authHeader.addQopParam(qop);
     
      String response = (new DigestAuthentication(SipMethods.REGISTER,
          authHeader, null, passwd)).getResponse();
      authHeader.addResponseParam(response);
     
      req.setAuthorizationHeader(authHeader);
    }
View Full Code Here

Examples of org.zoolu.sip.authentication.DigestAuthentication

        req.removeViaHeader();
        via.setBranch(SipProvider.pickBranch());
        req.addViaHeader(via);
        qop = (qopOptions != null) ? "auth" : null;

        DigestAuthentication digest = new DigestAuthentication(SipMethods.REGISTER,
            req.getRequestLine().getAddress().toString(), wwwAuthHeader, qop, null, username, passwd);
       
        AuthorizationHeader authHeader;
        if (code == 401)
          authHeader = digest.getAuthorizationHeader();
        else
          authHeader = digest.getProxyAuthorizationHeader();

        req.setAuthorizationHeader(authHeader);
        TransactionClient t = new TransactionClient(sipProvider, req, this);
        t.request();
View Full Code Here

Examples of org.zoolu.sip.authentication.DigestAuthentication

        
         if (authentication_service.hasUser(user))
         { 
            if (authentication_scheme.equalsIgnoreCase(scheme))
            { 
               DigestAuthentication auth=new DigestAuthentication(msg.getRequestLine().getMethod(),ah,null,keyToPasswd(authentication_service.getUserKey(user)));

               // check user's authentication response
               boolean is_authorized=auth.checkResponse();

               rand=pickRandBytes();       
                 
               if (!is_authorized)
               {  // authentication/authorization failed
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.