Class FromClaimAttribute
properties decorated with this attribute will have their values auto bound from the relevant claim of the current user principal
Inherited Members
Namespace: FastEndpoints
Assembly: FastEndpoints.Attributes.dll
Syntax
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class FromClaimAttribute : Attribute
Constructors
FromClaimAttribute(Boolean, Boolean)
properties decorated with this attribute will have their values auto bound from the relevant claim of the current user principal
Declaration
public FromClaimAttribute(bool isRequired, bool removeFromSchema = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isRequired | set to false if a validation error shouldn't be thrown when the current user principal doesn't have a claim type matching the property name being bound to. |
System.Boolean | removeFromSchema | set to true if your header is not required but shouldn't be added to schema model. |
FromClaimAttribute(String, Boolean, Boolean)
properties decorated with this attribute will have their values auto bound from the relevant claim of the current user principal
Declaration
public FromClaimAttribute(string claimType = null, bool isRequired = true, bool removeFromSchema = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | claimType | optionally specify the claim type to bind from. if not specified, the claim type of the user principal must match the name of the property being bound to. |
System.Boolean | isRequired | set to false if a validation error shouldn't be thrown when the current user principal doesn't have the specified claim type |
System.Boolean | removeFromSchema | set to true if your header is not required but shouldn't be added to schema model. |
Properties
ClaimType
the claim type to auto bind
Declaration
public string ClaimType { get; set; }
Property Value
Type | Description |
---|---|
System.String |
IsRequired
set to true if a validation error should be thrown when the current user principal doesn't have the specified claim
Declaration
public bool IsRequired { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
RemoveFromSchema
set to true if your header is not required but shouldn't be added to schema model
Declaration
public bool RemoveFromSchema { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |