Product: PowerShell Universal
Version: 1.4.6
I can see $User
. However, I cannot see $UserInfo
. Using an OIDC app for the PSU app.
Any ideas what I am missing?
Product: PowerShell Universal
Version: 1.4.6
I can see $User
. However, I cannot see $UserInfo
. Using an OIDC app for the PSU app.
Any ideas what I am missing?
to be more specific
Does anyone know how to get the rest of the data from a user’s token (OIDC)?
The variables provided are $user
and $userinfo
:
$user
# Only provides the UPN (if using B2B, the UPN only of the home-realm).
$userinfo
# I cannot seem to get any data from this.
I can see all the information I need to get to. I am a bit lost how to get to this information via code
These are coming from the claims property of the of the $User object in roles.ps1. The object structure is defined here:
You can check for claims by using something like this:
$User.HasClaim(''vti", "some value") #returns $true or $false
# You can also return iterate claims like this
$VtiClaims = $User.Claims | Where-Object Type -eq 'vti'
Thanks Adam. Since we wanted the value outside of the roles.ps1
we used this.
$Session:ID = ($ClaimsPrincipal.Claims | Where-Object {
$_.Type -eq 'http://schemas.microsoft.com/identity/claims/objectidentifier'
}).value