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
pageId
int
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
userId
int- The user identifier.
oldPassword
string- The old password.
newPassword
string- The new password.
encryptPassword
bool- 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
password
string- The password.
id
int- The id.
errorMessage
string- The error message.
passwordErrorCode
int- The password error code.
forceReuseCheck
bool- if set to
true
force check of password reuse. isBackendCheck
bool- if set to
true
force chaeck by backend rules.
Returns
CheckSecureFolderAccess(string)
public bool CheckSecureFolderAccess(string path)
Parameters
path
string
Returns
ConvertDefaultToUtf8Encoding(string)
public static string ConvertDefaultToUtf8Encoding(string value)
Parameters
value
string
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
strInput
string- 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
username
string- The username.
password
string- The password.
onlyActive
bool- if set to
true
only 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
redirect
bool
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
username
string- The username.
password
string- The password.
onlyActive
bool- if set to
true
only 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
pageId
int
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
user
User- The user.
generateNewPassword
bool- if set to
false
old password will send to user is it possible. if set totrue
andnewPassword
not null\empty thennewPassword
will used like password else generate new password. newPassword
string- The new password.
emailTemplateFolder
string
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
permissionType
string- Name of the permission type.
userID
string- The UserID. Can be a comma separated string with additional IDs.
userType
string- 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
page
Page- The page.
Returns
- string
- System.String.
GetInheritedPermission(Page)
Gets the inherited permission.
public static IEnumerable<string> GetInheritedPermission(Page page)
Parameters
page
Page- The page.
Returns
- IEnumerable<string>
- System.String.
GetInheritedPermissionTemplate(Page)
Gets the inherited permission.
public static string GetInheritedPermissionTemplate(Page page)
Parameters
page
Page- The page.
Returns
- string
- System.String.
GetInheritedProtect(Page)
Gets the inherited protect.
public static bool GetInheritedProtect(Page page)
Parameters
page
Page- The page.
Returns
- bool
true
if XXXX,false
otherwise.
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
filePath
string- 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
page
Page- The page.
Returns
- bool
true
if current user have access to the specified page; otherwise,false
.false
if page is null.false
if user is not logged in and page has permissions set.true
if 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
page
Page
Returns
- bool
- Boolean statement.
LogInUsingExternalAuthentication(ExternalLoginResult)
[Obsolete("Use LogInUsingExternalAuthentication instead.")]
public void LogInUsingExternalAuthentication(ExternalLoginResult loginResult)
Parameters
loginResult
ExternalLoginResult
LogInUsingExternalAuthentication(ExternalLoginResult, bool)
[Obsolete("Use LogInUsingExternalAuthentication instead.")]
public void LogInUsingExternalAuthentication(ExternalLoginResult loginResult, bool isADLogin)
Parameters
loginResult
ExternalLoginResultisADLogin
bool
LogInUsingExternalAuthentication(ExternalLoginResult, bool, int)
[Obsolete("Use LogInUsingExternalAuthentication instead.")]
public void LogInUsingExternalAuthentication(ExternalLoginResult loginResult, bool isADLogin, int pageid)
Parameters
loginResult
ExternalLoginResultisADLogin
boolpageid
int
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
redirect
bool
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
loginResult
ExternalLoginResult- The result of external authentication
LogOnWithExternalAuthentication(ExternalLoginResult, bool)
Grant access with external account
public void LogOnWithExternalAuthentication(ExternalLoginResult loginResult, bool isADLogin)
Parameters
loginResult
ExternalLoginResult- The result of external authentication
isADLogin
bool- 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
logOnResult
ExternalLoginResult- The result of external authentication
isADLogin
bool- True if login is from Active Directory, otherwise False.
pageId
int- The page where the login is performed
SaveCookie()
Saves cookie.
public void SaveCookie()
SaveExtranetUserInputPassword(string)
public static void SaveExtranetUserInputPassword(string password)
Parameters
password
string
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
userEmail
stringuserName
stringpassword
stringisNewPwd
boolrecoveryUrl
stringemailTemplateFolder
stringemailTagVals
Dictionary<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
userEmail
stringuserName
stringpassword
stringisNewPassword
boolrecoveryUrl
stringemailTemplateFolder
stringemailTags
Dictionary<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
extranetLogOnPromptTemplate
Template- 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
extranetLogOnPromptTemplate
Template- The extranet login prompt template.