System.Net.SSPIWrapper.QuerySecurityContextToken C# (CSharp) Method

QuerySecurityContextToken() public static method

public static QuerySecurityContextToken ( System.Net.Security.SSPIInterface secModule, SafeDeleteContext context, SecurityContextTokenHandle &token ) : int
secModule System.Net.Security.SSPIInterface
context SafeDeleteContext
token SecurityContextTokenHandle
return int
        public static int QuerySecurityContextToken(SSPIInterface secModule, SafeDeleteContext context, out SecurityContextTokenHandle token)
        {
            return secModule.QuerySecurityContextToken(context, out token);
        }

Usage Example

Example #1
0
        // This will return a client token when conducted authentication on server side.
        // This token can be used for impersonation. We use it to create a WindowsIdentity and hand it out to the server app.
        internal SecurityContextTokenHandle GetContextToken(out Interop.SecurityStatus status)
        {
            if ((IsCompleted && IsValidContext) && GlobalLog.IsEnabled)
            {
                GlobalLog.AssertFormat("NTAuthentication#{0}::GetContextToken|Should be called only when completed with success, currently is not!", LoggingHash.HashString(this));
            }

            if (IsServer && GlobalLog.IsEnabled)
            {
                GlobalLog.AssertFormat("NTAuthentication#{0}::GetContextToken|The method must not be called by the client side!", LoggingHash.HashString(this));
            }

            if (!IsValidContext)
            {
                throw new Win32Exception((int)Interop.SecurityStatus.InvalidHandle);
            }

            SecurityContextTokenHandle token = null;

            status = (Interop.SecurityStatus)SSPIWrapper.QuerySecurityContextToken(
                GlobalSSPI.SSPIAuth,
                _securityContext,
                out token);

            return(token);
        }
All Usage Examples Of System.Net.SSPIWrapper::QuerySecurityContextToken