1- # 🔹 DotNet-API: Active Directory SSO Integration
1+ # 🔹 DotNet-API — Active Directory SSO Integration
22
3- ## 📌 Overview
3+ ![ SSO ] ( https://img.shields.io/badge/SSO-LDAP%20%7C%20Active%20Directory-blue?style=for-the-badge&logo=microsoft ) ![ DotNet ] ( https://img.shields.io/badge/.NET-ASP.NET%20Core-512BD4?style=for-the-badge&logo=dotnet&logoColor=white ) ![ API ] ( https://img.shields.io/badge/Type-REST%20API-0A66C2?style=for-the-badge ) ![ Security ] ( https://img.shields.io/badge/Security-Enterprise%20SSO-critical?style=for-the-badge )
44
5- The ** DotNet-API ** is an ** ASP.NET Core-based REST API ** that enables ** LDAP-based Single Sign-On (SSO) authentication ** with ** Active Directory ** .
5+ ## 📝 Overview
66
7- ---
7+ The ** DotNet-API** module is an ** ASP.NET Core–based REST API** that implements ** LDAP-based Single Sign-On (SSO)** authentication against ** Microsoft Active Directory** .
8+
9+ This integration follows the same ** security, configuration, and architectural standards** defined in the ** ActiveDirectory-SSO-Integrations** suite, enabling ** consistent, auditable, and reusable SSO patterns** across enterprise environments.
10+
11+ Key objectives:
12+
13+ - Centralized authentication via Active Directory
14+ - Secure LDAP bind using ** service accounts (InetOrgPerson)**
15+ - Clean separation between authentication logic, middleware, and API endpoints
16+ - Ready for enterprise deployment and extension
817
918## 📁 Folder Structure
1019
1120```
1221ActiveDirectory-SSO-Integrations/
13- │
14- ├── 📂 DotNet-API/ # Parent folder for .NET API integration
15- │ ├── 📄 DotNetSSO.sln # Solution file for the .NET project
16- │ ├── 📖 README.md # Documentation for DotNet-API integration
17- │ ├── 📂 DotNetSSO.API/ # Main API implementation
18- │ │ ├── 📄 Program.cs # Entry point for the API
19- │ │ ├── 🛇 Startup.cs # Application startup configuration
20- │ │ ├── 📜 appsettings.json # General application settings
21- │ │ ├── 📜 appsettings.Development.json # Environment-specific settings
22- │ │ ├── 📜 ldapsettings.json # LDAP authentication settings
23- │ │ ├── 📂 Controllers/ # API controllers
24- │ │ │ ├── 📜 AuthController.cs # Handles authentication requests
25- │ │ │ ├── 📜 UserController.cs # Manages user-related requests
26- │ │ ├── 📂 Services/ # Business logic for LDAP authentication
27- │ │ │ ├── 📜 LdapService.cs # Handles LDAP authentication logic
28- │ │ ├── 📂 Middleware/ # Custom authentication enforcement
29- │ │ │ ├── 📜 AuthenticationMiddleware.cs # Middleware for enforcing authentication
30- │ │ ├── 📂 Models/ # Defines data models
31- │ │ │ ├── 📜 UserModel.cs # Represents user object schema
22+ └── DotNet-API/
23+ ├── DotNetSSO.sln
24+ ├── README.md
25+ └── DotNetSSO.API/
26+ ├── Program.cs
27+ ├── Startup.cs
28+ ├── appsettings.json
29+ ├── appsettings.Development.json
30+ ├── ldapsettings.json
31+ ├── Controllers/
32+ │ ├── AuthController.cs
33+ │ └── UserController.cs
34+ ├── Services/
35+ │ └── LdapService.cs
36+ ├── Middleware/
37+ │ └── AuthenticationMiddleware.cs
38+ └── Models/
39+ └── UserModel.cs
3240```
3341
34- ---
35-
3642## 🛠️ Prerequisites
3743
38- - ** .NET 6.0 or later**
39- - ** Active Directory instance**
40- - ** LDAP access credentials**
41- - ** Visual Studio / VS Code**
42- - ** Postman** (for testing API requests)
43-
44- ---
45-
46- ## ⚙️ Configuration
44+ - .NET 6.0 or later
45+ - Active Directory domain with LDAP enabled
46+ - Dedicated LDAP bind account (InetOrgPerson, least privilege)
47+ - Visual Studio or VS Code
48+ - Postman or curl for API testing
4749
48- Modify ` appsettings.json ` with your ** LDAP credentials ** :
50+ ## ⚙️ LDAP Configuration
4951
5052``` json
5153{
@@ -59,86 +61,30 @@ Modify `appsettings.json` with your **LDAP credentials**:
5961}
6062```
6163
62- ---
64+ ## 🚀 Running the API
6365
64- ## 🚀 How to Run
65-
66- 1 . ** Clone the repository** :
67- ``` bash
68- git clone https://github.com/brazilianscriptguy/Windows-SysAdmin-ProSuite.git
69- cd Windows-SysAdmin-ProSuite/SysAdmin-Tools/ActiveDirectory-SSO-Integrations/DotNet-API
70- ```
71-
72- 2 . ** Set the LDAP password as an environment variable** :
73- ``` bash
74- export LDAP_PASSWORD=' your-secure-password'
75- ```
76-
77- 3 . ** Run the application** :
78- ``` bash
79- dotnet run
80- ```
66+ ``` bash
67+ git clone https://github.com/brazilianscriptguy/Windows-SysAdmin-ProSuite.git
68+ cd Windows-SysAdmin-ProSuite/SysAdmin-Tools/ActiveDirectory-SSO-Integrations/DotNet-API
69+ ```
8170
82- ---
71+ ``` powershell
72+ $env:LDAP_PASSWORD="your-secure-password"
73+ dotnet run
74+ ```
8375
8476## 🔄 API Endpoints
8577
86- ### 1️⃣ Authenticate User
87-
88- - ** Endpoint** : ` POST /api/auth/login `
89- - ** Request Body** :
90- ``` json
91- {
92- "username" : " john.doe" ,
93- "password" : " SuperSecretPassword"
94- }
95- ```
96- - ** Response** :
97- ``` json
98- {
99- "message" : " Authentication successful"
100- }
101- ```
102-
103- ---
104-
105- ### 2️⃣ Get User Details
106-
107- - ** Endpoint** : ` GET /api/user/{username} `
108- - ** Example** :
109- ``` bash
110- curl -X GET http://localhost:5000/api/user/john.doe
111- ```
112- - ** Response** :
113- ``` json
114- {
115- "username" : " john.doe" ,
116- "displayName" : " John Doe" ,
117- 118- "department" : " IT" ,
119- "role" : " User"
120- }
121- ```
122-
123- ---
124-
125- ## 📜 License
126-
127- [ ![ MIT License] ( https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge )] ( https://github.com/brazilianscriptguy/Windows-SysAdmin-ProSuite/blob/main/.github/LICENSE )
128-
129- ---
130-
131- ## 🤝 Contributing
132-
133- [ ![ Contributions Welcome] ( https://img.shields.io/badge/Contributions-Welcome-brightgreen?style=for-the-badge )] ( https://github.com/brazilianscriptguy/Windows-SysAdmin-ProSuite/blob/main/.github/CONTRIBUTING.md )
134-
135- ---
78+ ### Authenticate User
79+ ` POST /api/auth/login `
13680
137- ## 📩 Support
81+ ### Retrieve User Details
82+ ` GET /api/user/{username} `
13883
139- [ ![ Email Badge
] ( https://img.shields.io/badge/[email protected] ?style=for-the-badge&logo=gmail )] ( mailto:[email protected] ) 140- [ ![ GitHub Issues] ( https://img.shields.io/badge/GitHub%20Issues-Report%20Here-blue?style=for-the-badge&logo=github )] ( https://github.com/brazilianscriptguy/Windows-SysAdmin-ProSuite/blob/main/.github/BUG_REPORT.md )
84+ ## 🔐 Security Notes
14185
142- ---
86+ - LDAP bind with least privilege
87+ - No interactive logon
88+ - Middleware-enforced authentication
14389
144- < p align = " center " >🚀 < strong >Enjoy Seamless SSO Integration!</ strong > 🎯</ p >
90+ © 2026 Luiz Hamilton Silva. All rights reserved.
0 commit comments