| | | 1 | | namespace LOCKnet.Core.Services; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Erzeugt kryptographisch sichere Passwoerter auf Basis konfigurierbarer Optionen. |
| | | 5 | | /// </summary> |
| | | 6 | | public interface IPasswordGeneratorService |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// Generiert ein neues Passwort auf Basis von <paramref name="options"/>. |
| | | 10 | | /// </summary> |
| | | 11 | | /// <param name="options">Optionen fuer Laenge und erlaubte Zeichengruppen.</param> |
| | | 12 | | /// <returns>Ein zufaellig erzeugtes Passwort.</returns> |
| | | 13 | | string Generate(PasswordGeneratorOptions options); |
| | | 14 | | } |
| | | 15 | | |
| | | 16 | | /// <summary> |
| | | 17 | | /// Optionen fuer die Passwortgenerierung. |
| | | 18 | | /// </summary> |
| | | 19 | | public record PasswordGeneratorOptions |
| | | 20 | | { |
| | | 21 | | /// <summary>Gewuenschte Passwortlaenge.</summary> |
| | 46 | 22 | | public int Length { get; init; } = 16; |
| | | 23 | | |
| | | 24 | | /// <summary>Grossbuchstaben verwenden.</summary> |
| | 36 | 25 | | public bool UseUppercase { get; init; } = true; |
| | | 26 | | |
| | | 27 | | /// <summary>Kleinbuchstaben verwenden.</summary> |
| | 36 | 28 | | public bool UseLowercase { get; init; } = true; |
| | | 29 | | |
| | | 30 | | /// <summary>Ziffern verwenden.</summary> |
| | 36 | 31 | | public bool UseDigits { get; init; } = true; |
| | | 32 | | |
| | | 33 | | /// <summary>Sonderzeichen verwenden.</summary> |
| | 36 | 34 | | public bool UseSpecial { get; init; } = true; |
| | | 35 | | } |