Class HttpRequestBuilderAuthenticationExtensions
Contains authentication extension methods for IHttpRequestBuilder.
Inheritance
System.Object
HttpRequestBuilderAuthenticationExtensions
Namespace:MyTested.AspNetCore.Mvc
Assembly:MyTested.AspNetCore.Mvc.Authentication.dll
Syntax
public static class HttpRequestBuilderAuthenticationExtensions
Methods
| Improve this Doc View SourceWithAuthenticatedUser(IHttpRequestBuilder)
Sets default authenticated Microsoft.AspNetCore.Http.HttpContext.User to the built request with "TestId" identifier and "TestUser" username.
Declaration
public static IAndHttpRequestBuilder WithAuthenticatedUser(this IHttpRequestBuilder httpRequestBuilder)
Parameters
Type | Name | Description |
---|---|---|
IHttpRequestBuilder | httpRequestBuilder | Instance of IHttpRequestBuilder type. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpRequestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpRequestBuilder. |
WithAuthenticatedUser(IHttpRequestBuilder, Action<IClaimsPrincipalBuilder>)
Sets custom authenticated Microsoft.AspNetCore.Http.HttpContext.User to the built request using the provided user builder.
Declaration
public static IAndHttpRequestBuilder WithAuthenticatedUser(this IHttpRequestBuilder httpRequestBuilder, Action<IClaimsPrincipalBuilder> userBuilder)
Parameters
Type | Name | Description |
---|---|---|
IHttpRequestBuilder | httpRequestBuilder | Instance of IHttpRequestBuilder type. |
System.Action<IClaimsPrincipalBuilder> | userBuilder | Action setting the Microsoft.AspNetCore.Http.HttpContext.User by using IClaimsPrincipalBuilder. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpRequestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpRequestBuilder. |