//+-------------------------------------------------------------------------
//
//  Microsoft Windows Media Technologies
//  Copyright (C) Microsoft Corporation. All rights reserved.
//
//  File:       authen.idl
//
//  Contents:
//
//--------------------------------------------------------------------------

cpp_quote("//+-------------------------------------------------------------------------")
cpp_quote("//")
cpp_quote("//  Microsoft Windows Media Technologies")
cpp_quote("//  Copyright (C) Microsoft Corporation. All rights reserved.")
cpp_quote("//")
cpp_quote("//  Automatically generated by Midl")
cpp_quote("//")
cpp_quote("//  DO NOT EDIT THIS FILE.")
cpp_quote("//")
cpp_quote("//--------------------------------------------------------------------------")

cpp_quote("#if _MSC_VER > 1000")
cpp_quote("#pragma once")
cpp_quote("#endif // _MSC_VER > 1000")

import "oaidl.idl";

import "WMSContext.idl";

cpp_quote( "EXTERN_GUID( IID_IWMSAuthenticationPlugin , 0xBE185FF9,0x6932,0x11d2,0x8B,0x3B,0x00,0x60,0x97,0xB0,0x12,0x06  );" )
cpp_quote( "EXTERN_GUID( IID_IWMSAuthenticationContext , 0xBE185FFA,0x6932,0x11d2,0x8B,0x3B,0x00,0x60,0x97,0xB0,0x12,0x06  );" )
cpp_quote( "EXTERN_GUID( IID_IWMSAuthenticationCallback , 0xBE185FFB,0x6932,0x11d2,0x8B,0x3B,0x00,0x60,0x97,0xB0,0x12,0x06  );" )

interface IWMSAuthenticationPlugin;
interface IWMSAuthenticationContext;
interface IWMSAuthenticationCallback;


///////////////////////////////////////////////////////////////////////////////
//
//
///////////////////////////////////////////////////////////////////////////////
[
    object,
    uuid(BE185FF9-6932-11d2-8B3B-006097B01206),
	version(9.0),
    pointer_default(unique),
    helpstring("Provides methods for retrieving information about an authentication plugin and for accessing the plug-ins IWMSAuthenticationContext object.")
]
interface IWMSAuthenticationPlugin : IUnknown
{

    typedef [public] enum WMS_AUTHENTICATION_FLAGS
    {
        WMS_AUTHENTICATION_TEXT_CHALLENGE      = 0x01,
        WMS_AUTHENTICATION_CLIENT_SHOWS_UI     = 0x02,
        WMS_AUTHENTICATION_ANONYMOUS           = 0x04,
        WMS_AUTHENTICATION_CHALLENGE_FIRST     = 0x08,

    } WMS_AUTHENTICATION_FLAGS;

    //
    // Find out the authentication plugin's package name.
    //
    [helpstring("Called by the server to retrieve the name of the authentication plug-in package.")] HRESULT 
    GetPackageName( [out,retval] BSTR *pbstrPackageName );

    //
    // Find out the protocol supported by this authentication response plugin.
    // Examples include "Basic", "NTLM", "Digest", "Kerberos", etc...
    //
    [helpstring("Called by the server to retrieve the name of the protocol used by the authentication plug-in.")] HRESULT 
    GetProtocolName( [out,retval] BSTR *pbstrProtocolName );

    //
    // Flags come from WMS_AUTHENTICATION_FLAGS enum list
    //
    [helpstring("Called by the server to retrieve flags that indicate the credential acquisition support provided by the plug-in.")] HRESULT 
    GetFlags( [out,retval] long *plFlags );

    //
    // Create an authentication context which will be used by one session
    //
    [helpstring("Called by the server to retrieve an authentication context object.")] HRESULT 
    CreateAuthenticationContext( [out,retval] IWMSAuthenticationContext **ppAuthenCtx );
};


///////////////////////////////////////////////////////////////////////////////
//
//
///////////////////////////////////////////////////////////////////////////////
[
    object,
    uuid(BE185FFA-6932-11d2-8B3B-006097B01206),
	version(9.0),
    pointer_default(unique),
    helpstring("Provides methods that are used to authenticate a client.")
]
interface IWMSAuthenticationContext : IUnknown
{
    //
    // Get a pointer to the authentication plugin that implements this context
    //
    [helpstring("Called by the server to retrieve a pointer to the authentication plug-in that created this authentication context.")] HRESULT 
    GetAuthenticationPlugin(
                    [out,retval] IWMSAuthenticationPlugin **ppAuthenPlugin );

    //
    // Authenticate is the workhorse method that gets invoked one or more
    // times throughout an authentication challenge/response sequence
    //
    [helpstring("Called by the server to verify client credentials.")] HRESULT 
    Authenticate(
                    [in] VARIANT ResponseBlob,
                    [in] IWMSContext *pUserCtx,
                    [in] IWMSContext *pPresentationCtx,
                    [in] IWMSCommandContext *pCommandContext,
                    [in] IWMSAuthenticationCallback *pCallback,
                    [in] VARIANT Context );
    
    //
    // Get the logical user ID (only works if authentication has succeeded).
    //
    [helpstring("Called by the server to retrieve the logical user ID if authentication succeeds.")] HRESULT 
    GetLogicalUserID( [out,retval] BSTR *pbstrUserID );
    
    //
    // Get the name of the NT security user/group account that this context
    // impersonates (only works if authentication has succeeded).
    //
    [helpstring("Called by the server to retrieve the name of the user account or group associated with this authentication context.")] HRESULT 
    GetImpersonationAccountName( [out,retval] BSTR *pbstrAccountName );

    //
    // Get the handle of the NT security user/group account that this context
    // impersonates (only works if authentication has succeeded).
    //
    [helpstring("Called by the server to retrieve an impersonation access token for the user account associated with this authentication context.")] HRESULT 
    GetImpersonationToken( [out,retval] long *plToken );
};


///////////////////////////////////////////////////////////////////////////////
//
//
///////////////////////////////////////////////////////////////////////////////
[
    object,
    uuid(BE185FFB-6932-11d2-8B3B-006097B01206),
	version(9.0),
    pointer_default(unique),
    helpstring("Provides a method to notify the server of the results of an authentication request.")
]
interface IWMSAuthenticationCallback : IUnknown
{

    ///////////////////////////////////////////////////////////////////////////////
    //
    // Authentication return codes
    //
    typedef [public] enum WMS_AUTHENTICATION_RESULT
    {
        WMS_AUTHENTICATION_SUCCESS      = 0x01,
        WMS_AUTHENTICATION_DENIED       = 0x02,
        WMS_AUTHENTICATION_CONTINUE     = 0x03,
        WMS_AUTHENTICATION_ERROR        = 0x04

    }   WMS_AUTHENTICATION_RESULT;

    //
    // Called as a result of the context's Authenticate method completing.
    //
    [helpstring("Called by the plug-in to respond when the server calls IWMSAuthenticationContext::Authenticate.")] HRESULT 
    OnAuthenticateComplete(
                    [in] WMS_AUTHENTICATION_RESULT AuthResult,
                    [in] VARIANT ChallengeBlob,
                    [in] VARIANT Context );

};



