Appendix a, Sample trusted application client code in c – Google Search Appliance Security User Manual
Page 40
40
Appendix A
Sample Trusted Application client code in C#
using
System;
using
System
.
Collections
.
Generic;
using
System
.
Linq;
using
System
.
Net;
using
System
.
IO;
using
System
.
Text;
namespace
TrustedApp
{
class
GSAClient
{
String
GSA_SESSION_ID
=
"GSA_SESSION_ID";
String
_gsaSessionId
=
null;
String
_trustedUser;
String
_trustedPwd;
String
_gsaHostName;
String
_endUser;
String
_credentialGroup;
static
void
Main
(
string
[]
args)
{
String
gsaHostName
=
"gsa.acme.com";
String
userName
=
"trusteduser_a"
,
userPassword
=
"pwd";
GSAClient
gsaClient
=
new
GSAClient
(
gsaHostName
,
userName
,
userPassword
,
"Default"
,
"enduser_a"
);
gsaClient
.
search
(
"access=a&q=some_keyword&site=default_frontend"
);
}
public
GSAClient
(
String
gsaHostName
,
String
trustedUser
,
String
trustedPwd
,
String
credentialGroup
,
String
endUser)
{
_gsaHostName
=
gsaHostName;
_trustedUser
=
trustedUser;
_trustedPwd
=
trustedPwd;
_credentialGroup
=
credentialGroup;
_endUser
=
endUser;
}
String
search
(
String
q)
{
int
iRetry
=
0;
HttpWebRequest
request;
Initiate:
request
=
(
HttpWebRequest
)
WebRequest
.
Create
(
"https://"
+
_gsaHostName
+
"/search"
);
request
.
Method
=
"POST";
- Message Archiving Administration Guide (79 pages)
- Apps Technical Transition Guide For Business, Education, and Government (56 pages)
- Message Continuity User Guide (5 pages)
- Search Appliance User Experience Guide (31 pages)
- Apps Directory Sync Administration Guide (146 pages)
- Earth User Guide (131 pages)
- Android 2.3.4 Users Guide (384 pages)
- Android 3.0 Users Guide (140 pages)
- Galaxy Nexus Android mobile technology platform 4.0 Users Guide (107 pages)
- Anywhere+ Deployment Guide V1.0.1 (51 pages)
- Activation Guide Message Filtering (46 pages)
- DoubleClick Rich Media Guide to Rich Media Innovation (4 pages)
- Remarketing in AdWords Seven-Minute Setup Guide (4 pages)
- Grants Beta A BEGINNERS GUIDE (13 pages)
- Search Appliance OneBox for Enterprise Developers Guide (30 pages)
- Search Appliance Feeds Protocol Developers Guide (45 pages)
- SketchUp: Getting Started (2 pages)
- Agency Product Guide (2 pages)
- Changes to AdWords Reporting A Comprehensive Guide (13 pages)
- Search Appliance Connectors Administration Guide (41 pages)
- Search Appliance Guide to Software Release 7.0 (10 pages)
- DTorial: An interactive tutorial framework for blind users in a Web 2.0 world (14 pages)
- Networking Best Practices for Large Deployments (42 pages)
- Apps Migration for Lotus Notes Installation & Administration Guide (100 pages)
- Understanding Visualization by Understanding Individual Users (5 pages)
- Web Security for Enterprise Administration Guide (83 pages)
- Education – access infrastructure guide (11 pages)
- Message Continuity Setup and Administration Guide (33 pages)
- Search Appliance Getting the Most from Your Google Search Appliance (77 pages)
- Search Appliance Getting the Most from Your Google Search Appliance (82 pages)
- Commerce Search Deployment Guide (29 pages)
- Apps Migration for Microsoft Exchange Administration Guide (78 pages)
- Grants Ongoing Management Guide (26 pages)
- Custom Search Engine (beta) Starter Guide (8 pages)
- Search Appliance Policy ACL API Developers Guide (24 pages)
- PRINCIPLES OF MOBILE SITE DESIGN: DELIGHT USERS AND DRIVE CONVERSIONS (42 pages)
- Search Engine Optimisation Starter Guide (22 pages)
- Website Optimizer v 1.0 The Techie Guide (26 pages)
- Search Appliance Creating the Search Experience (141 pages)
- Apps Security and Compliance Services Web Services Application Programming Interface Guide, Early Access Version 1.5 (70 pages)
- Message Security Batch Reference Guide (561 pages)
- Message Archiving Microsoft Exchange Journaling Configuration Guide For Exchange Server 2007 and 2010 (33 pages)
- Search Appliance Authentication/Authorization for Enterprise SPI Guide (33 pages)
- AdMob Case Study TV Guide Digital (2 pages)
- Apps Connector for BlackBerry Enterprise Server Installation and Administration Guide (70 pages)