Retrieve environment values present in file

In previous posts under DotEnv, whenever we called static “load” method on “DotEnv” class it used to load system environment values in addition to environmentvalues present in .env or .env file with custom name. What if we want only the environment values present in the file and not the system environment values. There is way…… Continue reading Retrieve environment values present in file

Accessing an non existing environment key

In this post under DotEnv, I will show with example how to handle retrieving values of environment keys that doesn’t exist. Below is the main class for your reference. Main class 1 package defaultPackage;2 3 import io.github.cdimascio.dotenv.Dotenv;4 5 public class Example6 {6 public static void main(String[] args) {7 Dotenv dotenv = Dotenv.load();8 String value =…… Continue reading Accessing an non existing environment key

Changing scopes to @Component annotated class

In this post under Spring Core, I will show with example how to change the scope of class annotated with “@Component” annotation. By default whenever we annotate a class with “@Component” annotation the scope of the bean is set to “singleton”. We can change this by the help of “@Scope” annotation which is also applied…… Continue reading Changing scopes to @Component annotated class

Changing the algorithm when generating hotp

In previous post, I showed with example how to generate an HOTP. I also mentioned in my previous post, how the framework by default using SHA-1 algorithm to generate the otp. I this post under OTP, I will show with example how to change the default algorithm. Below is the code for your reference. Main…… Continue reading Changing the algorithm when generating hotp

Generating HOTP example

In this post I will show with example how to generate HOTP. I will be using open source otp framework written by “BastiaanJansen” using Java programming language. Below is the link to the GitHub project https://github.com/BastiaanJansen/otp-java HOTP is generated using two input parameters1) a secret2) a counter Below is the main method that shows how…… Continue reading Generating HOTP example