| BOOL WINAPI HttpRequireAuthentication( |
| |
HSERVER hServer, |
|
| |
UINT nClientId, |
|
| |
UINT nAuthType, |
|
| |
LPCTSTR lpszRealm |
|
| ); |
Send a response to the client indicating that authentication is
required.
Parameters
- hServer
- The server handle.
- nClientId
- An unsigned integer which uniquely identifies the client
session.
- nAuthType
- An integer value that corresponds to a result code, informing
the client if the redirection is permanent or temporary. The
following values may be used:
| Value |
Description |
| HTTP_AUTH_BASIC |
This option specifies the Basic authentication scheme
should be used. This option is supported by all clients that
support at least version 1.0 of the protocol. |
- lpszRealm
- A null-terminated string that is displayed by
a web browser to indicate to the user which username and password they
should use. If this parameter is NULL or an empty string, the domain
name the client used to establish the connection will be used.
Return Value
If the function succeeds, the return value is non-zero. If the
function fails, the return value is zero. To get extended error
information, call HttpGetServerError.
Remarks
The HttpRequireAuthentication function can be used within a
HTTP_CLIENT_COMMAND event handler to indicate to the client that it
must provide a username and password to access the requested resource.
The client should respond by issuing another request that includes the
required credentials. To determine if a client has included
credentials with its request, use the HttpIsClientAuthenticated
function. The HttpGetClientCredentials function will return the
username and password that was provided by the client.
Some clients may require that the session be secure if
authentication is requested or display warning messages to the user if
the connection is not secure. It is recommended that you enable
security using the HTTP_OPTION_SECURE option if your application will
require clients to authenticate before accessing specific resources.
Requirements
Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: cshtsv12.lib
Unicode: Implemented as Unicode and ANSI versions
See Also
|