Skip to main content

Posts

Showing posts from August, 2023

Aspect-Oriented Programming

  In the context of Spring Framework, AOP is used to separate these cross-cutting concerns from the main business logic of your application, leading to cleaner and more maintainable code. Spring provides a powerful AOP framework that enables you to define and manage aspects, which are modules that encapsulate these cross-cutting concerns. Here's how AOP works in Spring: Aspect : An aspect is a module that encapsulates a cross-cutting concern. It defines what should happen at a particular point (called a "joinpoint") in your application's execution. Aspects are defined using regular Java classes and annotations. Joinpoint : A joinpoint is a specific point in your application's execution, such as a method call or an exception being thrown. Aspects are applied to these joinpoints to carry out specific actions. Advice : An advice is the actual action that an aspect takes at a specific joinpoint. There are different types of advice, such as "before," "af...

How OAuth 2.0 works? Explained with example

 Subjects involve in this example. 1. ChatGPT (The Client) 2. Gmail account owner (Resource owner) 3. Gmail (Authenticator) OAuth 2.0  has three main phases. They are: Requesting an Authorization Grant Exchanging the Authorization Grant for an Access Token  Accessing the resources using the obtained Access Token OAuth 2.0 is a protocol that allows a user (resource owner) to grant limited access to their resources (like their Gmail account) to another application (client), without giving away their actual credentials (username and password). Instead of sharing your Gmail password with the client, OAuth 2.0 provides a safer way to let the client access your Gmail data. Here's how the flow would work between you (resource owner), ChatGPT (client), and Gmail (authentication point): Step 1: Registration ChatGPT (the client) is registered with Gmail's OAuth system. This involves ChatGPT providing its own information (like a name, website, and a redirect URL) to Gmail so tha...

Fixing the macOs command issue

Fixing the macOs command issue 1. Permission denied when running a script file dheeraj.kumar@LT-0623-011 bin % ./startup.sh zsh: permission denied: ./startup.sh execute your command by prefixing it with chmod +x dheeraj.kumar@LT-0623-011 bin % chmod +x ./startup.sh dheeraj.kumar@LT-0623-011 bin % ./startup.sh Using CATALINA_BASE:   /Users/dheeraj.kumar/Downloads/apache-tomcat-8.5.92 Using CATALINA_HOME:   /Users/dheeraj.kumar/Downloads/apache-tomcat-8.5.92 Using CATALINA_TMPDIR: /Users/dheeraj.kumar/Downloads/apache-tomcat-8.5.92/temp Using JRE_HOME:         /Library/Java/JavaVirtualMachines/jdk-1.8.jdk/Contents/Home Using CLASSPATH:       /Users/dheeraj.kumar/Downloads/apache-tomcat-8.5.92/bin/bootstrap.jar:/Users/dheeraj.kumar/Downloads/apache-tomcat-8.5.92/bin/tomcat-juli.jar Using CATALINA_OPTS:     Tomcat started. 2. Command Not Found dheeraj.kumar@LT-0623-011 bin % sudo ./startup.sh Password: sudo: ./startup.sh: command not fo...