Skip to content

Latest commit

 

History

History
83 lines (63 loc) · 6.15 KB

ihttptokenkey-interface.md

File metadata and controls

83 lines (63 loc) · 6.15 KB
title description ms.date ms.assetid
IHttpTokenKey Interface
Describes the IHttpTokenKey interface and details its syntax, methods, derived classes, remarks, inheritance hierarchy, and requirements.
10/07/2016
cefa2c4f-3fde-009e-ee80-3af8719b3175

IHttpTokenKey Interface

Represents key information for accessing associated data in the global token cache.

Syntax

class IHttpTokenKey : public IHttpCacheKey  

Methods

The following table lists the methods exposed by the IHttpTokenKey interface.

Name Description
Enum (Inherited from IHttpCacheKey.)
GetCacheName Overridden. Returns the name of the global token cache.
GetHash (Inherited from IHttpCacheKey.)
GetIsEqual (Inherited from IHttpCacheKey.)
GetIsPrefix (Inherited from IHttpCacheKey.)
GetLogonMethod Returns the LOGON32_* value used when the user logs on.
GetPasswordHash Returns the user password as a hash value.
GetUserName Returns the user name.

Derived Classes

This interface contains no derived classes.

Remarks

Whenever a user logs on to a Web site, a token is created for that user. The IHttpTokenKey interface implements methods for gaining access to data that represents that user.

IHttpTokenKey extends the IHttpCacheKey interface by adding support for returning-user information, such as the logon method, the password hash, and the user name. IHttpTokenKey also overrides the IHttpCacheKey::GetCacheName method by providing the default implementation through the IHttpTokenKey::GetCacheName method.

Notes for Implementers

Each nonabstract class that implements the IHttpTokenKey interface must provide an algorithm in the GetHash method that maps the data that an IHttpTokenKey pointer holds to a unique DWORD value for that data across the global token cache.

Example

The following code example demonstrates how to create a global module that listens for GL_CACHE_OPERATION and GL_CACHE_CLEANUP events and then writes the IHttpTokenKey information to the Event Viewer.

Caution

[!INCLUDEiisver] generates a large number of events in the Event Viewer. To avoid a log overflow error in a production environment, you should generally avoid writing cache information to the event log. For demonstration purposes, this code example writes an entry to the Event Viewer in debug mode only.

[!code-cppIHttpTokenKey#1]

The above code writes a new event to the Event Viewer, where the Data box contains XML that is similar to the following.

<cacheProvider>  
    <tokenKey   
        userName="IUSR"   
        hashedPassword="123456"   
        logon="3"   
        cacheName="TOKEN"   
        hash="0"   
        isEqual="true"   
        isPrefix="false" />  
</cacheProvider>  

Your module must export the RegisterModule function. You can export this function by creating a module definition (.def) file for your project, or you can compile the module by using the /EXPORT:RegisterModule switch. For more information, see Walkthrough: Creating a Request-Level HTTP Module By Using Native Code.

You can optionally compile the code by using the __stdcall (/Gz) calling convention instead of explicitly declaring the calling convention for each function.

Inheritance Hierarchy

IHttpCacheKey

IHttpTokenKey

Requirements

Type Description
Client - IIS 7.0 on [!INCLUDEwinvista]
- IIS 7.5 on Windows 7
- IIS 8.0 on Windows 8
- IIS 10.0 on Windows 10
Server - IIS 7.0 on [!INCLUDEwinsrv2008]
- IIS 7.5 on Windows Server 2008 R2
- IIS 8.0 on Windows Server 2012
- IIS 8.5 on Windows Server 2012 R2
- IIS 10.0 on Windows Server 2016
Product - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
- [!INCLUDEiisexp75], [!INCLUDEiisexp80], [!INCLUDEiisexp100]
Header Httpcach.h

See Also

Web Server Core Interfaces