Table of Contents

Interface IUserService

Namespace
Oqtane.Services
Assembly
Oqtane.Client.dll

Manage (get / update) user information

public interface IUserService

Methods

AddUserAsync(User)

Save a user to the Database. The User object contains all the information incl. what Site it belongs to.

Task<User> AddUserAsync(User user)

Parameters

user User

Returns

Task<User>

DeleteUserAsync(int, int)

Delete / remove a user in the database

Task DeleteUserAsync(int userId, int siteId)

Parameters

userId int

ID-reference to the User

siteId int

ID-reference to the Site

Returns

Task

ForgotPasswordAsync(User)

Trigger a forgot-password e-mail for this User.

Task ForgotPasswordAsync(User user)

Parameters

user User

Returns

Task

GetPasswordRequirementsAsync(int)

Get password requirements for site

Task<string> GetPasswordRequirementsAsync(int siteId)

Parameters

siteId int

ID of a Site

Returns

Task<string>

GetPersonalAccessTokenAsync()

Get personal access token for current user (administrators only)

Task<string> GetPersonalAccessTokenAsync()

Returns

Task<string>

GetTokenAsync()

Get token for current user

Task<string> GetTokenAsync()

Returns

Task<string>

GetUserAsync(int, int)

Get a User of a specific site

Task<User> GetUserAsync(int userId, int siteId)

Parameters

userId int

ID of a User

siteId int

ID of a Site

Returns

Task<User>

GetUserAsync(string, int)

Get a User of a specific site

Task<User> GetUserAsync(string username, int siteId)

Parameters

username string

Username / login of a User

siteId int

ID of a Site

Returns

Task<User>

GetUserAsync(string, string, int)

Get a User of a specific site

Task<User> GetUserAsync(string username, string email, int siteId)

Parameters

username string

Username / login of a User

email string

email address of a User

siteId int

ID of a Site

Returns

Task<User>

ImportUsersAsync(int, int, bool)

Bulk import of users

Task<Dictionary<string, string>> ImportUsersAsync(int siteId, int fileId, bool notify)

Parameters

siteId int

ID of a Site

fileId int

ID of a File

notify bool

Indicates if new users should be notified by email

Returns

Task<Dictionary<string, string>>

LinkUserAsync(User, string, string, string, string)

Link an external login with a local user account

Task<User> LinkUserAsync(User user, string token, string type, string key, string name)

Parameters

user User

The User we're verifying

token string

A Hash value in the URL which verifies this user got the e-mail (containing this token)

type string

External Login provider type

key string

External Login provider key

name string

External Login provider display name

Returns

Task<User>

LoginUserAsync(User, bool, bool)

Will login the specified User.

Note that this will probably not be a real User, but a user object where the Username and Password have been filled.

Task<User> LoginUserAsync(User user, bool setCookie, bool isPersistent)

Parameters

user User

A User object which should have at least the Username and Password set.

setCookie bool

Determines if the login cookie should be set (only relevant for Hybrid scenarios)

isPersistent bool

Determines if the login cookie should be persisted for a long time.

Returns

Task<User>

LogoutUserAsync(User)

Logout a User

Task LogoutUserAsync(User user)

Parameters

user User

Returns

Task

LogoutUserEverywhereAsync(User)

Logout a User

Task LogoutUserEverywhereAsync(User user)

Parameters

user User

Returns

Task

ResetPasswordAsync(User, string)

Reset the password of this User

Task<User> ResetPasswordAsync(User user, string token)

Parameters

user User
token string

Returns

Task<User>

UpdateUserAsync(User)

Update an existing user in the database.

Task<User> UpdateUserAsync(User user)

Parameters

user User

Returns

Task<User>

ValidatePasswordAsync(string)

Validate a users password against the password policy

Task<bool> ValidatePasswordAsync(string password)

Parameters

password string

Returns

Task<bool>

ValidateUserAsync(string, string, string)

Validate identity user info.

Task<UserValidateResult> ValidateUserAsync(string username, string email, string password)

Parameters

username string
email string
password string

Returns

Task<UserValidateResult>

VerifyEmailAsync(User, string)

Update e-mail verification status of a user.

Task<User> VerifyEmailAsync(User user, string token)

Parameters

user User

The User we're verifying

token string

A Hash value in the URL which verifies this user got the e-mail (containing this token)

Returns

Task<User>

VerifyTwoFactorAsync(User, string)

Verify the two factor verification code User

Task<User> VerifyTwoFactorAsync(User user, string token)

Parameters

user User
token string

Returns

Task<User>