Posts

What is Spring Boot Initilizr?

Image
Spring Boot Initilizr is a web tool which is provided by Spring on official site using which Spring Boot project can be created by providing project details. It simplifies Spring Applications Development by providing initial project structure and build scripts which reduces development time thus increase productivity. Steps to create Spring Boot project via initilizr ·         Select Maven project and dependencies. Fill other details as shown below and click on generate project. ·         Download the project, extract and now import this project As Maven by using Import option from the STS (Spring Tool Suite) IDE. ·         After finishing, You can see the project structure as shown below: ·      Spring boot generates a Java file in the  src/main/java  directory, pom.xml file with all required dependency. The default created Java ...

Introduction to Spring Boot

Spring Boot is another module provided by Spring Framework which provides RAD (Rapid Application Development) feature to Spring framework. Using boot, we can create standalone Spring based application that you can “just run” in no time and Most Spring Boot applications need very little Spring configuration and it does not require any XML configuration. It uses convention over configuration software design paradigm that means it decrease the effort of developer. Why Spring Boot? As we know Spring framework provides flexibility to configure the beans in multiple ways such as  XML, Annotations  and  JavaConfig. With the number of features increased the complexity also gets increased and configuring Spring applications becomes tedious and error-prone. Spring Boot: ·          Ease the dependency Management , Java-based applications Development, Unit Test and Integration Test Process. Eg: By adding springboot-starte...

Shibboleth Idp with External Authn Configuration

Image
Shibboleth Idp comes with by default various flows like UsernamePassword, Mfa, X509, Kerberos, Spengo and various others flow but today I am going to discuss in details about one more flow which is also provided by Shibboleth Idp itself i.e External Flow Use case: Shibboleth Idp supports external Authn flow using which specific requirement can be fulfilled like your authentication database resides at some other location or some other servlet will do the authentication on the Idp’s behalf like authentication should be done at Facebook or Google side. All such scenario can be easily handled using External Authn flow. Shibboleth team has already created document for the same which you can read it over here . I am writing this document to explain it in more details with example. There are few predefined steps that we need to follow to add new custom flow in Shibboleth Idp as per Shibboleth guidelines. Let’s assume we have to create new flow named “Authn/Custom” in Shibbolet...

Default and Static methods in Java8

Image
Java 8 introduces a new concept of default and static method implementation in interfaces. Before Java 8, interfaces could have only abstract methods but now It allows the interfaces to have methods with implementation without affecting the classes that implement the interface and provides backward comparability so that existing interfaces can use the lambda expressions without implementing the methods in the implementation class. Eg: Now List or Collection has forEach method declaration which is only possible because of default declaration.  Default Method: The default methods are also known as   defender methods   or   virtual extension methods and are defined inside the interface and tagged with default. These methods are non-abstract methods. What about Multiple Inheritance? As we know adding method definitions in interfaces can add ambiguity in multiple Inheritance and if a java class implement multiple ...

Mocking in Java using Mockito

Image
Before talking about Mockito Framework. Let’s see why do we need it at the first place and how it can be helpful. Last year, I was working on one project which talks to other third party services as well as with the database connection and to test the functionality of my application, third party application should be up and running. There can be a chance where all these services might not available during unit testing. As you can see, your application is completely dependent on other application and what if: Third party application is down              You cannot connect to database to test your functionality At such situation, mocking becomes a natural solution for unit testing. Using Mockito, you don’t really need a database connection. You just need a mock object that returns the expected result. Mockito: Introduction Mockito is a mocking framework, the JAVA-based library that is used for effective unit tes...

OAuth vs SSO: Which One Should I Use?

Image
Currently, I am working on one project which provided me a lot of opportunities to learn about OAuth 2.0 and SAML and better understanding on which one to choose for SSO strategy. I am choosing this topic because most of the people get confused between these two. While they have some similarities but they are very different too and to put it one line. I would say “OAuth is not Single Sign-On” What is the difference between OAuth 2.0 and SSO? OAuth (Open Authorization) is a standard for authorization of resources. It does not deal with authentication. It allows secure authorization in a simple and standard method from web, mobile and desktop applications. If you try to log into Stack Overflow using Facebook, you’ll be redirected to Facebook’s website and will see something like the following: Once authenticated with Facebook, it will ask for Stack Overflow’s permission to access your resources l ike your name, Email id, Profile picture and so on. This is an authoriz...

Set up Shibboleth SP as a SAML 2.0 service provider with G Suite

Prerequisite: Basic understanding of SAML 2.0, SSO and Shibboleth SP.   SP setup up and working on your instance. Must having administrator account to register your SP on G suite G Suite setup: Login to  https://admin.google.com  using your administrator account. Click  Security > Set up single sign-on (SSO) Click the  Download  button to download the Google IdP metadata and the X.509 Certificate Now click on  Apps > SAML apps . Select the  Add a service/App to your domain  link or click the plus (+) icon in the bottom corner. The  Enable SSO for SAML Application  window opens. Click  SET UP MY OWN CUSTOM APP We have already downloaded the certificate and Idp Metadata, click  NEXT On the Basic application information window, Enter the  Application name  and Description values. In the Service Provider Details section, enter the following URLs into the  Entity ID, ACS URL , and...