22.12.2012 Views

Front cover - IBM Redbooks

Front cover - IBM Redbooks

Front cover - IBM Redbooks

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

}<br />

return kFilterNotHandled;<br />

/*---<br />

* handle user authentication<br />

*/<br />

unsigned int Authenticate(FilterContext* context,<br />

FilterAuthenticate* authData)<br />

{<br />

/*<br />

* Description: This routine is called on a dsapi kFilterAuthUser<br />

* event.<br />

*<br />

* Input: context dsapi specification controls the format of data<br />

*<br />

* authData password field contains the password to use for<br />

* authentication<br />

* userName field contains the name<br />

* to authenticate<br />

* foundInCache field is TRUE if<br />

* user has been found in the cache and can be<br />

* authenticated on that basis.<br />

*<br />

* Output: authData authName field is filled with user's<br />

* distinguished name<br />

* authType filed is filled<br />

* with kNotAuthentic if we can't authenticate the<br />

* user kAuthenticBasic if we can<br />

* authenticate the user.<br />

*<br />

* Return: kFilterNotHandled if we do not understand the input data,<br />

* or if the user has been found in the cache, or<br />

* if we find that the user to be authenticated is<br />

* not known to OS.<br />

* kFilterHandledEvent if the user is known to OS.<br />

*/<br />

/* If the user is found in the cache, then we don't need to do<br />

* anything further.<br />

*/<br />

if (!authData || authData->foundInCache) {<br />

AddInLogMessageText ("\n user is found in the cache \n", NOERROR);<br />

return kFilterNotHandled;<br />

}<br />

/* Attempt to verify the user's password.<br />

Appendix B. A sample DSAPI program 647

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!