IOT Dash
Public Member Functions | Package Attributes | List of all members
IotDash.Services.Implementations.IdentityService Class Reference
Inheritance diagram for IotDash.Services.Implementations.IdentityService:
Inheritance graph
[legend]
Collaboration diagram for IotDash.Services.Implementations.IdentityService:
Collaboration graph
[legend]

Public Member Functions

 IdentityService (IUserStore users, JwtSettings jwtSettings, TokenValidationParameters tokenValidationParameters, DataContext dataContext)
 
async Task< AuthResponseLoginAsync (string username, string password)
 
async Task< AuthResponseRefreshTokenAsync (string token, string refreshToken)
 
async Task< AuthResponseRegisterAsync (string name, string password)
 
async Task< int > CleanupRefreshTokens ()
 
async Task< IdentityUser?> GetUserByIdAsync (Guid userId)
 
async Task< IdentityUser?> GetUserByNameAsync (string name)
 
Task< AuthResponseRegisterAsync (string username, string password)
 
Task< AuthResponseLoginAsync (string username, string password)
 
Task< AuthResponseRefreshTokenAsync (string token, string refreshToken)
 
Task< int > CleanupRefreshTokens ()
 

Package Attributes

readonly JwtSettings jwtSettings
 

Member Function Documentation

◆ CleanupRefreshTokens()

async Task< int > IotDash.Services.Implementations.IdentityService.CleanupRefreshTokens ( )
inline

Delete expired or revoked refresh tokens from the database.

Returns
Number of deleted tokens.

Implements IotDash.Services.IIdentityService.

◆ LoginAsync()

async Task< AuthResponse > IotDash.Services.Implementations.IdentityService.LoginAsync ( string  username,
string  password 
)
inline

Authenticate a user.

Parameters
usernameUsername of the user.
passwordPassword of the user.
Returns
Result of the authentication.

Implements IotDash.Services.IIdentityService.

◆ RefreshTokenAsync()

async Task< AuthResponse > IotDash.Services.Implementations.IdentityService.RefreshTokenAsync ( string  token,
string  refreshToken 
)
inline

Authenticate a user from a valid refresh token.

Parameters
tokenAn expired JWT token of the user.
refreshTokenA valid refresh token belonging to the user.
Returns
Result of the authentication.

Implements IotDash.Services.IIdentityService.

◆ RegisterAsync()

async Task< AuthResponse > IotDash.Services.Implementations.IdentityService.RegisterAsync ( string  username,
string  password 
)
inline

Register new user account, and authenticate the user immediately.

Parameters
usernameUsername of the new user.
passwordPassword of the new user.
Returns
Result of the authentication.

Implements IotDash.Services.IIdentityService.


The documentation for this class was generated from the following file: