Exemple #1
0
 private static void bindingSetAuthInfo(RPC_C_AUTHN_LEVEL level, RPC_C_AUTHN[] authTypes,
                                        RpcHandle handle, string serverPrincipalName, NetworkCredential credentails)
 {
     if (credentails == null)
     {
         foreach (RPC_C_AUTHN atype in authTypes)
         {
             RPC_STATUS result = NativeMethods.RpcBindingSetAuthInfo2(handle.Handle, serverPrincipalName, level, atype, IntPtr.Zero, 0);
             if (result != RPC_STATUS.RPC_S_OK)
             {
                 RpcTrace.Warning("Unable to register {0}, result = {1}", atype, new RpcException(result).Message);
             }
         }
     }
     else
     {
         SEC_WINNT_AUTH_IDENTITY pSecInfo = new SEC_WINNT_AUTH_IDENTITY(credentails);
         foreach (RPC_C_AUTHN atype in authTypes)
         {
             RPC_STATUS result = NativeMethods.RpcBindingSetAuthInfo(handle.Handle, serverPrincipalName, level, atype, ref pSecInfo, 0);
             if (result != RPC_STATUS.RPC_S_OK)
             {
                 RpcTrace.Warning("Unable to register {0}, result = {1}", atype, new RpcException(result).Message);
             }
         }
     }
 }
Exemple #2
0
 public static extern RPC_STATUS RpcBindingInqAuthClient(
     IntPtr ClientBinding,
     ref IntPtr Privs,
     StringBuilder ServerPrincName,
     ref RPC_C_AUTHN_LEVEL AuthnLevel,
     ref RPC_C_AUTHN AuthnSvc,
     ref RPC_C_AUTHZ AuthzSvc);
Exemple #3
0
 public static extern RPC_STATUS RpcBindingInqAuthInfo(
     IntPtr Binding,
     StringBuilder ServerPrincName,
     ref RPC_C_AUTHN_LEVEL AuthnLevel,
     ref RPC_C_AUTHN AuthnSvc,
     ref IntPtr AuthIdentity,
     ref RPC_C_AUTHZ AuthzSvc);
 public static extern uint RpcBindingSetAuthInfo(
     IntPtr Binding,
     string ServerPrincName,
     RPC_C_AUTHN_LEVEL AuthnLevel,
     RPC_C_AUTHN AuthnSvc,
     ref SEC_WINNT_AUTH_IDENTITY AuthIdentity,
     RPC_C_AUTHN AuthzService);
Exemple #5
0
 public static extern int CoInitializeSecurity(
     IntPtr securityDescriptor,  // Access permissions
     int cAuthSvc,               // Count of entries in asAuthSvc
     IntPtr asAuthSvc,           // Array of authentication services
     IntPtr pReserved1,          // Reserved for future use
     RPC_C_AUTHN_LEVEL level,    // Default authentication level
     RPC_C_IMP_LEVEL impers,     // Default impersonation level
     IntPtr pAuthList,
     EOLE_AUTHENTICATION_CAPABILITIES dwCapabilities,
     IntPtr pReserved3           // Reserved for future use
     );
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="clientGuid">an object UUID which represents the RPC caller.</param>
 /// <param name="serverComputerName">the NetworkingAddress of the RPC server.</param>
 /// <param name="protocolSequence">a string representation of a protocol sequence.</param>
 /// <param name="endPoint">a string representation of an endpoint.</param>
 /// <param name="networkOptions">a string representation of network options. The option string is associated
 /// with the protocol sequence.</param>
 /// <param name="servicePrincipalName">the expected principal name of the server referenced by Binding.</param>
 /// <param name="authenticationLevel">Level of authentication to be performed on remote procedure calls
 /// made using Binding.</param>
 /// <param name="authenticationService">Authentication service to use.</param>
 /// <param name="authenticationIdentity">the structure containing the client's authentication and 
 /// authorization credentials appropriate for the selected authentication and authorization service.</param>
 /// <param name="authorizationService">Authorization service implemented by the server for the interface of
 /// interest.</param>
 public RpcClientConfig(
     Guid? clientGuid,
     String serverComputerName,
     String protocolSequence,
     String endPoint,
     String networkOptions,
     String servicePrincipalName,
     RPC_C_AUTHN_LEVEL authenticationLevel,
     RPC_C_AUTHN authenticationService,
     SEC_WINNT_AUTH_IDENTITY authenticationIdentity,
     RPC_C_AUTHN authorizationService)
 {
     this.clientGuid = clientGuid;
     this.serverComputerName = serverComputerName;
     this.protocolSequence = protocolSequence;
     this.endPoint = endPoint;
     this.networkOptions = networkOptions;
     this.servicePrincipalName = servicePrincipalName;
     this.authenticationLevel = authenticationLevel;
     this.authenticationService = authenticationService;
     this.authenticationIdentity = authenticationIdentity;
     this.authorizationService = authorizationService;
 }
Exemple #7
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="clientGuid">an object UUID which represents the RPC caller.</param>
 /// <param name="serverComputerName">the NetworkingAddress of the RPC server.</param>
 /// <param name="protocolSequence">a string representation of a protocol sequence.</param>
 /// <param name="endPoint">a string representation of an endpoint.</param>
 /// <param name="networkOptions">a string representation of network options. The option string is associated
 /// with the protocol sequence.</param>
 /// <param name="servicePrincipalName">the expected principal name of the server referenced by Binding.</param>
 /// <param name="authenticationLevel">Level of authentication to be performed on remote procedure calls
 /// made using Binding.</param>
 /// <param name="authenticationService">Authentication service to use.</param>
 /// <param name="authenticationIdentity">the structure containing the client's authentication and
 /// authorization credentials appropriate for the selected authentication and authorization service.</param>
 /// <param name="authorizationService">Authorization service implemented by the server for the interface of
 /// interest.</param>
 public RpcClientConfig(
     Guid?clientGuid,
     String serverComputerName,
     String protocolSequence,
     String endPoint,
     String networkOptions,
     String servicePrincipalName,
     RPC_C_AUTHN_LEVEL authenticationLevel,
     RPC_C_AUTHN authenticationService,
     SEC_WINNT_AUTH_IDENTITY authenticationIdentity,
     RPC_C_AUTHN authorizationService)
 {
     this.clientGuid             = clientGuid;
     this.serverComputerName     = serverComputerName;
     this.protocolSequence       = protocolSequence;
     this.endPoint               = endPoint;
     this.networkOptions         = networkOptions;
     this.servicePrincipalName   = servicePrincipalName;
     this.authenticationLevel    = authenticationLevel;
     this.authenticationService  = authenticationService;
     this.authenticationIdentity = authenticationIdentity;
     this.authorizationService   = authorizationService;
 }
Exemple #8
0
 /// <summary>
 /// Adds authentication information to the client, use the static Self to
 /// authenticate as the currently logged on Windows user.  This overload allows
 /// you to specify the privacy level and authentication types to try. Normally
 /// these default to RPC_C_PROTECT_LEVEL_PKT_PRIVACY, and both RPC_C_AUTHN_GSS_NEGOTIATE
 /// or RPC_C_AUTHN_WINNT if that fails.  If credentials is null, or is the Anonymous
 /// user, RPC_C_PROTECT_LEVEL_DEFAULT and RPC_C_AUTHN_NONE are used instead.
 /// </summary>
 public void AuthenticateAs(string serverPrincipalName, NetworkCredential credentials, RPC_C_AUTHN_LEVEL level, params RPC_C_AUTHN[] authTypes)
 {
     if (!_authenticated)
     {
         bindingSetAuthInfo(level, authTypes, _handle, serverPrincipalName, credentials);
         _authenticated = true;
     }
 }
 public static extern uint RpcBindingSetAuthInfo(
     IntPtr Binding,
     string ServerPrincName,
     RPC_C_AUTHN_LEVEL AuthnLevel,
     RPC_C_AUTHN AuthnSvc,
     ref SEC_WINNT_AUTH_IDENTITY AuthIdentity,
     RPC_C_AUTHN AuthzService);
Exemple #10
0
 public static extern RPC_STATUS RpcBindingSetAuthInfo2(IntPtr Binding, String ServerPrincName,
                                                        RPC_C_AUTHN_LEVEL AuthnLevel, RPC_C_AUTHN AuthnSvc,
                                                        IntPtr p, RPC_C_AUTHZ AuthzService);
Exemple #11
0
		internal static extern int CoInitializeSecurity(System.IntPtr pVoid, int cAuthSvc,
			System.IntPtr asAuthSvc, System.IntPtr pReserved1, RPC_C_AUTHN_LEVEL dwAuthnLevel,
			RPC_C_IMP_LEVEL dwImpLevel, System.IntPtr pAuthList, int dwCapabilities, System.IntPtr pReserved3);
Exemple #12
0
 public static extern HRESULT CoInitializeSecurity([Optional] IntPtr pSecDesc, int cAuthSvc, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] SOLE_AUTHENTICATION_SERVICE[] asAuthSvc,
                                                   [Optional] IntPtr pReserved1, RPC_C_AUTHN_LEVEL dwAuthnLevel, RPC_C_IMP_LEVEL dwImpLevel, in SOLE_AUTHENTICATION_LIST pAuthList, EOLE_AUTHENTICATION_CAPABILITIES dwCapabilities,
Exemple #13
0
 public static extern RPC_STATUS RpcBindingInqAuthInfo(
     IntPtr Binding,
     StringBuilder ServerPrincName,
     ref RPC_C_AUTHN_LEVEL AuthnLevel,
     ref RPC_C_AUTHN AuthnSvc,
        ref     IntPtr AuthIdentity,
     ref RPC_C_AUTHZ AuthzSvc);
Exemple #14
0
 public static extern RPC_STATUS RpcBindingInqAuthClient(
     IntPtr ClientBinding,
     ref IntPtr Privs,
     StringBuilder ServerPrincName,
     ref RPC_C_AUTHN_LEVEL AuthnLevel,
     ref RPC_C_AUTHN AuthnSvc,
     ref RPC_C_AUTHZ AuthzSvc);
Exemple #15
0
 public static extern RPC_STATUS RpcBindingSetAuthInfo2(IntPtr Binding, String ServerPrincName,
                                                       RPC_C_AUTHN_LEVEL AuthnLevel, RPC_C_AUTHN AuthnSvc,
                                                       IntPtr p, RPC_C_AUTHZ AuthzService);
Exemple #16
0
 public static extern int CoInitializeSecurity(
     IntPtr securityDescriptor,  // Access permissions 
     int cAuthSvc,               // Count of entries in asAuthSvc
     IntPtr asAuthSvc,           // Array of authentication services 
     IntPtr pReserved1,          // Reserved for future use
     RPC_C_AUTHN_LEVEL level,    // Default authentication level
     RPC_C_IMP_LEVEL impers,     // Default impersonation level
     IntPtr pAuthList,
     EOLE_AUTHENTICATION_CAPABILITIES dwCapabilities,
     IntPtr pReserved3           // Reserved for future use
     );