Locked BITS Proxy Authentication

  • 2005年9月24日 上午 10:20
     
     
    Hi,

    Does any one know how to specify proxy authentication data using BITS in .net. I am using the Bits wrapper that duncan mac created http://msdn.microsoft.com/library/en-us/dncodefun/html/code4fun02282003.asp?frame=true or does anyone know how to modify this wrapper to allow for proxy authentication.

    thanks in advance

    Glenn

所有回覆

  • 2005年9月26日 下午 05:12
    版主
     
     

    Glenn,
    I am not a BITS expert, but I quickly browsed the sample and the BITS msdn info
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/bits/bits/ibackgroundcopyjob.asp

    In this reference page the interface IBackgroundCopyJob2 implements the
    SetCredentials method which takes

    typedef struct {
    BG_AUTH_TARGET Target;
    BG_AUTH_SCHEME Scheme;
    BG_AUTH_CREDENTIALS_UNION Credentials; } BG_AUTH_CREDENTIALS;

    Members

    Target
    Identifies whether to use the credentials for a proxy or server authentication request. For a list of values, see the BG_AUTH_TARGET enumeration. You can specify only one value.
    Scheme
    Identifies the scheme to use for authentication (for example, Basic or NTLM). For a list of values, see the BG_AUTH_SCHEME enumeration. You can specify only one value.
    Credentials
    Identifies the credentials to use for the specified authentication scheme. For details, see the BG_AUTH_CREDENTIALS_UNION union.

     

    The BG_AUTH_TARGET

    BG_AUTH_TARGET

    The BG_AUTH_TARGET enumeration defines the constant values that specify whether the credentials are used for proxy or server user authentication requests.

    typedef enum { BG_AUTH_TARGET_SERVER
    BG_AUTH_TARGET_SERVER
    Use credentials for server requests.
    = 1, BG_AUTH_TARGET_PROXY
    BG_AUTH_TARGET_PROXY
    Use credentials for proxy requests.
    } BG_AUTH_TARGET;

    Constants

    BG_AUTH_TARGET_SERVER
    Use credentials for server requests.
    BG_AUTH_TARGET_PROXY
    Use credentials for proxy requests.

    So you can set the proxy credentials that way.

    That said the Wrapper they produced in the sample does not seem to have the interface
    IBackgroundCopyJob2  defined. I browsed thsi interface through the Visual stuio. So I belive that you can't set the credentials using the wrapper they provided. You could possibly generate your own wrapper and make sure that this interfaces is included.

    I sent this question to the BITS team for an authoritative answer. But for now, I don't think you can do this through the wrapper they provided

  • 2005年9月26日 下午 05:54
    版主
     
     已答覆

    Glenn,

    I heard back from the BITS group.

    1. Please this question to the Microsoft.public.windows.backgroundtransfer newsgroup (on msnews.microsoft.com).

    2. Apparently, this question has been addressed many times in the past. If  you are using Duncan’s wrapper (not associated with the BITS team) it will not work because Duncan used MIDL and TLBIMP to create the assembly and since unions are not native to VB or C# the tools are unable to translate BG_AUTH_CREDENTIALS_UNION correctly.

    3. If you want to use this approach, you need to write a managed C++ wrapper for SetCredentials.

    4. The other option is to use the information on the following page to figure out how to create the structure for it in whatever language you are using and also define the interfaces.
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconunionssample.asp

     

    Good Luck!!!