Search Results for

    Show / Hide Table of Contents

    Class OriginValidationBehaviour<TMessage>

    Validates the origin of an incoming message by checking a configurable header against the AllowedOriginAttribute applied on the message type. This behavior is automatically registered when AddChaparPipeline is called.

    Inheritance
    object
    OriginValidationBehaviour<TMessage>
    Implements
    IPipelineBehavior<TMessage>
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Chapar.Pipeline.Behaviours
    Assembly: Chapar.Pipeline.dll
    Syntax
    public sealed class OriginValidationBehaviour<TMessage> : IPipelineBehavior<TMessage> where TMessage : IMessage
    Type Parameters
    Name Description
    TMessage

    The type of the message being handled.

    Constructors

    | Edit this page View Source

    OriginValidationBehaviour(ILogger<OriginValidationBehaviour<TMessage>>, IMessageContextAccessor?, string)

    Initializes a new instance of the OriginValidationBehaviour<TMessage> class.

    Declaration
    public OriginValidationBehaviour(ILogger<OriginValidationBehaviour<TMessage>> logger, IMessageContextAccessor? contextAccessor = null, string headerName = "Origin")
    Parameters
    Type Name Description
    ILogger<OriginValidationBehaviour<TMessage>> logger

    The logger instance.

    IMessageContextAccessor contextAccessor

    An optional accessor to read message headers.

    string headerName

    The header key to check for origin. Default is "Origin".

    Methods

    | Edit this page View Source

    HandleAsync(TMessage, Func<Task>, CancellationToken)

    Executes the behaviour and optionally calls the next delegate in the pipeline.

    Declaration
    public Task HandleAsync(TMessage message, Func<Task> next, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    TMessage message

    The message to process.

    Func<Task> next

    A delegate representing the next action in the pipeline.

    CancellationToken cancellationToken

    Token to cancel the operation.

    Returns
    Type Description
    Task

    Implements

    IPipelineBehavior<TMessage>
    • Edit this page
    • View Source
    In this article
    Back to top Copyright © 2026