Class LoginHandler
- Namespace
- Dynamicweb.Frontend
- Assembly
- Dynamicweb.dll
This class contains functions to handle with security.
[Obsolete("Use LogOnHandler instead.")]
public sealed class LoginHandler
- Inheritance
-
LoginHandler
- Inherited Members
Constructors
LoginHandler()
public LoginHandler()
LoginHandler(int)
public LoginHandler(int pageId)
Parameters
pageIdint
Properties
PagePassword
Gets or sets the page password.
public string PagePassword { get; set; }
Property Value
PagePermissionTemplate
public string PagePermissionTemplate { get; set; }
Property Value
UserLoggedIn
Determines whether current user logged in.
public bool UserLoggedIn { get; }
Property Value
Username
Stores and retrieves extranet user access name value.
public static string Username { get; }
Property Value
Methods
ChangePassword(int, string, string, bool)
Changes the password of the specified user ID.
public static void ChangePassword(int userId, string oldPassword, string newPassword, bool encryptPassword)
Parameters
userIdint- The user identifier.
oldPasswordstring- The old password.
newPasswordstring- The new password.
encryptPasswordbool- if set to
true[encrypt password].
CheckPasswordComplexity(string, int, ref string, ref int, bool, bool)
Checks the password complexity.
public bool CheckPasswordComplexity(string password, int id, ref string errorMessage, ref int passwordErrorCode, bool forceReuseCheck, bool isBackendCheck)
Parameters
passwordstring- The password.
idint- The id.
errorMessagestring- The error message.
passwordErrorCodeint- The password error code.
forceReuseCheckbool- if set to
trueforce check of password reuse. isBackendCheckbool- if set to
trueforce chaeck by backend rules.
Returns
CheckSecureFolderAccess(string)
public bool CheckSecureFolderAccess(string path)
Parameters
pathstring
Returns
ConvertDefaultToUtf8Encoding(string)
public static string ConvertDefaultToUtf8Encoding(string value)
Parameters
valuestring
Returns
DefaultToUtf8Encoding(string)
Converts strings to UTF-8 that have been saved in cookies with characters above ASCII127. IE æøå or japanese strings would be geberish if not converted
[Obsolete("Use ConvertDefaultToUtf8Encoding instead.")]
public static string DefaultToUtf8Encoding(string strInput)
Parameters
strInputstring- The string to be converted (encoded with encoding.default)
Returns
- string
- Converted string in UTF-8 format
Remarks
Converts from System.Text.Encoding.Default() (usually Windows 1252) to System.Text.UTF8Encoding
ExtranetConfirmMessage()
public string ExtranetConfirmMessage()
Returns
ExtranetLogin(string, string)
Logs in a user to the frontend extranet module
[Obsolete("Use ExtranetLogOn instead")]
public void ExtranetLogin(string username, string password)
Parameters
ExtranetLogin(string, string, bool)
Logs in a user to the frontend extranet module
[Obsolete("Use ExtranetLogOn instead")]
public void ExtranetLogin(string username, string password, bool onlyActive)
Parameters
usernamestring- The username.
passwordstring- The password.
onlyActivebool- if set to
trueonly active users are logged in.
ExtranetLoginPrompt()
Runs promt extranet login.
[Obsolete("Use ExtranetLogOnPrompt instead")]
public string ExtranetLoginPrompt()
Returns
ExtranetLogoff()
Logs off the current extranet user.
public void ExtranetLogoff()
ExtranetLogoff(bool)
Logs off the current extranet user with or without a redirect.
public void ExtranetLogoff(bool redirect)
Parameters
redirectbool
Remarks
When false: Avoid redirect upon logoff and maintain all session variables (you may want to apply Session.Abondon() yourself). When true: works like the ordinary Logoff().
ExtranetLogOn(string, string)
Logs in a user to the frontend extranet module
public void ExtranetLogOn(string username, string password)
Parameters
ExtranetLogOn(string, string, bool)
Logs in a user to the frontend extranet module
public void ExtranetLogOn(string username, string password, bool onlyActive)
Parameters
usernamestring- The username.
passwordstring- The password.
onlyActivebool- if set to
trueonly active users are logged in.
ExtranetLogOnPrompt()
Runs promt extranet login.
public string ExtranetLogOnPrompt()
Returns
ExtranetStart(int)
Starts extranet procedure.
public string ExtranetStart(int pageId)
Parameters
pageIdint
Returns
- string
- Empty string.
ForgotPassword(User, bool, string, string)
[Obsolete("Use ForgotUserPassword instead.")]
public bool ForgotPassword(User user, bool genNewPwd = false, string newPwd = null, string emailTemplateFolder = "Extranet/")
Parameters
Returns
ForgotUserPassword(User, bool, string, string)
Starts "ForgotPassword" procedure, and sends email message to the user.
public bool ForgotUserPassword(User user, bool generateNewPassword = false, string newPassword = null, string emailTemplateFolder = "Extranet/")
Parameters
userUser- The user.
generateNewPasswordbool- if set to
falseold password will send to user is it possible. if set totrueandnewPasswordnot null\empty thennewPasswordwill used like password else generate new password. newPasswordstring- The new password.
emailTemplateFolderstring
Returns
GetAccessElementsForUser(string, string, string)
Returns elements which the specified user has access to.
public static string GetAccessElementsForUser(string permissionType, string userID, string userType)
Parameters
permissionTypestring- Name of the permission type.
userIDstring- The UserID. Can be a comma separated string with additional IDs.
userTypestring- The UserID If the user needs to be a specific usertype e.g. Extranetuser, Admin etc.
Returns
- string
- Returns a comma separated string.
GetChecksum()
Gets the installation checksum.
public static string GetChecksum()
Returns
GetImpersonationMode()
public static UserImpersonation GetImpersonationMode()
Returns
GetInheritedPassword(Page)
Gets the inherited password.
public static string GetInheritedPassword(Page page)
Parameters
pagePage- The page.
Returns
- string
- System.String.
GetInheritedPermission(Page)
Gets the inherited permission.
public static IEnumerable<string> GetInheritedPermission(Page page)
Parameters
pagePage- The page.
Returns
- IEnumerable<string>
- System.String.
GetInheritedPermissionTemplate(Page)
Gets the inherited permission.
public static string GetInheritedPermissionTemplate(Page page)
Parameters
pagePage- The page.
Returns
- string
- System.String.
GetInheritedProtect(Page)
Gets the inherited protect.
public static bool GetInheritedProtect(Page page)
Parameters
pagePage- The page.
Returns
- bool
trueif XXXX,falseotherwise.
GetLoginToken(string, string)
public static string GetLoginToken(string userName, string password)
Parameters
Returns
GetUserElementAccess(string, string, string)
[Obsolete("Use GetAccessElementsForUser instead.")]
public static string GetUserElementAccess(string strType, string UserID, string UserType)
Parameters
Returns
HasAccessToFile(string)
Determines whether the current file can be accessed.
[Obsolete("Use CheckFolderAccess instead")]
public bool HasAccessToFile(string filePath)
Parameters
filePathstring- Fully qualified path to file
Returns
- bool
- Boolean statment.
IsCurrentUserAllowed(Page)
Determines whether the current user have access to the specified page.
public static bool IsCurrentUserAllowed(Page page)
Parameters
pagePage- The page.
Returns
- bool
trueif current user have access to the specified page; otherwise,false.falseif page is null.falseif user is not logged in and page has permissions set.trueif user is not logged in and page has no permissions set.
Examples
If Security.IsCurrentUserAllowed(page) Then
'Current user have acccess
End If
IsPageProtect(Page)
Determins whether page is protected.
public bool IsPageProtect(Page page)
Parameters
pagePage
Returns
- bool
- Boolean statement.
LogInUsingExternalAuthentication(ExternalLoginResult)
[Obsolete("Use LogInUsingExternalAuthentication instead.")]
public void LogInUsingExternalAuthentication(ExternalLoginResult loginResult)
Parameters
loginResultExternalLoginResult
LogInUsingExternalAuthentication(ExternalLoginResult, bool)
[Obsolete("Use LogInUsingExternalAuthentication instead.")]
public void LogInUsingExternalAuthentication(ExternalLoginResult loginResult, bool isADLogin)
Parameters
loginResultExternalLoginResultisADLoginbool
LogInUsingExternalAuthentication(ExternalLoginResult, bool, int)
[Obsolete("Use LogInUsingExternalAuthentication instead.")]
public void LogInUsingExternalAuthentication(ExternalLoginResult loginResult, bool isADLogin, int pageid)
Parameters
loginResultExternalLoginResultisADLoginboolpageidint
Logoff()
Logs off the current extranet user.
public static void Logoff()
Remarks
Call /Admin/Public/ExtranetLogoff.aspx?ID=123 to logoff users with a link and return them to page with ID.
Logoff(bool)
Extranet logoff.
public static void Logoff(bool redirect)
Parameters
redirectbool
Remarks
With Redirect set to False there will be no redirect and all session settings are kept after logoff. Set to True it works like ordinary Logoff()
LogOnWithExternalAuthentication(ExternalLoginResult)
Grant access with external account
public void LogOnWithExternalAuthentication(ExternalLoginResult loginResult)
Parameters
loginResultExternalLoginResult- The result of external authentication
LogOnWithExternalAuthentication(ExternalLoginResult, bool)
Grant access with external account
public void LogOnWithExternalAuthentication(ExternalLoginResult loginResult, bool isADLogin)
Parameters
loginResultExternalLoginResult- The result of external authentication
isADLoginbool- True if login is from Active Directory, otherwise False.
LogOnWithExternalAuthentication(ExternalLoginResult, bool, int)
Grant access with external account
public void LogOnWithExternalAuthentication(ExternalLoginResult logOnResult, bool isADLogin, int pageId)
Parameters
logOnResultExternalLoginResult- The result of external authentication
isADLoginbool- True if login is from Active Directory, otherwise False.
pageIdint- The page where the login is performed
SaveCookie()
Saves cookie.
public void SaveCookie()
SaveExtranetUserInputPassword(string)
public static void SaveExtranetUserInputPassword(string password)
Parameters
passwordstring
SendForgotPasswordEmail(string, string, string, bool, string, string, Dictionary<string, string>)
[Obsolete("Use SendForgottenPasswordEmail instead.")]
public static bool SendForgotPasswordEmail(string userEmail, string userName, string password, bool isNewPwd, string recoveryUrl, string emailTemplateFolder, Dictionary<string, string> emailTagVals = null)
Parameters
userEmailstringuserNamestringpasswordstringisNewPwdboolrecoveryUrlstringemailTemplateFolderstringemailTagValsDictionary<string, string>
Returns
SendForgottenPasswordEmail(string, string, string, bool, string, string, Dictionary<string, string>)
public static bool SendForgottenPasswordEmail(string userEmail, string userName, string password, bool isNewPassword, string recoveryUrl, string emailTemplateFolder, Dictionary<string, string> emailTags = null)
Parameters
userEmailstringuserNamestringpasswordstringisNewPasswordboolrecoveryUrlstringemailTemplateFolderstringemailTagsDictionary<string, string>
Returns
SetExtranetLoginErrorTags()
Sets the ExtranetLogin error tags to FrontPage with Login Box
[Obsolete("Use SetExtranetLogOnErrorTags instead")]
public static void SetExtranetLoginErrorTags()
SetExtranetLoginTags(Template)
Sets the login template tags.
[Obsolete("Use SetExtranetLogOnTags instead")]
public void SetExtranetLoginTags(Template extranetLogOnPromptTemplate)
Parameters
extranetLogOnPromptTemplateTemplate- The extranet login prompt template.
SetExtranetLogOnErrorTags()
Sets the ExtranetLogin error tags to FrontPage with Login Box
public static void SetExtranetLogOnErrorTags()
SetExtranetLogOnTags(Template)
Sets the login template tags.
public void SetExtranetLogOnTags(Template extranetLogOnPromptTemplate)
Parameters
extranetLogOnPromptTemplateTemplate- The extranet login prompt template.