init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
34
Framework/Security/IncorrectPasswordException.cs
Normal file
34
Framework/Security/IncorrectPasswordException.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using Kreta.Framework.Localization;
|
||||
using Kreta.Framework.Logging;
|
||||
|
||||
namespace Kreta.Framework.Security
|
||||
{
|
||||
/// <summary>
|
||||
/// Érvénytelen jelszó.
|
||||
/// </summary>
|
||||
[FriendlyName(1000010, "Hibás felhasználónév vagy jelszó!")]
|
||||
[ErrorCode(Events.SECURITY_LOGINFAILED)]
|
||||
[Serializable]
|
||||
public sealed class IncorrectPasswordException : SecurityException
|
||||
{
|
||||
/// <summary>
|
||||
/// Az osztály konstruktora
|
||||
/// </summary>
|
||||
/// <param name="loginName"></param>
|
||||
public IncorrectPasswordException(string loginName)
|
||||
: base("Hibás felhasználónév vagy jelszó!")
|
||||
{
|
||||
this.SetValue("LoginName", loginName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Az osztály konstruktora.
|
||||
/// </summary>
|
||||
/// <param name="info">Sorosítási adatok</param>
|
||||
/// <param name="context">Sorosítási adatfolyam</param>
|
||||
IncorrectPasswordException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context) { }
|
||||
}
|
||||
}
|
96
Framework/Security/LoginInfo.cs
Normal file
96
Framework/Security/LoginInfo.cs
Normal file
|
@ -0,0 +1,96 @@
|
|||
using System;
|
||||
|
||||
namespace Kreta.Framework.Security
|
||||
{
|
||||
public enum PasswordState
|
||||
{
|
||||
INVALID,
|
||||
VALID,
|
||||
EXPIRED_BY_DATABASE,
|
||||
EXPIRED_BY_POLICY,
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class LoginInfo
|
||||
{
|
||||
public LoginInfo()
|
||||
{
|
||||
}
|
||||
|
||||
public LoginInfo(string sessionId, int uniqueIdentifier, string clientIP, int felhasznaloId, string belepesiNev, string intezmenyAzonosito = null)
|
||||
{
|
||||
SessionID = sessionId;
|
||||
UniqueIdentifier = uniqueIdentifier;
|
||||
ClientIP = clientIP;
|
||||
FelhasznaloId = felhasznaloId;
|
||||
BelepesiNev = belepesiNev;
|
||||
IntezmenyAzonosito = intezmenyAzonosito;
|
||||
}
|
||||
|
||||
public PasswordState PasswordState { get; set; } = PasswordState.INVALID;
|
||||
|
||||
public string IntezmenyAzonosito { get; set; }
|
||||
|
||||
public int IntezmenyId { get; set; }
|
||||
|
||||
public int AktivTanevId { get; set; }
|
||||
|
||||
public int SelectedTanevId { get; set; }
|
||||
|
||||
public int? AktivTanevEgyediAzonosito { get; set; }
|
||||
|
||||
public string SessionID { get; set; }
|
||||
|
||||
public string BelepesiNev { get; set; }
|
||||
|
||||
public int UniqueIdentifier { get; set; }
|
||||
|
||||
public int FelhasznaloId { get; set; }
|
||||
|
||||
public string FelhasznaloEgyediAzonosito { get; set; }
|
||||
|
||||
public Guid FelhasznaloIdpEgyediAzonosito { get; set; }
|
||||
|
||||
public Guid? GondviseloIdpEgyediAzonosito { get; set; }
|
||||
|
||||
public int? GondviseloId { get; set; }
|
||||
|
||||
public string GondviseloEgyediAzonosito { get; set; }
|
||||
|
||||
public string GondviseloNeve { get; set; }
|
||||
|
||||
public string NyomtatasiNev { get; set; }
|
||||
|
||||
public string KodoltJelszo { get; set; }
|
||||
|
||||
public string So { get; set; }
|
||||
|
||||
public string NeptunNaploJelszo { get; set; }
|
||||
|
||||
public DateTime? UtolsoBelepesIdeje { get; set; }
|
||||
|
||||
public bool JelszotKotelezoValtoztatni { get; set; }
|
||||
|
||||
public int MeghiusultBelepes { get; set; }
|
||||
|
||||
public string Utonev { get; set; }
|
||||
|
||||
public string Vezeteknev { get; set; }
|
||||
|
||||
public string AnyjaNeve { get; set; }
|
||||
|
||||
public DateTime SzuletesiDatum { get; set; }
|
||||
|
||||
public string SzuletesiHely { get; set; }
|
||||
|
||||
public bool IsDeniedSzirIntezmenyUser { get; set; }
|
||||
|
||||
public bool IsDeniedArchivIntezmenyUser { get; set; }
|
||||
|
||||
public string ClientIP { get; set; }
|
||||
|
||||
public string ElsodlegesEmailCim { get; set; }
|
||||
|
||||
public int BelepesId { get; set; }
|
||||
}
|
||||
}
|
45
Framework/Security/PasswordCrypting/BasePasswordCrypter.cs
Normal file
45
Framework/Security/PasswordCrypting/BasePasswordCrypter.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
using System;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace Kreta.Framework.Security.PasswordCrypting
|
||||
{
|
||||
public static class BasePasswordCrypter
|
||||
{
|
||||
public static string EncodePasswordSHA1(string plainPassword, string salt)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(salt))
|
||||
{
|
||||
return plainPassword;
|
||||
}
|
||||
|
||||
string saltedPlainPassword = plainPassword + salt;
|
||||
using (HashAlgorithm hash = SHA1.Create())
|
||||
{
|
||||
byte[] passwordarray = Encoding.Unicode.GetBytes(saltedPlainPassword);
|
||||
byte[] hasharray = hash.ComputeHash(passwordarray);
|
||||
|
||||
string encryptedPassword = Convert.ToBase64String(hasharray);
|
||||
|
||||
return encryptedPassword;
|
||||
}
|
||||
}
|
||||
|
||||
public static string EncodePasswordMD5(string plainPassword)
|
||||
{
|
||||
using (HashAlgorithm hash = MD5.Create())
|
||||
{
|
||||
byte[] passwordArray = hash.ComputeHash(Encoding.UTF8.GetBytes(plainPassword));
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
foreach (byte item in passwordArray)
|
||||
{
|
||||
stringBuilder.Append(item.ToString("x2"));
|
||||
}
|
||||
var result = stringBuilder.ToString();
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
55
Framework/Security/SecurityException.cs
Normal file
55
Framework/Security/SecurityException.cs
Normal file
|
@ -0,0 +1,55 @@
|
|||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using Kreta.Framework.Localization;
|
||||
using Kreta.Framework.Logging;
|
||||
|
||||
namespace Kreta.Framework.Security
|
||||
{
|
||||
/// <summary>
|
||||
/// A jogosultságrendszer kivételeinek ősosztálya.
|
||||
/// </summary>
|
||||
[FriendlyName(1000016, "A jogosultságrendszer megsértése történt.")]
|
||||
[ErrorCode(Events.SECURITY_GENERAL)]
|
||||
[Serializable]
|
||||
public class SecurityException : FrameworkException
|
||||
{
|
||||
/// <summary>
|
||||
/// Visszaadja, hogy a jogosultság megsértése okozzon-e munkamenet megszüntetést, vagy sem.
|
||||
/// </summary>
|
||||
public virtual bool DestroyUserSession
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Az osztály konstruktora.
|
||||
/// </summary>
|
||||
public SecurityException() { }
|
||||
|
||||
/// <summary>
|
||||
/// Az osztály konstruktora.
|
||||
/// </summary>
|
||||
/// <param name="message">A kivétel szövege</param>
|
||||
public SecurityException(string message)
|
||||
: base(message) { }
|
||||
|
||||
/// <summary>
|
||||
/// Az osztály konstruktora.
|
||||
/// </summary>
|
||||
/// <param name="message">A kivétel szövege</param>
|
||||
/// <param name="innerException">Az előző kivétel</param>
|
||||
public SecurityException(string message, Exception innerException)
|
||||
: base(message, innerException) { }
|
||||
|
||||
/// <summary>
|
||||
/// Az osztály konstruktora.
|
||||
/// </summary>
|
||||
/// <param name="info">Sorosítási adatok</param>
|
||||
/// <param name="context">Sorosítási adatfolyam</param>
|
||||
protected SecurityException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context) { }
|
||||
}
|
||||
}
|
86
Framework/Security/UserNotFoundException.cs
Normal file
86
Framework/Security/UserNotFoundException.cs
Normal file
|
@ -0,0 +1,86 @@
|
|||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using Kreta.Framework.Localization;
|
||||
using Kreta.Framework.Logging;
|
||||
|
||||
namespace Kreta.Framework.Security
|
||||
{
|
||||
/// <summary>
|
||||
/// Ismeretlen felhasználó
|
||||
/// </summary>
|
||||
[FriendlyName(1000010, "Hibás felhasználónév vagy jelszó!")]
|
||||
[ErrorCode(Events.SECURITY_LOGINFAILED)]
|
||||
[Serializable]
|
||||
public class UserNotFoundException : SecurityException
|
||||
{
|
||||
/// <summary>
|
||||
/// Az osztály konstruktora
|
||||
/// </summary>
|
||||
/// <param name="loginName">A felhasználó neve (bejelentkezési azonosítója)</param>
|
||||
public UserNotFoundException(string loginName)
|
||||
: base("Hibás felhasználónév vagy jelszó!")
|
||||
{
|
||||
SetValue("LoginName", loginName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Az osztály alapértelmezett konstruktora.
|
||||
/// </summary>
|
||||
public UserNotFoundException() { }
|
||||
|
||||
/// <summary>
|
||||
/// Az osztály konstruktora.
|
||||
/// </summary>
|
||||
/// <param name="message">A kivétel üzenete</param>
|
||||
/// <param name="innerException">A belső kivétel</param>
|
||||
public UserNotFoundException(string message, Exception innerException)
|
||||
: base(message, innerException) { }
|
||||
|
||||
/// <summary>
|
||||
/// Az osztály konstruktora.
|
||||
/// </summary>
|
||||
/// <param name="info">Sorosítási adatok</param>
|
||||
/// <param name="context">Sorosítási adatfolyam</param>
|
||||
protected UserNotFoundException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context) { }
|
||||
}
|
||||
|
||||
[FriendlyName(1000015, "A jelszó nem felel meg a jelszó beállítási követelményeknek!")]
|
||||
[ErrorCode(Events.SECURITY_LOGINFAILED)]
|
||||
[Serializable]
|
||||
public sealed class PasswordComplexcityException : SecurityException
|
||||
{
|
||||
/// <summary>
|
||||
/// Az osztály konstruktora
|
||||
/// </summary>
|
||||
/// <param name="loginName">A felhasználó neve (bejelentkezési azonosítója)</param>
|
||||
public PasswordComplexcityException(string loginName)
|
||||
: base("A jelszó nem felel meg a jelszó beállítási követelményeknek!")
|
||||
{
|
||||
SetValue("LoginName", loginName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Az osztály alapértelmezett konstruktora.
|
||||
/// </summary>
|
||||
[Obsolete("Ezt a konstruktort ne használd!")]
|
||||
public PasswordComplexcityException() { }
|
||||
|
||||
/// <summary>
|
||||
/// Az osztály konstruktora.
|
||||
/// </summary>
|
||||
/// <param name="message">A kivétel üzenete</param>
|
||||
/// <param name="innerException">A belső kivétel</param>
|
||||
[Obsolete("Ezt a konstruktort ne használd!")]
|
||||
public PasswordComplexcityException(string message, Exception innerException)
|
||||
: base(message, innerException) { }
|
||||
|
||||
/// <summary>
|
||||
/// Az osztály konstruktora.
|
||||
/// </summary>
|
||||
/// <param name="info">Sorosítási adatok</param>
|
||||
/// <param name="context">Sorosítási adatfolyam</param>
|
||||
PasswordComplexcityException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context) { }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue