DPSinfraDocument
1 min

Attributes

Các phương thức hỗ trợ của thư viện
Namespace: DPSinfra.AttributeCommon

OTP Attributes

Sử dụng attribute:

Giá trị secret_key được lấy từ Vault.

 Secret<SecretData> otpSecret = vaultClient.V1.Secrets.KeyValue.V2.ReadSecretAsync(path: "otp", mountPoint: "kv").Result;
 IDictionary<string, object> otpoData = otpSecret.Data.Data;
 Configuration["AppConfig:otpSecret"] = otpoData["secret_key"].ToString();

Cach dung attribute trong api

    [HttpGet]
    [Route("test")]
    [OTP]
    public object test()
    {
        return Ok("ok");
    }

Api truyen header "X-OTP" de attribute verify code, code nay co the generate tu cac thu vien sau

  • .NET: Otp.NET,..
  • Angular: totp-generator,..
  • React Native: react-native-otp-code-generator,,,