Inheritance: RealmHandle
Exemple #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();
            }
        }
Exemple #2
0
 public static extern bool get_is_admin(SyncUserHandle user);
Exemple #3
0
 public static extern IntPtr get_server_url(SyncUserHandle user, IntPtr buffer, IntPtr buffer_length, out NativeException ex);
Exemple #4
0
 public static extern IntPtr get_refresh_token(SyncUserHandle user, IntPtr buffer, IntPtr buffer_length, out NativeException ex);
Exemple #5
0
 public static extern IntPtr switch_user(AppHandle app, SyncUserHandle user, out NativeException ex);
Exemple #6
0
 public void SwitchUser(SyncUserHandle user)
 {
     NativeMethods.switch_user(this, user, out var ex);
     ex.ThrowIfNecessary();
 }
Exemple #7
0
 public static extern IntPtr get_identities(SyncUserHandle handle, IntPtr buffer, IntPtr bufsize, out NativeException ex);
 public static extern void set_is_admin(SyncUserHandle user, [MarshalAs(UnmanagedType.I1)] bool value, out NativeException ex);
Exemple #9
0
 public static extern void log_out(SyncUserHandle user, out NativeException ex);
Exemple #10
0
 public static extern UserState get_state(SyncUserHandle user, out NativeException ex);
Exemple #11
0
 public static extern IntPtr get_server_url(SyncUserHandle user, IntPtr buffer, IntPtr buffer_length, out NativeException ex);
Exemple #12
0
 public static extern IntPtr get_refresh_token(SyncUserHandle user, IntPtr buffer, IntPtr buffer_length, out NativeException ex);
Exemple #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();
            });
        }
Exemple #16
0
 public static extern IntPtr get_session(SyncUserHandle user, [MarshalAs(UnmanagedType.LPWStr)] string path, IntPtr path_len, out NativeException ex);
Exemple #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)));
 }
Exemple #18
0
 internal User(SyncUserHandle handle)
 {
     Handle = handle;
 }
Exemple #19
0
 public static extern void link_credentials(SyncUserHandle handle, AppHandle app, Native.Credentials credentials, IntPtr tcs_ptr, out NativeException ex);
Exemple #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);
Exemple #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);
Exemple #22
0
 public static extern void fetch_api_keys(SyncUserHandle handle, AppHandle app, IntPtr tcs_ptr, out NativeException ex);
Exemple #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);
Exemple #24
0
 public static extern void enable_api_key(SyncUserHandle handle, AppHandle app, PrimitiveValue id, IntPtr tcs_ptr, out NativeException ex);
Exemple #25
0
 public static extern void remove_user(AppHandle app, SyncUserHandle user, IntPtr tcs_ptr, out NativeException ex);
Exemple #26
0
 public static extern Credentials.AuthProvider get_auth_provider(SyncUserHandle user, out NativeException ex);
Exemple #27
0
 public static extern IntPtr set_refresh_token(SyncUserHandle user, [MarshalAs(UnmanagedType.LPWStr)] string refresh_token, IntPtr refresh_token_len, out NativeException ex);
Exemple #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);
Exemple #29
0
 public static extern UserState get_state(SyncUserHandle user, out NativeException ex);
Exemple #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);
Exemple #31
0
 public static extern void log_out(SyncUserHandle user, out NativeException ex);
Exemple #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);
Exemple #34
0
 public static extern void refresh_custom_data(SyncUserHandle user, IntPtr tcs_ptr, out NativeException ex);
Exemple #35
0
        internal static User Create(IntPtr userPtr)
        {
            var userHandle = new SyncUserHandle(userPtr);

            return(new User(userHandle));
        }
Exemple #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);