Basic For Web Api (Jwt Token , Consuming Method)



Steps For Creating Api

First we will get username and password. 
And we encrpt the password using Encoding.UTF8.
Then we append it on model and convert it as Json.
pass the json to api to validate user
and api will return success status , jwt token , 
and response which contains username , access privilage menu details , 
profile path

Index

  • Encrypt Password
  • Call Api Method
  • Https methods
  • Return Status  Codes

Encrypt Password


         string strmsg = string.Empty;
         byte[] encode = new byte[password.Length];
encode = Encoding.UTF8.GetBytes(password);
         strmsg = Convert.ToBase64String(encode);

Https methods

  
  • GET       - Retrive
  • POST     - Insert
  • PUT       - Update Existing Record
  • PATCH   - Update Record Partially
  • DELETE - Delete Records


Filter TypeInterfaceClassDescription
Simple FilterIFilter-Defines the methods that are used in a filter
Action FilterIActionFilterActionFilterAttributeUsed to add extra logic before or after action methods execute.
Authentication FilterIAuthenticationFilter-Used to force users or clients to be authenticated before action methods execute.
Authorization FilterIAuthorizationFilterAuthorizationFilterAttributeUsed to restrict access to action methods to specific users or groups.
Exception FilterIExceptionFilterExceptionFilterAttributeUsed to handle all unhandled exception in Web API.
Override FilterIOverrideFilter-Used to customize the behaviour of other filter for individual action method.



Comments

Popular Posts