internal static User Create(IntPtr userPtr) { var userHandle = new SyncUserHandle(); userHandle.SetHandle(userPtr); return(new User(userHandle)); }
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 sessionHandle = new SessionHandle(); sessionHandle.SetHandle(sessionHandlePtr); var realmUri = new Uri(new string(urlBuffer, 0, (int)urlLength, System.Text.Encoding.UTF8)); user.RefreshAccessToken(realmUri.AbsolutePath) .ContinueWith(t => { if (t.IsFaulted) { // TODO: raise error event on the session } else { sessionHandle.RefreshAccessToken(t.Result.Item1, t.Result.Item2); } }); }
public SyncUserHandle GetUser() { var handle = new SyncUserHandle(); var ptr = NativeMethods.get_user(this); handle.SetHandle(ptr); return(handle); }
private static SyncUserHandle GetHandle(IntPtr ptr) { if (ptr == IntPtr.Zero) { return(null); } var handle = new SyncUserHandle(); handle.SetHandle(ptr); return(handle); }
public User GetUser() { var ptr = NativeMethods.get_user(this); if (ptr == IntPtr.Zero) { return(null); } var handle = new SyncUserHandle(); handle.SetHandle(ptr); return(new User(handle)); }
public static SyncUserHandle GetSyncUser(string identity, string refreshToken, string authServerUrl, bool isAdmin) { NativeException ex; var userPtr = NativeMethods.get_sync_user(identity, (IntPtr)identity.Length, refreshToken, (IntPtr)refreshToken.Length, authServerUrl, (IntPtr)authServerUrl?.Length, isAdmin, out ex); ex.ThrowIfNecessary(); var handle = new SyncUserHandle(); handle.SetHandle(userPtr); return(handle); }
private static SyncUserHandle GetHandle(IntPtr ptr) { if (ptr == IntPtr.Zero) { return null; } var handle = new SyncUserHandle(); handle.SetHandle(ptr); return handle; }
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(); }); }