Show / Hide Table of Contents

    Class User

    This class represents a user on the Realm Object Server. The credentials are provided by various 3rd party providers (Facebook, Google, etc.). A user can log in to the Realm Object Server, and if access is granted, it is possible to synchronize the local and the remote Realm. Moreover, synchronization is halted when the user is logged out. It is possible to persist a user. By retrieving a user, there is no need to log in to the 3rd party provider again. Persisting a user between sessions, the user's credentials are stored locally on the device, and should be treated as sensitive data.

    Inheritance
    Object
    User
    Inherited Members
    Object.ToString()
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Object.MemberwiseClone()
    Namespace:Realms.Sync
    Assembly:Realm.Sync.dll
    Syntax
    public class User : IEquatable<User>

    Properties

    | Improve this Doc View Source

    AllLoggedIn

    Gets all currently logged in users.

    Declaration
    public static User[] AllLoggedIn { get; }
    Property Value
    Type Description
    User[]

    An array of valid logged in users.

    | Improve this Doc View Source

    Current

    Gets the currently logged-in user. If none exists, null is returned. If more than one user is currently logged in, an exception is thrown.

    Declaration
    public static User Current { get; }
    Property Value
    Type Description
    User

    Valid user or null to indicate nobody logged in.

    Exceptions
    Type Condition
    RealmException

    Thrown if there are more than one users logged in.

    | Improve this Doc View Source

    Identity

    Gets the identity of this user on the Realm Object Server. The identity is a guaranteed to be unique among all users on the Realm Object Server.

    Declaration
    public string Identity { get; }
    Property Value
    Type Description
    String

    A string that uniquely identifies that user in Realm Object Server.

    | Improve this Doc View Source

    RefreshToken

    Gets this user's refresh token. This is the user's credential for accessing the Realm Object Server and should be treated as sensitive data.

    Declaration
    public string RefreshToken { get; }
    Property Value
    Type Description
    String

    A unique string that can be used for refreshing the user's credentials.

    | Improve this Doc View Source

    ServerUri

    Gets the server URI that was used for authentication.

    Declaration
    public Uri ServerUri { get; }
    Property Value
    Type Description
    Uri

    The Uri used to connect to the authentication service.

    | Improve this Doc View Source

    State

    Gets the current state of the user.

    Declaration
    public UserState State { get; }
    Property Value
    Type Description
    UserState

    A value indicating whether the user is active, logged out, or an error has occurred.

    Methods

    | Improve this Doc View Source

    ConfigurePersistence(UserPersistenceMode, Byte[], Boolean)

    Configures user persistence. If you need to call this, be sure to do so before accessing any other Realm API.

    Declaration
    public static void ConfigurePersistence(UserPersistenceMode mode, byte[] encryptionKey = null, bool resetOnError = false)
    Parameters
    Type Name Description
    UserPersistenceMode mode

    The persistence mode.

    System.Byte[] encryptionKey

    The key to encrypt the persistent user store with.

    Boolean resetOnError

    If set to true reset the persistent user store on error.

    Remarks

    Users are persisted in a realm file within the application's sandbox.

    By default User objects are persisted and are additionaly protected with an encryption key stored in the iOS Keychain when running on an iOS device (but not on a Simulator). On Android users are persisted in plaintext, because the AndroidKeyStore API is only supported on API level 18 and up. You might want to provide your own encryption key on Android or disable persistence for security reasons.

    | Improve this Doc View Source

    Equals(User)

    Declaration
    public bool Equals(User other)
    Parameters
    Type Name Description
    User other
    Returns
    Type Description
    Boolean
    Implements
    IEquatable<T>.Equals(T)
    | Improve this Doc View Source

    Equals(Object)

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj
    Returns
    Type Description
    Boolean
    Overrides
    Object.Equals(Object)
    | Improve this Doc View Source

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32
    Overrides
    Object.GetHashCode()
    | Improve this Doc View Source

    GetLoggedInUser(String)

    Gets a logged in user with a specified identity.

    Declaration
    public static User GetLoggedInUser(string identity)
    Parameters
    Type Name Description
    String identity

    The identity of the user.

    Returns
    Type Description
    User

    A user instance if a logged in user with that id exists, null otherwise.

    | Improve this Doc View Source

    LoginAsync(Credentials, Uri)

    Logs the user in to the Realm Object Server.

    Declaration
    public static Task<User> LoginAsync(Credentials credentials, Uri serverUrl)
    Parameters
    Type Name Description
    Credentials credentials

    The credentials to use for authentication.

    Uri serverUrl

    The URI of the server that the user is authenticated against.

    Returns
    Type Description
    Task<User>

    An awaitable Task, that, upon completion, contains the logged in user.

    | Improve this Doc View Source

    LogOut()

    Logs out the user from the Realm Object Server. Once the Object Server has confirmed the logout the user credentials will be deleted from this device.

    Declaration
    public void LogOut()

    Extension Methods

    UserPermissionsExtensions.GetManagementRealm(User)
    UserPermissionsExtensions.GetPermissionRealm(User)
    • Improve this Doc
    • View Source
    Back to top Copyright © 2017 Realm
    Generated by DocFX