Search Results for

    Show / Hide Table of Contents

    Interface ITokenService

    Interface for managing registration tokens in the system

    Namespace: OEMS.Core.Application.ApplicationServiceInterfaces
    Assembly: OEMS.Core.dll
    Syntax
    public interface ITokenService

    Methods

    CleanupExpiredTokensAsync()

    Cleans up expired tokens from the database

    Declaration
    Task<int> CleanupExpiredTokensAsync()
    Returns
    Type Description
    Task<int>

    The number of tokens cleaned up

    GenerateTokenAsync(Guid, Guid, TokenType, int)

    Generates a secure token for user registration

    Declaration
    Task<string> GenerateTokenAsync(Guid userId, Guid organizationId, TokenType tokenType, int expiryDays = 7)
    Parameters
    Type Name Description
    Guid userId

    The ID of the user the token is for

    Guid organizationId

    The ID of the organization the token is for

    TokenType tokenType

    The type of token to generate

    int expiryDays

    Number of days until the token expires (default: 7)

    Returns
    Type Description
    Task<string>

    The generated token string

    InvalidateTokenAsync(string)

    Invalidates a specific token

    Declaration
    Task<bool> InvalidateTokenAsync(string token)
    Parameters
    Type Name Description
    string token

    The token string to invalidate

    Returns
    Type Description
    Task<bool>

    True if successful, false otherwise

    InvalidateUserTokensAsync(Guid)

    Invalidates all tokens for a user

    Declaration
    Task<bool> InvalidateUserTokensAsync(Guid userId)
    Parameters
    Type Name Description
    Guid userId

    The user ID to invalidate tokens for

    Returns
    Type Description
    Task<bool>

    True if successful, false otherwise

    MarkTokenAsUsedAsync(string)

    Marks a token as used

    Declaration
    Task<bool> MarkTokenAsUsedAsync(string token)
    Parameters
    Type Name Description
    string token

    The token string to mark as used

    Returns
    Type Description
    Task<bool>

    True if successful, false otherwise

    ValidateTokenAsync(string)

    Validates a registration token

    Declaration
    Task<(bool isValid, Guid userId, Guid organizationId, string email)> ValidateTokenAsync(string token)
    Parameters
    Type Name Description
    string token

    The token to validate

    Returns
    Type Description
    Task<(bool isValid, Guid userId, Guid organizationId, string email)>

    Tuple containing: (isValid, userId, organizationId, email)

    In this article
    Back to top Generated by DocFX