Show / Hide Table of Contents

Class ClaimsIdentityBuilder

Builder to construct a new ClaimsIdentity

Inheritance
object
ClaimsIdentityBuilder
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOffice.Security.Claims
Assembly: SuperOffice.Plugins.dll
Syntax
public class ClaimsIdentityBuilder

Constructors

ClaimsIdentityBuilder(IEnumerable<Claim>, string)

Create a new builder based on an existing list of claims and an authentication type

Declaration
public ClaimsIdentityBuilder(IEnumerable<Claim> claims, string authenticationType = null)
Parameters
Type Name Description
IEnumerable<Claim> claims
string authenticationType
Remarks

An authentication type is required for the resulting Claims Identity to be IsAuthenticated.

ClaimsIdentityBuilder(ClaimsIdentity)

Create new builder based on an existing identity

Declaration
public ClaimsIdentityBuilder(ClaimsIdentity identity)
Parameters
Type Name Description
ClaimsIdentity identity

ClaimsIdentityBuilder(string)

Create a new builder with a provided authentication type

Declaration
public ClaimsIdentityBuilder(string authenticationType = null)
Parameters
Type Name Description
string authenticationType
Remarks

An authentication type is required for the resulting Claims Identity to be IsAuthenticated.

Properties

AuthenticationType

Builder to construct a new ClaimsIdentity

Declaration
public string AuthenticationType { get; }
Property Value
Type Description
string

Claims

List of currently held claims

Declaration
public IEnumerable<Claim> Claims { get; }
Property Value
Type Description
IEnumerable<Claim>

Methods

AddClaim(Claim)

Add claim to the list of claims

Declaration
public ClaimsIdentityBuilder AddClaim(Claim claim)
Parameters
Type Name Description
Claim claim
Returns
Type Description
ClaimsIdentityBuilder

AddClaim(string, DateTime)

Add a claim of type DateTime to the list of claims.

Declaration
public ClaimsIdentityBuilder AddClaim(string type, DateTime value)
Parameters
Type Name Description
string type
DateTime value
Returns
Type Description
ClaimsIdentityBuilder

AddClaim(string, int)

Add an integer claim with value type Integer32 to the list of claims

Declaration
public ClaimsIdentityBuilder AddClaim(string type, int value)
Parameters
Type Name Description
string type
int value
Returns
Type Description
ClaimsIdentityBuilder

AddClaim(string, long)

Add a claim of type Integer64 to the list of claims

Declaration
public ClaimsIdentityBuilder AddClaim(string type, long value)
Parameters
Type Name Description
string type
long value
Returns
Type Description
ClaimsIdentityBuilder

AddClaim(string, string)

Add a claim with type and value of string to list of claims

Declaration
public ClaimsIdentityBuilder AddClaim(string type, string value)
Parameters
Type Name Description
string type
string value
Returns
Type Description
ClaimsIdentityBuilder

AddClaims(IEnumerable<Claim>)

Add multiple claims to the list of claims.

Declaration
public ClaimsIdentityBuilder AddClaims(IEnumerable<Claim> claims)
Parameters
Type Name Description
IEnumerable<Claim> claims
Returns
Type Description
ClaimsIdentityBuilder

AddClaims(params Claim[])

Add multiple claims to the list of claims.

Declaration
public ClaimsIdentityBuilder AddClaims(params Claim[] claims)
Parameters
Type Name Description
Claim[] claims
Returns
Type Description
ClaimsIdentityBuilder

Build()

Construct a new ClaimsIdentity with the current list of claims and authentication type as provided in the constructor.

Declaration
public ClaimsIdentity Build()
Returns
Type Description
ClaimsIdentity
Remarks

Duplicate claims with same type and values will be removed. If ClaimsIdentityBuilder was constructed using a ClaimsIdentity, the authentication type will be inherited from the original identity.

GetClaimValues(string)

Get all values of claim with the provided type

Declaration
public IEnumerable<string> GetClaimValues(string claimType)
Parameters
Type Name Description
string claimType
Returns
Type Description
IEnumerable<string>

RemoveClaim(Claim)

Remove a particular instance of a claim from the list of claims.

Declaration
public ClaimsIdentityBuilder RemoveClaim(Claim claim)
Parameters
Type Name Description
Claim claim
Returns
Type Description
ClaimsIdentityBuilder

RemoveClaims(string)

Remove all claims of the provided type from the list of claims

Declaration
public ClaimsIdentityBuilder RemoveClaims(string type)
Parameters
Type Name Description
string type
Returns
Type Description
ClaimsIdentityBuilder

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top