상속: RealmHandle
예제 #1
0
        private static unsafe void HandleUserCallback(IntPtr tcs_ptr, IntPtr user_ptr, AppError error)
        {
            var tcsHandle = GCHandle.FromIntPtr(tcs_ptr);

            try
            {
                var tcs = (TaskCompletionSource <SyncUserHandle>)tcsHandle.Target;
                if (error.is_null)
                {
                    var userHandle = new SyncUserHandle(user_ptr);
                    tcs.TrySetResult(userHandle);
                }
                else
                {
                    tcs.TrySetException(new AppException(error));
                }
            }
            finally
            {
                tcsHandle.Free();
            }
        }
예제 #2
0
 public static extern bool get_is_admin(SyncUserHandle user);
예제 #3
0
 public static extern IntPtr get_server_url(SyncUserHandle user, IntPtr buffer, IntPtr buffer_length, out NativeException ex);
예제 #4
0
 public static extern IntPtr get_refresh_token(SyncUserHandle user, IntPtr buffer, IntPtr buffer_length, out NativeException ex);
예제 #5
0
 public static extern IntPtr switch_user(AppHandle app, SyncUserHandle user, out NativeException ex);
예제 #6
0
 public void SwitchUser(SyncUserHandle user)
 {
     NativeMethods.switch_user(this, user, out var ex);
     ex.ThrowIfNecessary();
 }
예제 #7
0
 public static extern IntPtr get_identities(SyncUserHandle handle, IntPtr buffer, IntPtr bufsize, out NativeException ex);
예제 #8
0
 public static extern void set_is_admin(SyncUserHandle user, [MarshalAs(UnmanagedType.I1)] bool value, out NativeException ex);
예제 #9
0
 public static extern void log_out(SyncUserHandle user, out NativeException ex);
예제 #10
0
 public static extern UserState get_state(SyncUserHandle user, out NativeException ex);
예제 #11
0
 public static extern IntPtr get_server_url(SyncUserHandle user, IntPtr buffer, IntPtr buffer_length, out NativeException ex);
예제 #12
0
 public static extern IntPtr get_refresh_token(SyncUserHandle user, IntPtr buffer, IntPtr buffer_length, out NativeException ex);
예제 #13
0
        private static SyncUserHandle GetHandle(IntPtr ptr)
        {
            if (ptr == IntPtr.Zero)
            {
                return null;
            }

            var handle = new SyncUserHandle();
            handle.SetHandle(ptr);
            return handle;
        }
 public static extern IntPtr get_path_for_realm(SyncUserHandle user, [MarshalAs(UnmanagedType.LPWStr)] string url, IntPtr url_len, IntPtr buffer, IntPtr bufsize, out NativeException ex);
        private static unsafe void RefreshAccessTokenCallback(IntPtr userHandlePtr, IntPtr sessionHandlePtr, sbyte* urlBuffer, IntPtr urlLength)
        {
            var userHandle = new SyncUserHandle();
            userHandle.SetHandle(userHandlePtr);
            var user = new User(userHandle);

            var session = Session.SessionForPointer(sessionHandlePtr);

            var realmUri = new Uri(new string(urlBuffer, 0, (int)urlLength, System.Text.Encoding.UTF8));

            user.RefreshAccessToken(realmUri.AbsolutePath)
                .ContinueWith(t =>
            {
                if (t.IsFaulted)
                {
                    session.RaiseError(t.Exception.GetBaseException());
                }
                else
                {
                    session.Handle.RefreshAccessToken(t.Result.Item1, t.Result.Item2);
                }
            }).ContinueWith(t =>
            {
                userHandle.Dispose();
            });
        }
예제 #16
0
 public static extern IntPtr get_session(SyncUserHandle user, [MarshalAs(UnmanagedType.LPWStr)] string path, IntPtr path_len, out NativeException ex);
예제 #17
0
 internal User(SyncUserHandle handle)
 {
     Handle           = handle;
     _permissionRealm = new Lazy <Realm>(() => GetSpecialPurposeRealm("__permission", typeof(PathPermission)));
     _managementRealm = new Lazy <Realm>(() => GetSpecialPurposeRealm("__management", typeof(PermissionChange), typeof(PermissionOffer), typeof(PermissionOfferResponse)));
 }
예제 #18
0
 internal User(SyncUserHandle handle)
 {
     Handle = handle;
 }
예제 #19
0
 public static extern void link_credentials(SyncUserHandle handle, AppHandle app, Native.Credentials credentials, IntPtr tcs_ptr, out NativeException ex);
예제 #20
0
 public static extern void create_api_key(SyncUserHandle handle, AppHandle app,
                                          [MarshalAs(UnmanagedType.LPWStr)] string name, IntPtr name_len,
                                          IntPtr tcs_ptr, out NativeException ex);
예제 #21
0
 public static extern void push_deregister(SyncUserHandle handle, AppHandle app,
                                           [MarshalAs(UnmanagedType.LPWStr)] string service, IntPtr service_len,
                                           IntPtr tcs_ptr, out NativeException ex);
예제 #22
0
 public static extern void fetch_api_keys(SyncUserHandle handle, AppHandle app, IntPtr tcs_ptr, out NativeException ex);
예제 #23
0
 public static extern IntPtr get_path_for_realm(AppHandle app, SyncUserHandle user, [MarshalAs(UnmanagedType.LPWStr)] string partition, IntPtr partition_len, IntPtr buffer, IntPtr bufsize, out NativeException ex);
예제 #24
0
 public static extern void enable_api_key(SyncUserHandle handle, AppHandle app, PrimitiveValue id, IntPtr tcs_ptr, out NativeException ex);
예제 #25
0
 public static extern void remove_user(AppHandle app, SyncUserHandle user, IntPtr tcs_ptr, out NativeException ex);
예제 #26
0
 public static extern Credentials.AuthProvider get_auth_provider(SyncUserHandle user, out NativeException ex);
예제 #27
0
 public static extern IntPtr set_refresh_token(SyncUserHandle user, [MarshalAs(UnmanagedType.LPWStr)] string refresh_token, IntPtr refresh_token_len, out NativeException ex);
예제 #28
0
 public static extern IntPtr get_profile_data(SyncUserHandle user, UserProfileField field,
                                              IntPtr buffer, IntPtr buffer_length, [MarshalAs(UnmanagedType.U1)] out bool isNull,
                                              out NativeException ex);
예제 #29
0
 public static extern UserState get_state(SyncUserHandle user, out NativeException ex);
예제 #30
0
 public static extern IntPtr get_custom_data(SyncUserHandle user, IntPtr buffer, IntPtr buffer_length,
                                             [MarshalAs(UnmanagedType.U1)] out bool isNull, out NativeException ex);
예제 #31
0
 public static extern void log_out(SyncUserHandle user, out NativeException ex);
예제 #32
0
 public static extern IntPtr get_app(SyncUserHandle user, out NativeException ex);
 public static extern IntPtr get_path_for_realm(SyncUserHandle user, [MarshalAs(UnmanagedType.LPWStr)] string url, IntPtr url_len, IntPtr buffer, IntPtr bufsize, out NativeException ex);
예제 #34
0
 public static extern void refresh_custom_data(SyncUserHandle user, IntPtr tcs_ptr, out NativeException ex);
예제 #35
0
        internal static User Create(IntPtr userPtr)
        {
            var userHandle = new SyncUserHandle(userPtr);

            return(new User(userHandle));
        }
예제 #36
0
 public static extern void call_function(SyncUserHandle handle, AppHandle app,
                                         [MarshalAs(UnmanagedType.LPWStr)] string function_name, IntPtr function_name_len,
                                         [MarshalAs(UnmanagedType.LPWStr)] string args, IntPtr args_len,
                                         IntPtr tcs_ptr, out NativeException ex);