IConfiguration vs IOptions NET
Synchronous and Asynchronous in .NET Core
Model Binding and Validation in ASP.NET Core
ControllerBase vs Controller in ASP.NET Core
ConfigureServices and Configure methods
IHostedService interface in .NET Core
ASP.NET Core request processing
| JWT Structure and Signature Validation | HTTP Essentials | |
Redirect URIs and Open Redirect Attacks |
A Redirect URI is the exact URL in your application where an authorization server (e.g., OAuth 2.0 / OpenID Connect provider) sends the user after authentication or consent. It is a critical part of OAuth flows because it is where authorization codes or tokens are delivered.
https://myapp.com.https://myapp.com/auth/callback?code=AUTH_CODE
AUTH_CODE for an access token.[User] --> [Trusted App] --> [Auth Server] [Auth Server] --> Redirect to Pre-Registered URI --> [Trusted App]
An Open Redirect occurs when an application takes a user‑supplied URL and redirects to it without proper validation. Attackers can exploit this to send users to malicious sites while making the link appear to come from a trusted domain.
https://trusted.com/redirect?url=https://trusted.com/home
https://trusted.com/redirect?url=https://evil.com/login
Many apps use a returnUrl or next parameter to send users back after login:
https://trusted.com/login?returnUrl=/dashboard
If not validated, an attacker could set:
https://trusted.com/login?returnUrl=https://evil.com/fake-login
/path) instead of full URLs for internal redirects.Url.IsLocalUrl() before redirecting.[User] --> Clicks trusted.com/redirect?url=evil.com [Trusted App] --> Redirects without validation --> [Evil Site] [Evil Site] --> Phishes credentials / steals tokens
| Aspect | Redirect URI | Open Redirect Attack |
|---|---|---|
| Purpose | Legitimate OAuth/OIDC callback endpoint | Exploit to send users to malicious sites |
| Control | Pre‑registered, exact match | User‑controlled parameter |
| Risk | Token leakage if misconfigured | Phishing, token theft, malware delivery |
| Prevention | Strict registration & HTTPS | Whitelisting, validation, relative paths |
| JWT Structure and Signature Validation | HTTP Essentials | |