Ns_Auth3
Url level http authorization support
Usage
#include "ns.h"
int
Ns_AuthorizeRequest(char *server, char *method, char *url,
char *user, char *passwd, char *peer)
int
Ns_AuthorizeUser(char *user, char *passwd)
void
Ns_SetRequestAuthorizeProc(char *server, Ns_RequestAuthorizeProc *procPtr)
void
Ns_SetUserAuthorizeProc(Ns_UserAuthorizeProc *procPtr)
Overview
These functions provide a means to create and use your own authorization mechanisms. They are used by the nsperm module to provide authentication and authorization of users to specific URLs.
You can define your own authorization functions. For example, you might create functions that will authorize a user by their SSL client certificate and if that fails, then attempt to authorize the user by username and password.
Ns_AuthorizeRequest(server, method, url,-
user, passwd, peer)
Used to call the function registered by Ns_SetRequestAuthorizeProc to authorize a user's access to the given method and URL. Possible return values are:
-
NS_OK - The user's access is authorized
-
NS_UNAUTHORIZED - Access is not public for this method or URL and either the user and password were not verified or the user does not have permission.
-
NS_FORBIDDEN - There is no possible user/password combination that would give authorization.
-
NS_ERROR - The authentication function could not perform the permission check.
Ns_AuthorizeUser(user, passwd)-
Checks that the cleartext password is correct for the specified user. Returns NS_OK if it matches or NS_ERROR if it does not match or if no authorization procedure is registered.
Ns_SetRequestAuthorizeProc(server, procPtr)-
Register the URL request authorization function. This function is called by
Ns_AuthorizeRequestand should return one of the four values give above forNs_AuthorizeRequest.
Ns_SetUserAuthorizeProc(procPtr)-
Register the user authorization function. This function is called by
Ns_AuthorizeUserand should return either NS_OK or NS_ERROR.
Keywords
Releases
Unchanged in 2 releases since Debian 3.1 (Sarge).