Class CqrsApiController
A System.Web.Http.ApiController that expects the Token to be sent as a System.Net.Http.Headers.HttpHeaders with a key whose name is defined by the System.Configuration.ConfigurationManager.AppSettings "Cqrs.Web.AuthenticationTokenName", in accordance with OAuth specifications
Inheritance
System.Object
System.Web.Http.ApiController
CqrsApiController
Inherited Members
System.Web.Http.ApiController.ExecuteAsync(System.Web.Http.Controllers.HttpControllerContext, System.Threading.CancellationToken)
System.Web.Http.ApiController.Validate<TEntity>(TEntity)
System.Web.Http.ApiController.Validate<TEntity>(TEntity, System.String)
System.Web.Http.ApiController.BadRequest()
System.Web.Http.ApiController.BadRequest(System.String)
System.Web.Http.ApiController.BadRequest(System.Web.Http.ModelBinding.ModelStateDictionary)
System.Web.Http.ApiController.Conflict()
System.Web.Http.ApiController.Content<T>(System.Net.HttpStatusCode, T)
System.Web.Http.ApiController.Content<T>(System.Net.HttpStatusCode, T, System.Net.Http.Formatting.MediaTypeFormatter)
System.Web.Http.ApiController.Content<T>(System.Net.HttpStatusCode, T, System.Net.Http.Formatting.MediaTypeFormatter, System.String)
System.Web.Http.ApiController.Content<T>(System.Net.HttpStatusCode, T, System.Net.Http.Formatting.MediaTypeFormatter, System.Net.Http.Headers.MediaTypeHeaderValue)
System.Web.Http.ApiController.Created<T>(System.String, T)
System.Web.Http.ApiController.Created<T>(System.Uri, T)
System.Web.Http.ApiController.CreatedAtRoute<T>(System.String, System.Object, T)
System.Web.Http.ApiController.CreatedAtRoute<T>(System.String, System.Collections.Generic.IDictionary<System.String, System.Object>, T)
System.Web.Http.ApiController.InternalServerError()
System.Web.Http.ApiController.InternalServerError(System.Exception)
System.Web.Http.ApiController.Json<T>(T)
System.Web.Http.ApiController.Json<T>(T, Newtonsoft.Json.JsonSerializerSettings)
System.Web.Http.ApiController.Json<T>(T, Newtonsoft.Json.JsonSerializerSettings, System.Text.Encoding)
System.Web.Http.ApiController.NotFound()
System.Web.Http.ApiController.Ok()
System.Web.Http.ApiController.Ok<T>(T)
System.Web.Http.ApiController.Redirect(System.String)
System.Web.Http.ApiController.Redirect(System.Uri)
System.Web.Http.ApiController.RedirectToRoute(System.String, System.Object)
System.Web.Http.ApiController.RedirectToRoute(System.String, System.Collections.Generic.IDictionary<System.String, System.Object>)
System.Web.Http.ApiController.ResponseMessage(System.Net.Http.HttpResponseMessage)
System.Web.Http.ApiController.StatusCode(System.Net.HttpStatusCode)
System.Web.Http.ApiController.Unauthorized(System.Net.Http.Headers.AuthenticationHeaderValue[])
System.Web.Http.ApiController.Unauthorized(System.Collections.Generic.IEnumerable<System.Net.Http.Headers.AuthenticationHeaderValue>)
System.Web.Http.ApiController.Initialize(System.Web.Http.Controllers.HttpControllerContext)
System.Web.Http.ApiController.Dispose()
System.Web.Http.ApiController.Dispose(System.Boolean)
System.Web.Http.ApiController.Configuration
System.Web.Http.ApiController.ControllerContext
System.Web.Http.ApiController.ActionContext
System.Web.Http.ApiController.ModelState
System.Web.Http.ApiController.Request
System.Web.Http.ApiController.RequestContext
System.Web.Http.ApiController.Url
System.Web.Http.ApiController.User
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Assembly: Cqrs.WebApi.dll
Syntax
public abstract class CqrsApiController : ApiController, IHttpController, IDisposable
Constructors
CqrsApiController(ILogger, ICorrelationIdHelper, IConfigurationManager)
Declaration
protected CqrsApiController(ILogger logger, ICorrelationIdHelper correlationIdHelper, IConfigurationManager configurationManager)
Parameters
Type |
Name |
Description |
cdmdotnet.Logging.ILogger |
logger |
|
cdmdotnet.Logging.ICorrelationIdHelper |
correlationIdHelper |
|
IConfigurationManager |
configurationManager |
|
Properties
ConfigurationManager
Declaration
protected IConfigurationManager ConfigurationManager { get; }
Property Value
CorrelationIdHelper
Gets or set the cdmdotnet.Logging.ICorrelationIdHelper.
Declaration
protected ICorrelationIdHelper CorrelationIdHelper { get; }
Property Value
Type |
Description |
cdmdotnet.Logging.ICorrelationIdHelper |
|
Logger
Gets or set the cdmdotnet.Logging.ILogger.
Declaration
protected ILogger Logger { get; }
Property Value
Type |
Description |
cdmdotnet.Logging.ILogger |
|
Methods
CompleteResponse<TServiceResponse>(TServiceResponse)
Creates a new System.Net.Http.HttpResponseMessage and completes the response by setting the appropriate System.Net.Http.HttpResponseMessage.StatusCode and populating System.Net.Http.HttpResponseMessage.Content with serviceResponse
.
Declaration
protected virtual HttpResponseMessage CompleteResponse<TServiceResponse>(TServiceResponse serviceResponse)where TServiceResponse : IServiceResponse
Parameters
Type |
Name |
Description |
TServiceResponse |
serviceResponse |
|
Returns
Type |
Description |
System.Net.Http.HttpResponseMessage |
|
Type Parameters
Name |
Description |
TServiceResponse |
|
CompleteResponse<TServiceResponse>(HttpResponseMessage, TServiceResponse)
Completes the provided response
by setting the appropriate System.Net.Http.HttpResponseMessage.StatusCode and populating System.Net.Http.HttpResponseMessage.Content with serviceResponse
.
Declaration
protected virtual HttpResponseMessage CompleteResponse<TServiceResponse>(HttpResponseMessage response, TServiceResponse serviceResponse)where TServiceResponse : IServiceResponse
Parameters
Type |
Name |
Description |
System.Net.Http.HttpResponseMessage |
response |
|
TServiceResponse |
serviceResponse |
|
Returns
Type |
Description |
System.Net.Http.HttpResponseMessage |
|
Type Parameters
Name |
Description |
TServiceResponse |
|
CompleteResponseWithData<TServiceResponse>(TServiceResponse)
Creates a new System.Net.Http.HttpResponseMessage and completes the response by setting the appropriate System.Net.Http.HttpResponseMessage.StatusCode and populating System.Net.Http.HttpResponseMessage.Content with serviceResponse
.
Declaration
protected virtual HttpResponseMessage<TServiceResponse> CompleteResponseWithData<TServiceResponse>(TServiceResponse serviceResponse)where TServiceResponse : IServiceResponse
Parameters
Type |
Name |
Description |
TServiceResponse |
serviceResponse |
|
Returns
Type Parameters
Name |
Description |
TServiceResponse |
|
CreateAuthenticationToken<TSingleSignOnToken>()
Create an TSingleSignOnToken
.
Declaration
protected virtual TSingleSignOnToken CreateAuthenticationToken<TSingleSignOnToken>()where TSingleSignOnToken : ISingleSignOnToken, new ()
Returns
Type |
Description |
TSingleSignOnToken |
|
Type Parameters
CreateParameter<TParameters>()
Creates a blank TParameters
Declaration
protected virtual TParameters CreateParameter<TParameters>()where TParameters : new ()
Returns
Type |
Description |
TParameters |
|
Type Parameters
Name |
Description |
TParameters |
|
CreateRequest<TSingleSignOnToken>()
Declaration
protected virtual IServiceRequest<TSingleSignOnToken> CreateRequest<TSingleSignOnToken>()where TSingleSignOnToken : ISingleSignOnToken, new ()
Returns
Type Parameters
Name |
Description |
TSingleSignOnToken |
|
CreateRequestWithData<TSingleSignOnToken, TParameters>(Func<TParameters>)
Declaration
protected virtual IServiceRequestWithData<TSingleSignOnToken, TParameters> CreateRequestWithData<TSingleSignOnToken, TParameters>(Func<TParameters> createParameterDelegate = null)where TSingleSignOnToken : ISingleSignOnToken, new ()where TParameters : new ()
Parameters
Type |
Name |
Description |
System.Func<TParameters> |
createParameterDelegate |
|
Returns
Type Parameters
Name |
Description |
TSingleSignOnToken |
|
TParameters |
|
GetDateTokenIssued()
Get the System.DateTime the current authentication token was issued.
Declaration
protected virtual DateTime GetDateTokenIssued()
Returns
Type |
Description |
System.DateTime |
default(DateTime)
|
GetToken()
Extracts the authentication token looking for a System.Collections.Generic.KeyValuePair<TKey, TValue> where the key as defined by the System.Configuration.ConfigurationManager.AppSettings "Cqrs.Web.AuthenticationTokenName",
from the System.Web.HttpRequest.Headers, if one isn't found we then try the System.Web.HttpRequest.Cookies
Declaration
protected virtual string GetToken()
Returns
Type |
Description |
System.String |
|
GetTokenTimeOfExpiry()
Get the System.DateTime the current authentication token will expire.
Declaration
protected virtual DateTime GetTokenTimeOfExpiry()
Returns
Type |
Description |
System.DateTime |
default(DateTime)
|