コード例 #1
0
        private static int GetAuthenticationTokenCallback(IntPtr context, IntPtr authenticationParameters, out IntPtr iph)
        {
            int result = 0;
            OAuth2CallbackContext authCallbackContext = null;

            iph = IntPtr.Zero;
            try
            {
                GCHandle gch = GCHandle.FromIntPtr(context);
                authCallbackContext = (OAuth2CallbackContext)gch.Target;

                NameValueCollection authParamList = new NameValueCollection();
                SafeNativeMethods.MarshalNameValueListToManaged(authenticationParameters, authParamList);

                if (null != authCallbackContext.Callback)
                {
                    SafeInformationProtectionTokenHandle safeToken =
                        authCallbackContext.Callback(authCallbackContext.CallbackContext, authParamList);
                    IntPtr iphValue = safeToken.Value;
                    safeToken.SetHandleAsInvalid();
                    iph = iphValue;
                }
            }
            catch (Exception except)
            {
                result = (new ExceptionTranslator(except)).HR;
            }
            return(result);
        }
コード例 #2
0
 internal static extern int IpcCreateOAuth2Token(
     string wszAccessToken,
     [Out] out SafeInformationProtectionTokenHandle ppv);