Sun Java System Calendar Server 6 2005Q1 Developer's Guide |
Chapter 4
Proxy Authentication SDK ReferenceThis chapter describes the Calendar Server Proxy Authentication SDK (authSDK) API. The chapter is divided into two parts: Proxy Authentication SDK Functions, and How to Use the authSDK.
Proxy Authentication SDK FunctionsThere are five authSDK functions. They are presented below in alphabetical order, not in order of use:
CEXP_GenerateLoginURLPurpose
Returns a login URL with a valid session ID for a given user.
Syntax
int CEXP_GenerateLoginURL (char * pszUser,
char * pszClientAddress,
char * pszCalendarHost,
char * pszURL);Parameters
There are four parameters:
Returns
Returns 0 on success, -1 on failure. On success, the pszURL buffer contains a valid URL string.
CEXP_GetVersionPurpose
Gets the version ID string.
Syntax
char * CEXP_GetVersion(void);
Parameters
There are no parameters:
Returns
A reference to the version ID string.
CEXP_InitPurpose
Initializes the SDK.
Syntax
int CEXP_Init (char * pszLdapHost,
char * pszLdapMatchAttrib,
char * pszLdapDN,
unsigned int iLdapPort,
char * pszLdapBindUser,
char * pszLdapBindPass,
char * pszAdminUser,
char * pszAdminPassword);Parameters
There are eight parameters:
Returns
Returns 0 on success, -1 on failure.
Comment
If the bind DN (pszLdapBindUser) and password (pszLdapBindPass) are NULL, anonymous searching will be attempted.
CEXP_SetHttpPortPurpose
Sets the HTTP port used to contact the calendar server.
Syntax
void CEXP_SetHttpPort (int iHttpPort);
Parameters
There is one parameter:
Returns
Nothing.
CEXP_ShutdownPurpose
Cleans up all global memory, shuts down connections, and other clean-up functions when the user is finished using the SDK.
Syntax
int CEXP_Shutdown (void);
Parameters
There are no parameters:
Returns
Returns 0 on success, -1 on failure.
Comments
Call this only after all threads using the SDK complete.
How to Use the authSDKTo implement authSDK in your installation, follow these steps:
- Authenticate your user with your portal authentication program.
- Call CEXP_Init.
- Optionally, call CEXP_SetHttpPort.
By default, the authSDK contacts the standard HTTP port, 80. Use this function to tell the authSDK to contact a non-standard port when connecting to generate a session.
Caution
This function is not thread safe and sets a global value. If you want to use it in a threaded environment, you must lock around this call and the CEXP_GenerateLoginURL call.
- Call CEXP_GenerateLoginURL.
This function generates a session handle for the user and client-ip address. It returns a string, in a buffer you allocate, containing a login URL to be used when connecting to Calendar Server. The string is a kind of token providing proof of identity. It is given to the client in the form of a cookie or URL via HTTP headers or JavaScript. The client will then connect to Calendar Server, presenting the token as proof of identity.
- Optionally, call CEXP_Shutdown.
Other Tips
There are a few other things that must be done to assure success in using the AuthSDK:
- The value of service.http.allowadminproxy in the ics.conf file must be “yes”.
- The parameter caladmin, passed in the init method, must have the same value as service.admin.calmaster.userid in the ics.conf file.
- The parameter calpass, passed in the init method, must have the same value as service.admin.calmaster.cred in the ics.conf file.
- The two parameters caladmin and calpass must be defined in your directory service.
- If your calendar server is not listening on the default port 80, you must use the SetHttpPort method with the correct port value.