View Source
Class AuthenticationExtensions
Extensions to create and renew and remove authentication tickets for the Umbraco back office
Inheritance
System.Object
Assembly: Umbraco.Web.dll
Syntax
public static class AuthenticationExtensions
Methods
View Source
AuthenticateCurrentRequest(HttpContextBase, AuthenticationTicket, Boolean)
This will check the ticket to see if it is valid, if it is it will set the current thread's user and culture
Declaration
public static bool AuthenticateCurrentRequest(this HttpContextBase http, AuthenticationTicket ticket, bool renewTicket)
Parameters
Type |
Name |
Description |
System.Web.HttpContextBase |
http |
|
AuthenticationTicket |
ticket |
|
System.Boolean |
renewTicket |
If true will attempt to renew the ticket
|
Returns
Type |
Description |
System.Boolean |
|
View Source
GetCurrentIdentity(HttpContextBase, Boolean)
This will return the current back office identity.
Declaration
public static UmbracoBackOfficeIdentity GetCurrentIdentity(this HttpContextBase http, bool authenticateRequestIfNotFound)
Parameters
Type |
Name |
Description |
System.Web.HttpContextBase |
http |
|
System.Boolean |
authenticateRequestIfNotFound |
If set to true and a back office identity is not found and not authenticated, this will attempt to authenticate the
request just as is done in the Umbraco module and then set the current identity if it is valid.
Just like in the UmbracoModule, if this is true then the user's culture will be assigned to the request.
|
Returns
Type |
Description |
UmbracoBackOfficeIdentity |
Returns the current back office identity if an admin is authenticated otherwise null
|
View Source
GetRemainingAuthSeconds(AuthenticationTicket)
returns the number of seconds the user has until their auth session times out
Declaration
public static double GetRemainingAuthSeconds(this AuthenticationTicket ticket)
Parameters
Type |
Name |
Description |
AuthenticationTicket |
ticket |
|
Returns
Type |
Description |
System.Double |
|
View Source
GetRemainingAuthSeconds(HttpContextBase)
returns the number of seconds the user has until their auth session times out
Declaration
public static double GetRemainingAuthSeconds(this HttpContextBase http)
Parameters
Type |
Name |
Description |
System.Web.HttpContextBase |
http |
|
Returns
Type |
Description |
System.Double |
|
View Source
GetUmbracoAuthTicket(IOwinContext)
Declaration
public static AuthenticationTicket GetUmbracoAuthTicket(this IOwinContext ctx)
Parameters
Type |
Name |
Description |
IOwinContext |
ctx |
|
Returns
Type |
Description |
AuthenticationTicket |
|
View Source
GetUmbracoAuthTicket(HttpContextBase)
Gets the umbraco auth ticket
Declaration
public static AuthenticationTicket GetUmbracoAuthTicket(this HttpContextBase http)
Parameters
Type |
Name |
Description |
System.Web.HttpContextBase |
http |
|
Returns
Type |
Description |
AuthenticationTicket |
|
View Source
RenewUmbracoAuthTicket(HttpContextBase)
This will force ticket renewal in the OWIN pipeline
Declaration
public static bool RenewUmbracoAuthTicket(this HttpContextBase http)
Parameters
Type |
Name |
Description |
System.Web.HttpContextBase |
http |
|
Returns
Type |
Description |
System.Boolean |
|
View Source
UmbracoLogout(HttpContextBase)
Declaration
public static void UmbracoLogout(this HttpContextBase http)
Parameters
Type |
Name |
Description |
System.Web.HttpContextBase |
http |
|