Skip to content

Commit 7616db5

Browse files
committed
feat: Add PhishLabs models (PhishLabsSettings and PhishLabsModels)
1 parent 19ce6e9 commit 7616db5

File tree

2 files changed

+118
-0
lines changed

2 files changed

+118
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
using System.ComponentModel.DataAnnotations;
2+
3+
namespace UmbracoWeb.Models;
4+
5+
/// <summary>
6+
/// Request model for submitting a phishing incident
7+
/// </summary>
8+
public class PhishLabsIncidentRequest
9+
{
10+
/// <summary>
11+
/// The suspicious URL to report
12+
/// </summary>
13+
[Required(ErrorMessage = "URL is required")]
14+
[Url(ErrorMessage = "Please enter a valid URL")]
15+
[StringLength(2048, ErrorMessage = "URL cannot exceed 2048 characters")]
16+
public string Url { get; set; } = string.Empty;
17+
18+
/// <summary>
19+
/// Optional details about the incident (max 1000 characters)
20+
/// </summary>
21+
[StringLength(1000, ErrorMessage = "Details cannot exceed 1000 characters")]
22+
public string? Details { get; set; }
23+
}
24+
25+
/// <summary>
26+
/// Response model for PhishLabs incident submission
27+
/// </summary>
28+
public class PhishLabsIncidentResponse
29+
{
30+
/// <summary>
31+
/// Indicates if the submission was successful
32+
/// </summary>
33+
public bool Success { get; set; }
34+
35+
/// <summary>
36+
/// Correlation ID for tracking the request
37+
/// </summary>
38+
public string CorrelationId { get; set; } = string.Empty;
39+
40+
/// <summary>
41+
/// Message to display to the user
42+
/// </summary>
43+
public string Message { get; set; } = string.Empty;
44+
45+
/// <summary>
46+
/// Error details if submission failed
47+
/// </summary>
48+
public string? ErrorDetails { get; set; }
49+
}
50+
51+
/// <summary>
52+
/// Internal model for PhishLabs API request
53+
/// </summary>
54+
internal class PhishLabsApiRequest
55+
{
56+
public string Url { get; set; } = string.Empty;
57+
public string? Description { get; set; }
58+
public string Source { get; set; } = "umbraco-web";
59+
public DateTime Timestamp { get; set; } = DateTime.UtcNow;
60+
}
61+
62+
/// <summary>
63+
/// Internal model for PhishLabs API response
64+
/// </summary>
65+
internal class PhishLabsApiResponse
66+
{
67+
public bool Success { get; set; }
68+
public string? IncidentId { get; set; }
69+
public string? Message { get; set; }
70+
public string? Error { get; set; }
71+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using System.ComponentModel.DataAnnotations;
2+
3+
namespace UmbracoWeb.Models;
4+
5+
/// <summary>
6+
/// Configuration settings for PhishLabs API integration
7+
/// </summary>
8+
public class PhishLabsSettings
9+
{
10+
public const string SectionName = "PhishLabs";
11+
12+
/// <summary>
13+
/// Base URL for the PhishLabs API
14+
/// </summary>
15+
[Required]
16+
public string ApiBaseUrl { get; set; } = string.Empty;
17+
18+
/// <summary>
19+
/// API key for authenticating with PhishLabs
20+
/// </summary>
21+
[Required]
22+
public string ApiKey { get; set; } = string.Empty;
23+
24+
/// <summary>
25+
/// Service path for incidents endpoint
26+
/// </summary>
27+
[Required]
28+
public string ServicePath { get; set; } = string.Empty;
29+
30+
/// <summary>
31+
/// Request timeout in seconds
32+
/// </summary>
33+
[Range(5, 300)]
34+
public int TimeoutSeconds { get; set; } = 30;
35+
36+
/// <summary>
37+
/// Maximum number of retry attempts
38+
/// </summary>
39+
[Range(0, 10)]
40+
public int MaxRetries { get; set; } = 3;
41+
42+
/// <summary>
43+
/// Rate limit per minute per user
44+
/// </summary>
45+
[Range(1, 100)]
46+
public int RateLimitPerMinute { get; set; } = 10;
47+
}

0 commit comments

Comments
 (0)