using Microsoft.AspNetCore.Http;
using RSecurityBackend.Models.Auth.Db;
using RSecurityBackend.Models.Auth.Memory;
using RSecurityBackend.Models.Auth.ViewModels;
using RSecurityBackend.Models.Generic;
using RSecurityBackend.Models.Image;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace RSecurityBackend.Services
{
///
/// Authentication Service
///
public interface IAppUserService
{
///
/// Login user, if failed return LoggedOnUserModel is null
///
///
///
///
Task> Login(LoginViewModel loginViewModel, string clientIPAddress);
///
/// replace a (probably expired session) with a new one
///
///
///
///
Task> ReLogin(Guid sessionId, string clientIPAddress);
///
/// Logout
///
///
///
///
Task> Logout(Guid userId, Guid sessionId);
///
/// Does Session exist?
///
///
///
///
Task> SessionExists(Guid userId, Guid sessionId);
///
/// is user admin?
///
///
///
Task> IsAdmin(Guid userId);
///
/// is user in either of passed roles?
///
///
///
///
Task> IsInRoles(Guid userId, string[] roleNames);
///
/// Get User Roles
///
///
///
Task>> GetUserRoles(Guid userId);
///
/// remove user from role
///
/// user id
///
///
Task> RemoveFromRole(Guid id, string role);
///
/// add user to role
///
/// user id
///
///
Task> AddToRole(Guid id, string role);
///
/// Lists user permissions
///
///
///
Task> GetUserSecurableItemsStatus(Guid userId);
///
/// Has user specified permission
///
///
///
///
///
Task> HasPermission(Guid userId, string securableItemShortName, string operationShortName);
///
/// returns user information
///
///
/// PasswordHash becomes empty
///
///
///
Task> GetUserInformation(Guid userId);
///
/// all users informations
///
///
Task> GetAllUsersInformation();
///
/// add a new user
///
///
///
Task> AddUser(RegisterRAppUser newUserInfo);
///
/// add user to role
///
///
///
///
Task> AddUserToRole(Guid userId, string roleName);
///
/// modify existing user
///
///
///
///
Task> ModifyUser(Guid userId, RegisterRAppUser updateUserInfo);
///
/// change user password checking old password
///
///
///
///
///
Task> ChangePassword(Guid userId, string oldPassword, string newPassword);
///
/// delete user
///
///
/// true if succeeds
Task> DeleteUser(Guid userId);
///
/// Set User Image
///
///
///
/// new user image id
Task> SetUserImage(Guid userId, IFormFileCollection files);
///
/// Get User Sessions
///
/// if null is passed returns all sessions
///
Task> GetUserSessions(Guid? userId);
///
/// Get User Image
///
///
///
Task> GetUserImage(Guid userId);
///
/// Start signup process using email
///
///
///
///
///
///
Task> SignUp(string email, string clientIPAddress, string clientAppName, string langauge);
///
/// verify signup / forgot password
///
///
///
/// associated email
Task> RetrieveEmailFromQueueSecret(RVerifyQueueType verifyQueueType, string secret);
///
/// finalize signup process using email
///
///
///
///
///
///
///
Task> FinalizeSignUp(string email, string secret, string password, string firstName, string sureName);
///
/// Start forgot password process using email
///
///
///
///
///
///
Task> ForgotPassword(string email, string clientIPAddress, string clientAppName, string langauge);
///
/// reset password using email
///
///
///
///
///
///
Task> ResetPassword(string email, string secret, string password, string clientIPAddress);
///
/// delete tenant
///
///
RServiceResult DeleteTenant();
///
/// Find User By Email
///
///
///
Task> FindUserByEmail(string email);
///
/// Administrator role name
///
string AdministratorRoleName { get; }
///
/// secret used for generating Jwt token
///
string TokenSecret { get; }
///
/// JWT Tokens Expiration Time Out
///
int DefaultTokenExpirationInSeconds { get; }
}
}