March 4, 2021

how to fix fatal: early EOF fatal: index-pack failed

I am trying to Create a Repository in Bitbucket from one machine by connecting to the remote server.

Running git commit command, I am getting the below error.


fatal: early EOF fatal: index-pack failed




I have googled and found many solutions but none work for me.


Solution:

Finally solved by running the below command.


git config --global core.compression 9




March 2, 2021

How to use ID field in Calculated Column in SharePoint ?

Introduction:
In this article, we will explore, How to use the ID field in the Calculated Column in SharePoint LIST

PROBLEM:

I have tried to add ID field in a calculated column that added successfully without any error in the formula.
But I noticed that the calculated column is not calculated on the item added or updated!


March 1, 2021

Redoc - Instant API documentation

 Introduction:

In this article, we will explore the best API documentation tool.

THE BEST FREE API DOCUMENTATION TOOL 

There are plenty of tools available for doing API documentation  - some are open-source.

Today, I have found an advanced ease solution called Redoc - Easily deployable API documentation.  ðŸ˜‡

Redoc Community Edition is a free open-source software.

https://redoc.ly/redoc

Redoc is an open-source tool that generates API documentation from OpenAPI specifications. It’s one of the most powerful free docs tools in the industry, producing clean, customizable documentation with an attractive three-panel design. With support for Markdown, it allows you to write and style descriptions with ease.

By default, Redoc uses a three-panel layout: 

  • The left panel features a search bar and navigation menu.
  • The central panel contains the documentation itself.
  • The Right panel contains request and response samples.

Github - https://github.com/Redocly/redoc

Installing Redoc in under 5 minutes.  

Create a basic html page with default tags and add redoc tag and add the JavaScript reference for redoc.standalone.js

Ex:

<!DOCTYPE html>

<HTML>

    <head>

           <title> API Documentation</title>

     </head>

     <body>

           <redoc spec-url=API-service-v1.0.0.json' lazy-rendering></redoc>             

           <script src="redoc.standalone.js"> </script>

      </body>

</html>

 
Redoc supports OpenAPI (OAS2 and OAS3)

Redoc supports advanced OpenAPI v3 declarations like nested objects, the discriminator, “one of”, “any of”, “all of”, or nullable, and callbacks that aren’t supported properly in competitor tools.

Swagger UI

Swagger UI is the best-known solution for generating API documentation. However, the design is outdated when compared with Redoc.




Conclusion:

Redoc is the best choice and it looks great for the open-source solution also it is easy to implement.


Hope this article helps !!


Thanks for reading this article ! ! please leave your comments and the suggestion about this article. 

February 19, 2021

How to Implement Keycloak authentication in ASP.Net C# MVC

Introduction:

In this article, we will explore, How to implement keycloak authentication for ASP.net Application 


Step 1:

Create a new project/solution of the ASP.NET Web Application project type. When the ASP.NET wizard comes up, select the MVC website template for ASP.NET 4.5, and change the authentication type to No Authentication.

Step 2:

Now right click on the project and choose Manage NuGet Package Manager.

Now update all required packages, and then browse for the following packages:

  • Owin.Security.Keycloak
  • Microsoft.Owin.Host.SystemWeb
  • Microsoft.Owin.Security.Cookies




Step 3:

    Now, Right-click on the project and select Add new item and create a new class called Startup.cs as shown below.



    copy and paste the below code in the newly created class.


    using Microsoft.Owin;

    using Microsoft.Owin.Security;

    using Microsoft.Owin.Security.Cookies;

    using Owin;

    using Owin.Security.Keycloak;

    using System;


    namespace Keycloack_Auth

    {

        public class Startup

        {

            public void ConfigureAuth(IAppBuilder app)

            {

                const string persistentAuthType = "keycloak_auth";

                app.SetDefaultSignInAsAuthenticationType(persistentAuthType);

                app.UseCookieAuthentication(new CookieAuthenticationOptions

                {

                    AuthenticationType = persistentAuthType

                });

                var desc = new AuthenticationDescription();

                desc.AuthenticationType = "keycloak_auth";

                desc.Caption = "keycloak_auth";

                app.UseKeycloakAuthentication(

                    new KeycloakAuthenticationOptions()

                    {

                        Description = desc,

                        Realm = "master",

                        ClientId = "keycloakdemo",

                        ClientSecret = "181cc7df-85f1-427b-81c6-247f20a5fd02",

                        KeycloakUrl = "https://localhost:5000/auth",

                        DisableAudienceValidation = true,

                        AuthenticationType = "keycloak_auth",

                        AllowUnsignedTokens = false,                  

                        DisableIssuerValidation = false,                  

                        TokenClockSkew = TimeSpan.FromSeconds(2)

                    });

            }

        }

    }

    Step 4:

      Open Keycloak URL  and login as admin user. 

      Create a new client for your ASP.net demo application 



      Now Select the credentials tab and copy the secret ID to add to the ASP.net Application.


      Step 5:

      Open the HomeController.cs and add the Authorize attribute for authentication.




      Step 6:

      Build and Run the application !!

      The application will redirect automatically to Keycloak login page for authentication.

      Once authenticated application will show the home page.





      Hope this article helps !!


      Thanks for reading this article ! ! please leave your comments and suggestion about this article.