Learning Outcome
5
Differentiate Agile from traditional models
4
Understand the 12 Agile Principles
3
Describe the 4 values of the Agile Manifesto
2
Explain why Agile was introduced
1
Understand the concept of Testing in Agile environment
Introduction to Springboot security
Spring Security is the de facto standard framework for securing Spring-based applications. While Spring Boot makes building applications easy, Spring Security ensures those applications are safe from unauthorized access and malicious attacks.
Under the hood, it operates as a chain of customized Servlet Filters that intercept incoming HTTP requests before they ever reach your controllers. This allows it to check credentials and permissions at the very edge of your application.
Core Concepts (.....Slide N-3)
Core Concepts (.....Slide N-3)
Security in any application boils down to two distinct but deeply connected concepts. Note: A common interview mistake is confusing these two!
1. Authentication (Who are you?) Authentication is the process of verifying a user's identity.
The Analogy: Showing your passport at the airport border control.
How it works: A user provides credentials (like a username and password, a fingerprint, or an API token). Spring Security checks these against a user store (like a database or an LDAP server).
HTTP Status: If this fails, the application returns a 401 Unauthorized status.
2. Authorization (What are you allowed to do?) Authorization happens after you have been authenticated. It determines whether your specific identity has the permissions required to access a specific resource.
The Analogy: Your passport got you into the airport, but your boarding pass determines if you are allowed to enter the First Class Lounge.
How it works: Spring checks your assigned "Roles" (e.g., ROLE_ADMIN, ROLE_USER) or "Authorities" (e.g., READ_PRIVILEGES) against the rules defined for that specific URL or method.
HTTP Status: If you are logged in but try to access an area you shouldn't, the application returns a 403 Forbidden status.
Core Concepts (.....Slide N-3)
1. Secure Endpoints Automatically One of the best features of using Spring Security with Spring Boot is "Secure by Default" auto-configuration. The moment you add the spring-boot-starter-security dependency to your project, every single API endpoint is locked down, requiring authentication, without you having to write a single line of code.
2. Supports Multiple Authentication Methods Modern applications need different ways to log people in. Spring Security seamlessly supports:
Form Login: The traditional approach where a user types credentials into an HTML webpage. It uses stateful sessions stored on the server via cookies.
HTTP Basic: A simpler method mostly used for internal tools or legacy APIs, where credentials are sent in the HTTP header of every request (encoded in Base64).
JWT (JSON Web Tokens) / OAuth2: The modern standard for mobile apps and REST APIs. It uses stateless tokens, allowing users to log in via third-party providers (like "Sign in with Google" or GitHub).
3. Built-in Protection Against Common Exploits Spring Security doesn't just manage logins; it acts as a shield against common web vulnerabilities defined by OWASP:
CSRF (Cross-Site Request Forgery): Prevents malicious websites from tricking a user's browser into executing unwanted actions on your site while they are logged in. Spring handles this by issuing and validating secure, unpredictable tokens for state-changing requests.
Session Fixation: A hijacking technique where an attacker tricks a user into using a specific session ID. Spring defeats this by automatically generating a brand-new session ID the moment a user successfully logs in.
4. Highly Customizable While it is highly secure by default, Spring Security is incredibly flexible. Developers can override almost any default behavior by defining a modern, component-based SecurityFilterChain. You can write custom logic to fetch users from external APIs, create highly specific role hierarchies, or filter out malicious IP addresses.
Springboot Architecture for Security
Client sends a request to the server
Springboot Architecture for Security
Client sends a request to the server
Two important layers are involved in processing the request.
Servlet API
Spring Application Context
The Role Of Servlet API
Servlet API
The Gateway: Listens for incoming HTTP web requests from the browser.
The Translator: Converts raw network data (headers, URLs, payloads) into usable Java objects.
The Router: Directs the request to the correct application logic (like Spring Controllers).
The Responder: Packages the final processed data back into an outgoing HTTP response (JSON, HTML).
The Managed Tracker: Runs entirely inside Tomcat (which handles its lifecycle) while keeping track of user sessions and logins across multiple clicks.
The Role of the Application Context
Spring Application Context
The Factory: Creates, configures, and holds all your core Java objects (known as "Beans") in memory.
The Matchmaker: Automatically wires different parts of your application together (Dependency Injection), so classes don't have to create their own dependencies.
The Vault: Stores and provides access to all your application configurations, properties, and environment variables.
The Broadcaster: Provides an event system, allowing disconnected parts of your app to publish and listen to custom application events.
The Caretaker: Manages the complete lifecycle of your Beans, triggering specific logic when they are created (@PostConstruct) and before they are destroyed (@PreDestroy).
The Heart of Spring: It acts as the central container running the show behind the scenes. While the Servlet handles the web traffic, the Context runs your actual business logic.
Coming back to Request flow
Servlet API
Spring Application Context
Servlet API manages the request lifecycle and executes a chain of servlet filters.
Summary
5
Build strong branding
4
Use different marketing channels
3
Target the right audience
2
Create and communicate value
1
Understand customer needs
Quiz
Which platform is mainly used for professional networking and B2B marketing ?
A. Facebook
B. Instagram
C. LinkedIn
D. Snapchat
Quiz-Answer
Which platform is mainly used for professional networking and B2B marketing ?
A. Facebook
B. Instagram
C. LinkedIn
D. Snapchat