IIS Modules (5/6)

#ifndef _NDFSW_TUTORIALS_IIS_IISHARDCODEDAUTHENTICATIONMODULEFACTORY_H_
#define _NDFSW_TUTORIALS_IIS_IISHARDCODEDAUTHENTICATIONMODULEFACTORY_H_

#define _WINSOCKAPI_
#include <httpserv.h>    // for IHttpModuleFactory

class IISHardcodedAuthenticationModuleFactory : public IHttpModuleFactory
{
public:
    HRESULT GetHttpModule(OUT CHttpModule** ppModule, IN IModuleAllocator* pAllocator);
    void Terminate();
};

#endif
#ifndef _NDFSW_TUTORIALS_IIS_IISHARDCODEDAUTHENTICATIONMODULE_H_
#define _NDFSW_TUTORIALS_IIS_IISHARDCODEDAUTHENTICATIONMODULE_H_

#define _WINSOCKAPI_
#include <httpserv.h>    // for CHttpModule
#include <string>

class IISHardcodedAuthenticationModule : public CHttpModule
{
public:
    REQUEST_NOTIFICATION_STATUS OnAuthenticateRequest(IN IHttpContext* pHttpContext,
        IN IAuthenticationProvider* pProvider);
};

#endif
#ifndef _NDFSW_TUTORIALS_IIS_IISHARDCODEDUSER_H_
#define _NDFSW_TUTORIALS_IIS_IISHARDCODEDUSER_H_

#define _WINSOCKAPI_
#include <httpserv.h>    // for IHttpUser

class IISHardcodedUser : public IHttpUser
{
public:
    IISHardcodedUser();

    virtual PCWSTR GetUserName();
    virtual PCWSTR GetRemoteUserName();
    virtual PCWSTR GetPassword();
    virtual PCWSTR GetAuthenticationType();
    virtual HANDLE GetImpersonationToken();
    virtual HANDLE GetPrimaryToken();
    virtual BOOL SupportsIsInRole();
    virtual HRESULT IsInRole(IN PCWSTR pszRoleName, OUT BOOL* pfInRole);
    virtual PVOID GetUserVariable(IN PCSTR pszVariableName);
    virtual VOID ReferenceUser();
    virtual VOID DereferenceUser();

private:
    ~IISHardcodedUser();

private:
    static const wchar_t* smUserName;
    static const wchar_t* smPassword;

    LONG mReferenceCount;
};

#endif

blog comments powered by Disqus

Copyright(c) 2006-2017 Xavier Leclercq | Privacy policy

Home
Contact Us
Search