Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix token based session creation via certificate #29

Closed
DadsVacayShorts opened this issue Sep 15, 2021 · 1 comment
Closed

Fix token based session creation via certificate #29

DadsVacayShorts opened this issue Sep 15, 2021 · 1 comment

Comments

@DadsVacayShorts
Copy link

Environment

Operating System: WS 2019
VenafiTppPS version:3.1.6
PowerShell version:5.1

Steps to reproduce

CurrentUserCert = (Get-ChildItem -Path Cert:\currentuser\My | ?{ $_.Issuer -Like "*$IssuerDN*" -and $_.Subject -Like "*$env:username*" })[-1]
New-VenafiSession -Server $vtp_host -Certificate $CurrentUserCert  -ClientId $client_ID -Scope @{'certificate'='manage'}

Expected behavior

New Oauth session gets produced with certificate authentication using x509Certificate2 class certificate objects, i.e. a cert that comes from the user store .

PS C:\Users\tppadmin1> $CurrentUserCert.gettype()
IsPublic IsSerial Name                                     BaseType                                                                                                                              
-------- -------- ----                                     --------                                                                                                                              
True     True     X509Certificate2                         System.Security.Cryptography.X509Certificates.X509Certificate 

Actual behavior

Script produces this error

New-VenafiSession : Parameter set cannot be resolved using the specified named parameters.
At C:\Users\tppadmin1\Documents\scripts\VenafiPSExample.ps1:38 char:1
+ New-VenafiSession -Server $vtp_host -Certificate $CurrentUserCert -Pa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [New-VenafiSession], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,New-VenafiSession

Screenshots

@gdbarron gdbarron changed the title new-Venafisession doesnt work with x509Certificate2 class certificate objects Fix token based session creation via certificate Sep 17, 2021
@gdbarron
Copy link
Collaborator

There were a few issues which needed to be fixed, not just the param set. Released with v3.1.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants