C# Class Phun.Security.PhunWebSecurity

Not trying to be microsoft websecurity which is horrible. Static?
Datei anzeigen Open project: noogen/phuncms

Public Properties

Property Type Description
EnableSimpleMembershipKey string

Private Properties

Property Type Description
CreateAccount string
CreateDefaultSimpleMembershipProvider PhunSimpleMembershipProvider
CreateDefaultSimpleRoleProvider WebMatrix.WebData.SimpleRoleProvider
CreateUserAndAccount string
GeneratePasswordResetToken string
InitializeMembershipProvider void
InitializeProviders void
InitializeRoleProvider void
IsAccountLockedOutInternal bool
IsUserLoggedOn bool
Login bool
Logout void
PreAppStartInit void
VerifyProvider WebMatrix.WebData.ExtendedMembershipProvider

Public Methods

Method Description
ChangePassword ( string userName, string currentPassword, string newPassword ) : bool

Changes the password.

ConfirmAccount ( string accountConfirmationToken ) : bool

Confirms the account.

ConfirmAccount ( string userName, string accountConfirmationToken ) : bool

Confirms the account.

GetCreateDate ( string userName ) : System.DateTime

Gets the create date.

GetLastPasswordFailureDate ( string userName ) : System.DateTime

Gets the last password failure date.

GetPasswordChangedDate ( string userName ) : System.DateTime

Gets the password changed date.

GetPasswordFailuresSinceLastSuccess ( string userName ) : int

Gets the password failures since last success.

GetUserId ( string userName ) : int

Gets the user id.

GetUserIdFromPasswordResetToken ( string token ) : int

Gets the user id from password reset token.

InitializeDatabaseConnection ( string connectionStringName, string userTableName, string userIdColumn, string userNameColumn, bool autoCreateTables ) : void

Initializes the database connection.

IsAccountLockedOut ( string userName, int allowedPasswordAttempts, System.TimeSpan interval ) : bool

Determines whether [is account locked out] [the specified user name].

IsAccountLockedOut ( string userName, int allowedPasswordAttempts, int intervalInSeconds ) : bool

Determines whether [is account locked out] [the specified user name].

IsConfirmed ( string userName ) : bool

Determines whether the specified user name is confirmed.

IsCurrentUser ( string userName ) : bool

Determines whether [is current user] [the specified user name].

RequireAuthenticatedUser ( ) : void

Requires the authenticated user.

RequireRoles ( ) : void

Requires the roles.

RequireUser ( int userId ) : void

Requires the user.

RequireUser ( string userName ) : void

Requires the user.

ResetPassword ( string passwordResetToken, string newPassword ) : bool

Resets the password.

UserExists ( string userName ) : bool

Users the exists.

Private Methods

Method Description
CreateAccount ( string userName, string password, bool requireConfirmationToken = false ) : string
CreateDefaultSimpleMembershipProvider ( string name, MembershipProvider currentDefault ) : PhunSimpleMembershipProvider

Creates the default simple membership provider.

CreateDefaultSimpleRoleProvider ( string name, System.Web.Security.RoleProvider currentDefault ) : WebMatrix.WebData.SimpleRoleProvider

Creates the default simple role provider.

CreateUserAndAccount ( string userName, string password, object propertyValues = null, bool requireConfirmationToken = false ) : string
GeneratePasswordResetToken ( string userName, int tokenExpirationInMinutesFromNow = 1440 ) : string
InitializeMembershipProvider ( PhunSimpleMembershipProvider simpleMembership, string connectionStringName, string userTableName, string userIdColumn, string userNameColumn, bool createTables ) : void

Initializes the membership provider.

InitializeProviders ( string connectionStringName, string userTableName, string userIdColumn, string userNameColumn, bool autoCreateTables ) : void

Initializes the providers.

InitializeRoleProvider ( PhunSimpleRoleProvider simpleRoles, string connectionStringName, string userTableName, string userIdColumn, string userNameColumn, bool createTables ) : void

Initializes the role provider.

IsAccountLockedOutInternal ( WebMatrix.WebData.ExtendedMembershipProvider provider, string userName, int allowedPasswordAttempts, System.TimeSpan interval ) : bool

Determines whether [is account locked out internal] [the specified provider].

IsUserLoggedOn ( int userId ) : bool
Login ( string userName, string password, bool persistCookie = false ) : bool
Logout ( ) : void
PreAppStartInit ( ) : void

Pres the app start init.

VerifyProvider ( ) : WebMatrix.WebData.ExtendedMembershipProvider

Verifies the provider.

Method Details

ChangePassword() public static method

Changes the password.
public static ChangePassword ( string userName, string currentPassword, string newPassword ) : bool
userName string Name of the user.
currentPassword string The current password.
newPassword string The new password.
return bool

ConfirmAccount() public static method

Confirms the account.
public static ConfirmAccount ( string accountConfirmationToken ) : bool
accountConfirmationToken string The account confirmation token.
return bool

ConfirmAccount() public static method

Confirms the account.
public static ConfirmAccount ( string userName, string accountConfirmationToken ) : bool
userName string Name of the user.
accountConfirmationToken string The account confirmation token.
return bool

GetCreateDate() public static method

Gets the create date.
public static GetCreateDate ( string userName ) : System.DateTime
userName string Name of the user.
return System.DateTime

GetLastPasswordFailureDate() public static method

Gets the last password failure date.
public static GetLastPasswordFailureDate ( string userName ) : System.DateTime
userName string Name of the user.
return System.DateTime

GetPasswordChangedDate() public static method

Gets the password changed date.
public static GetPasswordChangedDate ( string userName ) : System.DateTime
userName string Name of the user.
return System.DateTime

GetPasswordFailuresSinceLastSuccess() public static method

Gets the password failures since last success.
public static GetPasswordFailuresSinceLastSuccess ( string userName ) : int
userName string Name of the user.
return int

GetUserId() public static method

Gets the user id.
public static GetUserId ( string userName ) : int
userName string Name of the user.
return int

GetUserIdFromPasswordResetToken() public static method

Gets the user id from password reset token.
public static GetUserIdFromPasswordResetToken ( string token ) : int
token string The token.
return int

InitializeDatabaseConnection() public static method

Initializes the database connection.
public static InitializeDatabaseConnection ( string connectionStringName, string userTableName, string userIdColumn, string userNameColumn, bool autoCreateTables ) : void
connectionStringName string Name of the connection string.
userTableName string Name of the user table.
userIdColumn string The user id column.
userNameColumn string The user name column.
autoCreateTables bool if set to true [auto create tables].
return void

IsAccountLockedOut() public static method

Determines whether [is account locked out] [the specified user name].
public static IsAccountLockedOut ( string userName, int allowedPasswordAttempts, System.TimeSpan interval ) : bool
userName string Name of the user.
allowedPasswordAttempts int The allowed password attempts.
interval System.TimeSpan The interval.
return bool

IsAccountLockedOut() public static method

Determines whether [is account locked out] [the specified user name].
public static IsAccountLockedOut ( string userName, int allowedPasswordAttempts, int intervalInSeconds ) : bool
userName string Name of the user.
allowedPasswordAttempts int The allowed password attempts.
intervalInSeconds int The interval in seconds.
return bool

IsConfirmed() public static method

Determines whether the specified user name is confirmed.
public static IsConfirmed ( string userName ) : bool
userName string Name of the user.
return bool

IsCurrentUser() public static method

Determines whether [is current user] [the specified user name].
public static IsCurrentUser ( string userName ) : bool
userName string Name of the user.
return bool

RequireAuthenticatedUser() public static method

Requires the authenticated user.
public static RequireAuthenticatedUser ( ) : void
return void

RequireRoles() public static method

Requires the roles.
public static RequireRoles ( ) : void
return void

RequireUser() public static method

Requires the user.
public static RequireUser ( int userId ) : void
userId int The user id.
return void

RequireUser() public static method

Requires the user.
public static RequireUser ( string userName ) : void
userName string Name of the user.
return void

ResetPassword() public static method

Resets the password.
public static ResetPassword ( string passwordResetToken, string newPassword ) : bool
passwordResetToken string The password reset token.
newPassword string The new password.
return bool

UserExists() public static method

Users the exists.
public static UserExists ( string userName ) : bool
userName string Name of the user.
return bool

Property Details

EnableSimpleMembershipKey public_oe static_oe property

The enable simple membership key
public static string EnableSimpleMembershipKey
return string