YellowNotes
Sample ASP.NET Web API project with OAuth authentication and many other extensions.
Table of contents
- The basics of API (CRUD)
- Validation
- Authentication and authorization
- Documentation
- Other
- Samples and Examples
- Contributing
- Useful links
1. The basics of API (GoodNotesController)
- Create -> Post
- Read -> Get
- Update -> Put
- Delete -> Delete
2. Validation
- Basic validation (via DataAnnotations attributes)
- ModelState validation (ValidateModelStateAttribute)
- Model empty validation (CheckModelForNullAttribute)
- Action parameters validation (ActionParametersValidationAttribute)
3. Authentication and authorization
- Access Token (OAuth bearer token authentication using OWIN middleware) (SimpleAuthorizationServerProvider)
- Client credentials validation
- Token custom parameter
- Authentication Ticket custom property
- Custom claim
- Refresh Token (SimpleRefreshTokenProvider)
- Custom Authorize attribute (SimpleAuthorizeAttribute)
4. Documentation
- Help Pages (via Microsoft.AspNet.WebApi.HelpPage nuget package)
- Multiple XML documentation (XML comments beyond the main project)
- HTTP Status Codes (attribute to generate HTTP response codes in documentation) (ResponseHttpStatusCodeAttribute)
- Output Cache profile
5. Other
- API exceptions handling (RequestExceptionAttribute)
- Working CORS (Cross-Origin Resource Sharing) implementation (CorsProvider)
- Simple Owin middleware to rewrite header from request to response (CorrelationIdHeaderRewriterMiddleware)
6. Samples and Examples
Token generation
Access to resource denied
Access to resource granted
Refresh Token utilise
Model validation
CORS (Cross-Origin Resource Sharing)
Documentation Help Pages
7. Contributing
You are very welcome to submit either issues or pull requests to this repository!
I'm trying to follow GitHub Flow process, so please follow this rules:
- Make changes on feature branch.
- Commit messages should be clear and as much as possible descriptive.
- Rebase if required.
- Make sure that your code compile and run locally.
- Push your feature branch to GitHub.
- Create pull request.
8. Useful links
- HTTP Status Codes: http://www.restapitutorial.com/httpstatuscodes.html
- Choosing an HTTP Status Code:
http://racksburg.com/choosing-an-http-status-codehttps://www.ruilog.com/notebook/view/f21862318f93.html







