Skip to content

AuthenticationService

Namespace: Rest_API.Services.Auth

public class AuthenticationService : IAuthenticationService

Inheritance ObjectAuthenticationService

Implements IAuthenticationService

Constructors

AuthenticationService(ILogger<AuthenticationService>, UserManager<ApiUser>, RoleManager<IdentityRole>, ITokenService, ITokenRepo)

public AuthenticationService(ILogger<AuthenticationService> logger, UserManager<ApiUser> userManager, RoleManager<IdentityRole> roleManager, ITokenService tokenService, ITokenRepo tokenRepo)

Parameters

logger ILogger<AuthenticationService>

userManager UserManager<ApiUser>

roleManager RoleManager<IdentityRole>

tokenService ITokenService

tokenRepo ITokenRepo

Methods

ChangePassword(ApiUser, String, String)

Changes the password of a user.

public Task ChangePassword(ApiUser user, string currentPassword, string newPassword)

Parameters

user ApiUser

The Object of the user.

currentPassword String

The current password of the user.

newPassword String

The new password to set.

Returns

A task that represents the asynchronous operation. The task result contains a message
indicating the result of the password change.

Exceptions

Exception

Thrown when the password change fails.

ChangeUser(ApiUser)

Changes the username of a user.

public Task ChangeUser(ApiUser user)

Parameters

user ApiUser

The User Object of the user.

Returns

A task that represents the asynchronous operation. The task result contains a message
indicating the result of the username change.

Exceptions

Exception

Thrown when the username change fails.

DeleteUser(ApiUser)

public Task<Boolean> DeleteUser(ApiUser user)

Parameters

user ApiUser

Returns

Task<Boolean>

GetUserById(String)

public Task<ApiUser> GetUserById(string userId)

Parameters

userId String

Returns

Task<ApiUser>

GetUserInformations()

public Task<List<ApiUser>> GetUserInformations()

Returns

Task<List<ApiUser>>

Login(Login)

public Task<JwtToken> Login(Login input)

Parameters

input Login

Returns

Task<JwtToken>

RefreshToken(JwtToken)

public Task<JwtToken> RefreshToken(JwtToken tokenModel)

Parameters

tokenModel JwtToken

Returns

Task<JwtToken>

Register(Register)

public Task Register(Register input)

Parameters

input Register

Returns

Task