Update Authorization.md

pull/11170/head
maliming 4 years ago committed by GitHub
parent 83875af735
commit f3e25dc756
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -428,7 +428,7 @@ This is already done for the startup template integration tests.
Claims are important elements of authentication and authorization. ABP uses the `IAbpClaimsPrincipalFactory` service to create claims on authentication. This service was designed as extensible. If you need to add your custom claims to the authentication ticket, you can implement the `IAbpClaimsPrincipalContributor` in your application.
**Example: Add a `SocialSecurityNumber` claim:**
**Example: Add a `SocialSecurityNumber` claim and get it:**
```csharp
public class SocialSecurityNumberClaimsPrincipalContributor : IAbpClaimsPrincipalContributor, ITransientDependency
@ -448,6 +448,15 @@ public class SocialSecurityNumberClaimsPrincipalContributor : IAbpClaimsPrincipa
}
}
}
public static class CurrentUserExtensions
{
public static stromg GetSocialSecurityNumber(ICurrentUser currentUser)
{
return currentUser.FindClaimValue("SocialSecurityNumber");
}
}
```
## See Also

Loading…
Cancel
Save