QuerySecurityContextToken() public static méthode

public static QuerySecurityContextToken ( System.Net.Security.SSPIInterface secModule, SafeDeleteContext context, SecurityContextTokenHandle &token ) : int
secModule System.Net.Security.SSPIInterface
context SafeDeleteContext
token SecurityContextTokenHandle
Résultat int
Exemple #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);
        }
        internal SafeCloseHandle GetContextToken(out SecurityStatus status)
        {
            if (!this.IsValidContext)
            {
                throw new Win32Exception(-2146893055);
            }
            SafeCloseHandle token = null;

            status = (SecurityStatus)SSPIWrapper.QuerySecurityContextToken(GlobalSSPI.SSPIAuth, this.m_SecurityContext, out token);
            return(token);
        }