Skip to content
This repository has been archived by the owner on Nov 19, 2017. It is now read-only.

Custom Claims Principal #3

Open
RafaelMontegordoFelix opened this issue Oct 23, 2017 · 0 comments
Open

Custom Claims Principal #3

RafaelMontegordoFelix opened this issue Oct 23, 2017 · 0 comments

Comments

@RafaelMontegordoFelix
Copy link

RafaelMontegordoFelix commented Oct 23, 2017

Hi there,
I'm using claims transformation, to inject a CustomClaimsIdentity, that uses other properties than claims.

public CustomPrincipal(ClaimsPrincipal principal, Custom type, long userId) : this (principal)
{
RuleType = type;
UserId = userId;
}

public bool Method(List ids)
{
throw new NotImplementedException();
}

My problem is that when i get the user, i was getting a ClaimsPrincipal, that was not my Custom.
This is because you always create a new ClaimsPrincipal

{
var transformedPrincipal = await _options.ClaimsTransformation(context.Authentication.User);
context.Authentication.User = new ClaimsPrincipal(transformedPrincipal);
}

Is this really necessary? Do you know any problem that can happens if the new was removed and set to the transformedPrincipal?

Thanks

@RafaelMontegordoFelix RafaelMontegordoFelix changed the title Custom Claims Identity Custom Claims Principal Oct 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant