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

            return(new User(userHandle));
        }
Exemplo n.º 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);