Cline rules
.clinerules/msal-guidelines.mdCline rules
Quality
66/100
Scores the file, not the repository.Length
496 words
14 headings · 1 code blocksRepository
1.5k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1# MSAL.NET Guidelines23## Overview45Microsoft Authentication Library (MSAL) for .NET is a highly scalable authentication library that enables applications to authenticate with the Microsoft identity platform. For confidential client scenarios (server-side applications), the library provides:67- Token acquisition for service-to-service calls8- Flexible token caching with distributed cache support9- Managed identity integration for Azure workloads10- On-behalf-of flow for service-to-service delegated access1112Through its comprehensive feature set and proven reliability, MSAL.NET simplifies the implementation of secure authentication in server-side applications while maintaining optimal performance and security.1314## Repository Structure1516### Core Directories17- `/src/client/Microsoft.Identity.Client` - Core MSAL functionality18 - `ConfidentialClientApplication.cs` - Primary confidential client implementation19 - `ApiConfig/` - API configuration and builders20 - `Cache/` - Token cache implementations21 - `ManagedIdentity/` - Azure managed identity support22 - `OAuth2/` - OAuth protocol implementations23 - `Internal/` - Internal components and utilities24- `/tests` - Unit tests and integration tests25- `/benchmark` - Performance benchmarking infrastructure26- `/tools` - Development and configuration tools2728## Core Components2930### Confidential Client Features31- Microsoft.Identity.Client - Main MSAL library with confidential client support32- Token cache implementations with extensible serialization33- Managed identity integration for Azure environments3435### Authentication Components36- IConfidentialClientApplication - Primary interface for confidential clients37- Token cache providers and serialization extensibility38- Client credential builders and configurations39- Custom assertion providers (certificates, managed identity)4041## Development Guidelines4243### Core Development Principles44- Follow .editorconfig rules strictly45- Maintain backward compatibility due to widespread usage46- Implement proper error handling and retry logic47- Keep dependencies minimal and well-justified48- Document security considerations thoroughly49- Do not use reflection in source code and tests.5051### Authentication Best Practices52- Use certificate-based authentication over client secrets when possible53- Implement token caching for optimal performance54- Handle token expiration and refresh scenarios55- Configure appropriate token lifetimes56- Use managed identities in Azure environments when available5758### Performance Requirements59- Implement distributed token caching for scale-out scenarios60- Optimize token acquisition patterns61- Use asynchronous APIs consistently62- Configure appropriate retry policies63- Benchmark token operations in high-throughput scenarios6465### Security Guidelines66- Secure storage of client secrets and certificates67- Implement proper token validation68- Follow least-privilege principle for scopes69- Handle sensitive data appropriately70- Implement proper logging (avoiding sensitive data)7172### Testing Requirements73- Maintain comprehensive test coverage74- Include integration tests with actual identity endpoints75- Test token cache implementations thoroughly76- Verify managed identity scenarios77- Include performance benchmarks for token operations7879### Public API Changes80- The project uses Microsoft.CodeAnalysis.PublicApiAnalyzers81- For any public API changes:82 1. Update PublicAPI.Unshipped.txt in the package directory83 2. Include complete API signatures84 3. Consider backward compatibility impacts85 4. Document breaking changes clearly8687Example format:88```diff89// Adding new API90+Microsoft.Identity.Client.ConfidentialClientApplication.AcquireTokenForClient() -> Task<AuthenticationResult>91+Microsoft.Identity.Client.IConfidentialClientApplication.GetAccounts() -> Task<IEnumerable<IAccount>>9293// Removing API (requires careful consideration)94-Microsoft.Identity.Client.ConfidentialClientApplication.ObsoleteMethod() -> void95```9697The analyzer enforces documentation of all public API changes in PublicAPI.Unshipped.txt and will fail the build if changes are not properly reflected.98
Also in AzureAD/microsoft-authentication-library-for-dotnet
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| AzureAD/microsoft-authentication-library-for-dotnet.github/instructions/tests.instructions.md · 1.5k | Copilot instructions | teststylegitdo-not | 62/100 | 3 days ago | |
| AzureAD/microsoft-authentication-library-for-dotnet.clinerules/cline-instructions.md · 1.5k | Cline rules | archtypestesting-strategyagent-behaviour | 48/100 | 3 days ago | |
| AzureAD/microsoft-authentication-library-for-dotnet.github/copilot-instructions.md · 1.5k | Copilot instructions | setupteststylearch+5 | 47/100 | 3 days ago | |
| AzureAD/microsoft-authentication-library-for-dotnet.clinerules/ai-guidelines.md · 1.5k | Cline rules | no sections | 16/100 | 3 days ago | |
| AzureAD/microsoft-authentication-library-for-dotnet.clinerules/csharp-guidelines.md · 1.5k | Cline rules | testlint-formatstyletypes+2 | 75/100 | 3 days ago | |
| AzureAD/microsoft-authentication-library-for-dotnet.github/instructions/src.instructions.md · 1.5k | Copilot instructions | gitapido-not | 59/100 | 3 days ago |
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| JCodesMore/ai-website-cloner-template.clinerules · 31k | Cline rules | buildlint-formatstylearch+3 | 97/100 | 2 days ago | |
| BryaanF/LiantPortfolio.clinerules/project-guidelines.md · 0 | Cline rules | buildstylearchgit+2 | 96/100 | 3 days ago | |
| lepinkainen/humanlog.clinerules/project-rules.md · 0 | Cline rules | setupbuildtestlint-format+8 | 96/100 | 3 days ago | |
| u9401066/zotero-keeper.clinerules/50-pubmed-project.md · 6 | Cline rules | testlint-formatstylearch+1 | 94/100 | 3 days ago | |
| u9401066/pubmed-search-mcp.clinerules/50-pubmed-project.md · 23 | Cline rules | testlint-formatstylearch+1 | 94/100 | 3 days ago | |
| u9401066/zotero-keepervscode-extension/resources/repo-assets/pubmed-search-mcp/.clinerules/50-pubmed-project.md · 6 | Cline rules | testlint-formatstylearch+1 | 94/100 | 3 days ago | |
| VaillerTeeter/HoshimiNest.clinerules/project-identity.md · 1 | Cline rules | setuparchtypesdo-not | 93/100 | yesterday | |
| blendsdk/codeops-mcp.clinerules/project.md · 0 | Cline rules | buildteststylearch+7 | 91/100 | 3 days ago |
