rajanadar / VaultSharp

A comprehensive cross-platform .NET Library for HashiCorp's Vault, a secret management tool

Home Page:http://rajanadar.github.io/VaultSharp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VaultSharp.V1.SecretsEngines.OpenLDAP.StaticCredentials.RotationPeriod' is not compatible with the type 'System.Int32'

tisonv opened this issue · comments

Describe the bug
When requesting a static crendentials, VaultSharp fails to convert the rotation period

VaultSharp Version
1.13.0.1

Vault Version
1.15.4

Does this work with Vault CLI?
Yes

Sample Code Snippet

IVaultClient vaultClient = GetVaultClient(uri, token);
Secret<StaticCredentials> adCreds = vaultClient.V1.Secrets.OpenLDAP.GetStaticCredentialsAsync(role, mount).Result;

Exception Details/Stack Trace/Error Message

One or more errors occurred. (The converter specified on 'VaultSharp.V1.SecretsEngines.OpenLDAP.StaticCredentials.RotationPeriod' is not compatible with the type 'System.Int32'.)
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at Vault.Ldap.GetCredentials(Uri uri, String token, String role, String mount) in D:\Vault\Ldap.cs:line 20
at Vault.FunctionalTests.LdapTest.ShouldGetCredentials() in D:\Vault\FunctionalTests\LdapTest.cs:line 16
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

Any additional info
I reverted #312 locally by removing [JsonConverter(typeof(IntegerToStringJsonConverter))] from the RotationPeriod variable in \VaultSharp\V1\SecretsEngines\OpenLDAP\StaticCredentials.cs and the error is no more

Edited sample data :

{
    "request_id": "9a0a6d6a-dfe9-1011-b992-326698f5634e",
    "lease_id": "",
    "renewable": false,
    "lease_duration": 0,
    "data": {
        "dn": "CN=XXXXX,OU=XXXXX,DC=XXXXX,DC=XXXXX",
        "last_password": "6d42u1yUFNDeh8MbNHUeepJ!E79ld#Dy@q#S@l8*e1uDXvs1vAEE4zE9bLfezjLQ",
        "last_vault_rotation": "2023-12-15T09:09:28.9175391+01:00",
        "password": "B^fC6A7GST12QI0gK2nOVroZ36etZB0$EOZSdUPQpRddb6uA%b4JM!^N9XMGx1mF",
        "rotation_period": 82800,
        "ttl": 80782,
        "username": "XXXXX"
    },
    "wrap_info": null,
    "warnings": null,
    "auth": null
}