void testConstructor()
      {
         /*
          * This test exists to initialize the singleton plugin.
          * Doing it as a static ran into ordering problems.
          */
         CPPUNIT_ASSERT((xferctl=dynamic_cast<MSFT_ExchangeTransferHack*>(getAuthPlugin("msft"))));

         OsConfigDb xferConfigDb;
         xferConfigDb.set(MSFT_ExchangeTransferHack::RecognizerConfigKey, "^RTCC/");
         xferctl->readConfig(xferConfigDb);

         testUserAgent.setIsUserAgent(FALSE);

         testUserAgent.setUserAgentHeaderProperty("sipXecs/testproxy");

         testUserAgent.setForking(FALSE);  // Disable forking

         OsConfigDb configDb;
         configDb.set("SIPX_PROXY_AUTHENTICATE_ALGORITHM", "MD5");
         configDb.set("SIPX_PROXY_HOSTPORT", "sipx.example.edu");

         testSipRouter = new SipRouter(testUserAgent, mForwardingRules, configDb);
         xferctl->announceAssociatedSipRouter( testSipRouter );
      }
Exemplo n.º 2
0
      
      CPPUNIT_ASSERT(AuthPlugin::CONTINUE
                     == spLinter->authorizeAndModify(identity,
                                                     requestUri,
                                                     routeState,
                                                     "INVITE",
                                                     AuthPlugin::CONTINUE,
                                                     testMsg,
                                                     false,
                                                     rejectReason
                                                     ));

      // verify that foreign PAIs are still there.
      const char* pPAI;
      CPPUNIT_ASSERT( ( pPAI = testMsg.getHeaderValue( 0, SipXauthIdentity::PAssertedIdentityHeaderName ) ) ); 
      ASSERT_STR_EQUAL( "\"foreigner1\" <sip:[email protected]>", pPAI );
      CPPUNIT_ASSERT( ( pPAI = testMsg.getHeaderValue( 1, SipXauthIdentity::PAssertedIdentityHeaderName ) ) ); 
      ASSERT_STR_EQUAL( "\"foreigner2\" <sip:[email protected]>", pPAI );
      CPPUNIT_ASSERT( ( pPAI = testMsg.getHeaderValue( 2, SipXauthIdentity::PAssertedIdentityHeaderName ) ) ); 
      ASSERT_STR_EQUAL( "\"foreigner3\" <sip:[email protected]>", pPAI );
      CPPUNIT_ASSERT( ( pPAI = testMsg.getHeaderValue( 3, SipXauthIdentity::PAssertedIdentityHeaderName ) ) ); 
      ASSERT_STR_EQUAL( "\"foreigner4\" <sip:[email protected]>", pPAI );
   } 
};

CPPUNIT_TEST_SUITE_REGISTRATION(RequestLinterTest);

RequestLinter* RequestLinterTest::spLinter = dynamic_cast<RequestLinter*>(getAuthPlugin("linter"));
SipUserAgent     RequestLinterTest::testUserAgent;
SipRouter*       RequestLinterTest::testSipRouter;
Exemplo n.º 3
0
private:
   // Return hunting and/or fishing permissions in the ResultSet.
   // Use a dummy identity.
   void getPermissions(ResultSet& permissions, bool hunting, bool fishing)
      {
         if (hunting)
         {
            addPermission(permissions, "hunting");
         }
         if (fishing)
         {
            addPermission(permissions, "fishing");
         }
      }

   void addPermission(ResultSet& permissions, const char* permissionValue)
      {
         UtlHashMap record;
         record.insertKeyAndValue(new UtlString("identity"),
                                  new UtlString("dummy identity"));
         record.insertKeyAndValue(new UtlString("permission"),
                                  new UtlString(permissionValue));
         permissions.addValue(record);
      }
};

CPPUNIT_TEST_SUITE_REGISTRATION(EnforceAuthRulesTest);

EnforceAuthRules* EnforceAuthRulesTest::enforcer = dynamic_cast<EnforceAuthRules*>(getAuthPlugin("enforce"));
SipDbTestContext  EnforceAuthRulesTest::TestDbContext(TEST_DATA_DIR, TEST_WORK_DIR "/enforceauthrules_context");