Made minor changes to the CASA AuthToken Client Test application to improve its use-ability.
This commit is contained in:
		| @@ -64,7 +64,13 @@ | ||||
|         "Entry" | ||||
|         { | ||||
|         "MsmKey" = "8:_71C343EBC4935F8914C3145115EDEC4A" | ||||
|         "OwnerKey" = "8:_CEAF656517E2435A80EA562BDEA99B63" | ||||
|         "OwnerKey" = "8:_0C0B5ECE6E9C47F1A1F13B58141B5DC8" | ||||
|         "MsmSig" = "8:_UNDEFINED" | ||||
|         } | ||||
|         "Entry" | ||||
|         { | ||||
|         "MsmKey" = "8:_71C343EBC4935F8914C3145115EDEC4A" | ||||
|         "OwnerKey" = "8:_8EE6563CF41048A0A19C889150F5A072" | ||||
|         "MsmSig" = "8:_UNDEFINED" | ||||
|         } | ||||
|         "Entry" | ||||
| @@ -75,25 +81,19 @@ | ||||
|         } | ||||
|         "Entry" | ||||
|         { | ||||
|         "MsmKey" = "8:_71C343EBC4935F8914C3145115EDEC4A" | ||||
|         "OwnerKey" = "8:_0C0B5ECE6E9C47F1A1F13B58141B5DC8" | ||||
|         "MsmSig" = "8:_UNDEFINED" | ||||
|         } | ||||
|         "Entry" | ||||
|         { | ||||
|         "MsmKey" = "8:_8292EFFD84EF46C6BD2F1F3E20808684" | ||||
|         "OwnerKey" = "8:_UNDEFINED" | ||||
|         "MsmSig" = "8:_UNDEFINED" | ||||
|         } | ||||
|         "Entry" | ||||
|         { | ||||
|         "MsmKey" = "8:_CEAF656517E2435A80EA562BDEA99B63" | ||||
|         "MsmKey" = "8:_8EE6563CF41048A0A19C889150F5A072" | ||||
|         "OwnerKey" = "8:_UNDEFINED" | ||||
|         "MsmSig" = "8:_UNDEFINED" | ||||
|         } | ||||
|         "Entry" | ||||
|         { | ||||
|         "MsmKey" = "8:_DE6197491C6C419FAAC463D274A34C18" | ||||
|         "MsmKey" = "8:_ABC416054C27440FA6009021C0AF9640" | ||||
|         "OwnerKey" = "8:_8292EFFD84EF46C6BD2F1F3E20808684" | ||||
|         "MsmSig" = "8:_UNDEFINED" | ||||
|         } | ||||
| @@ -434,7 +434,7 @@ | ||||
|         } | ||||
|         "MergeModule" | ||||
|         { | ||||
|             "{35A69C6E-5BA4-440D-803D-762B59A45393}:_DE6197491C6C419FAAC463D274A34C18" | ||||
|             "{35A69C6E-5BA4-440D-803D-762B59A45393}:_ABC416054C27440FA6009021C0AF9640" | ||||
|             { | ||||
|             "UseDynamicProperties" = "11:FALSE" | ||||
|             "IsDependency" = "11:TRUE" | ||||
| @@ -572,7 +572,7 @@ | ||||
|                 { | ||||
|                 } | ||||
|             } | ||||
|             "{8062640A-2EEE-46E9-AB67-688E9A886E9F}:_CEAF656517E2435A80EA562BDEA99B63" | ||||
|             "{8062640A-2EEE-46E9-AB67-688E9A886E9F}:_8EE6563CF41048A0A19C889150F5A072" | ||||
|             { | ||||
|             "SourcePath" = "8:..\\mechanisms\\pwd\\windows\\Release\\pwmech.dll" | ||||
|             "TargetName" = "8:" | ||||
|   | ||||
| @@ -26,12 +26,15 @@ | ||||
| #include "casa_c_authtoken.h" | ||||
|  | ||||
| // Globals | ||||
| char usageString[] = "usage: test -a serverAddress -p serverPort [-h]\n"; | ||||
| char usageString[] = "usage: test -a serverAddress -p serverPort [-s serviceName] [-h]\n"; | ||||
|  | ||||
| char     *pServerAddress = NULL; | ||||
| int      serverPort = 0; | ||||
| BOOLEAN  execHttpTest = FALSE; | ||||
|  | ||||
| char     serviceName[] = "testService"; | ||||
| char     *pServiceName = serviceName; | ||||
|  | ||||
|  | ||||
| /*********************************************************************** | ||||
|  * | ||||
| @@ -150,8 +153,8 @@ void NonHttpTest(void) | ||||
|    char        authToken[8192]; | ||||
|    int         authTokenLen = sizeof(authToken); | ||||
|  | ||||
|    // Obtain an authentication token for the testService | ||||
|    retStatus = ObtainAuthToken("testService", pServerAddress, authToken, &authTokenLen); | ||||
|    // Obtain an authentication token for the targeted service | ||||
|    retStatus = ObtainAuthToken(pServiceName, pServerAddress, authToken, &authTokenLen); | ||||
|    if (!CASA_SUCCESS(retStatus)) | ||||
|    { | ||||
|       printf("-NonHttpTest- ObtainAuthToken failed with status %d\n", retStatus); | ||||
| @@ -281,8 +284,8 @@ void HttpTest(void) | ||||
|    char        authToken[4096]; | ||||
|    int         authTokenLen = sizeof(authToken); | ||||
|  | ||||
|    // Obtain an authentication token for the testService | ||||
|    retStatus = ObtainAuthToken("testService", pServerAddress, authToken, &authTokenLen); | ||||
|    // Obtain an authentication token for the targeted service | ||||
|    retStatus = ObtainAuthToken(pServiceName, pServerAddress, authToken, &authTokenLen); | ||||
|    if (!CASA_SUCCESS(retStatus)) | ||||
|    { | ||||
|       printf("-HttpTest- ObtainAuthToken failed with status %d\n", retStatus); | ||||
| @@ -472,6 +475,21 @@ int main(int argc, char* argv[]) | ||||
|             return -1; | ||||
|          } | ||||
|       } | ||||
|       else if (stricmp(argv[i], "-s") == 0) | ||||
|       { | ||||
|          // Service name option, the next argument should | ||||
|          // contain the name of the service to be targeted. | ||||
|          i++; | ||||
|          if (argv[i] != NULL) | ||||
|          { | ||||
|             pServiceName = argv[i]; | ||||
|          } | ||||
|          else | ||||
|          { | ||||
|             printf(usageString); | ||||
|             return -1; | ||||
|          } | ||||
|       } | ||||
|       else if (stricmp(argv[i], "-h") == 0) | ||||
|       { | ||||
|          // Perform http test option | ||||
|   | ||||
		Reference in New Issue
	
	Block a user