BOOL RequireAuthentication( |
|
UINT nClientId, |
|
|
UINT nAuthType, |
|
|
LPCTSTR lpszRealm |
|
); |
Send a response to the client indicating that authentication is
required.
Parameters
- 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 the GetLastError method.
Remarks
The RequireAuthentication method can be used within an
OnCommand 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 IsClientAuthenticated
method. The GetClientCredentials method 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: cstools11.h
Import Library: cshtsv11.lib
Unicode: Implemented as Unicode and ANSI versions
See Also
GetClientCredentials,
IsClientAuthenticated,
SendResponse
|