TechBooky AI Assistant
TechBooky AI Assistant
👋 Welcome to TechBooky AI Assistant

I can help with:
🔎 Tech News
🤖 AI Topics
💻 Gadgets
☁️ Cloud
✍️ Guest Posts
📢 Advertising
🔗 Backlinks
📩 Newsletter
  • AI Search
  • Cryptocurrency
  • Earnings
  • Enterprise
  • About TechBooky
  • Submit Article
  • Advertise Here
  • Contact Us
TechBooky
  • African
  • AI
  • Metaverse
  • Gadgets
Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages
  • African
  • AI
  • Metaverse
  • Gadgets
Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages
TechBooky
Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages
Home Programming

Understanding The Spring Security Architecture

Contributor by Contributor
September 23, 2019
in Programming
Share on FacebookShare on Twitter

Developed since Ben Alex and team in 2003, Spring Security is a framework that helps provide authorization and authentication to Java applications. The official release date of stable Spring Security was April 2008. With 3.9k stars and 3.3k for Github, its popularity is amply self-explanatory.

However, before you dive deep into the intricacies of Spring Security framework, you need to understand the basics of the same. Since the main job of Spring Security is to secure web applications that is what we’re going to focus on throughout this article. Also, we assume you are aware of Spring Boot before jumping to Spring Security as it provides for a default stage to work with. Nevertheless, all principles discussed herein will apply to applications not built using Spring Boot as well.

 

Runtime Environment for Spring Security

As per the existing Spring Security architecture, Java 5.0 or higher is needed to run Spring Security successfully. The great part about this is that one need not include any special files in their Java Runtime Environments. Spring is a very self-contained framework and hence you need not put the Spring Security folders in any specific classpath locations. While this sounds super cool, how does the fact that all your files will be contained in the application itself (EJB) sound? That’s right, while running an EJB container you need not conjure up special files or configuration files in a server classloader.

Copy your JAR, WAR, EAR directly from one computer to another and it will work perfectly fine, thanks to the incredible architecture of Spring Security.

 

Building Blocks of Spring Security

Spring Security is mainly built upon:

  • SecurityContextHolder, an object that uses ThreadLocal to store the security context of a process. It provides access to SecurityContext.
  • SecurityContext which holds the object Authentication. It requests for the metadata and security information of the object.
  • Authentication represents the principle requesting for access.
  • GrantedAuthority which holds information regarding what permission is granted to whom throughout the application.
  • UserDetails which holds information to build up Authentication.
  • Pass a String to it and it will make a UserDetail which will, in turn, help generate an Authentication object.

 

Authentication and Authorization

A basic application security problem is primarily about who has the access to information and what is he allowed to do with it? The latter is the authentication problem while the former refers to the authorization problem. Spring Security is a great tool to separate both these problems and tackle them efficiently. 

Authentication

Authentication has one main interface: AuthenticationManager which has just one method: authenticate. It can do three things: return a bool authentication value, throw an exception if there is an invalid value detected, as well as return a null when it encounters ambiguity.

Here’s what a standard authentication scenario looks like:

  • A login screen is displayed asking for username and password.
  • A system in place recognizes successfully if the password for the given username is correct.
  • List of roles and permissions for the user is obtained.
  • A security context is established.
  • The user proceeds towards performing tasks once validated. Then comes the role of access specifiers and the system moves on to the process of authorization.

There are a number of classes, interfaces and instances that make this happen. The main ones are UserPasswordAuthenticationToken, AuthenticationManager, Authentication, and SecurityContextHolder. SecurityContextHolder.getContext().setAuthentication(…​) is the method used for step number four.

Authorization

Sometimes, authorization is also known as access control. The ring leader here is AccessDecisionManager. The method ‘decide’ takes the object requesting access and assesses its metadata and decides whether or not a particular action can be performed by the object. 

This is how a web app authorization process looks like:

  • The user clicks on a link on the home page.
  • Request is sent to the server who realizes the user is requesting for a protected piece of information/resource.
  • The server sends back the message that you must authenticate. This means the server will probably redirect you to a webpage. If your browser authenticates you via cookies, it’s a different story.
  • The browser will send back your authentication information to the server.
  • The server will make sure that your credentials are right. If not, access will be denied.
  • Now, you will be either allowed to access the resource or will be served with a “403: Forbidden” HTTP error code.

Note: The three main classes to carry out the above steps are ExecptionTranslationFilter, AuthenticationEntryPoint, and AuthenitcationManager.

 

Closing Thoughts

Spring Security is a comprehensive framework with a solid architecture that allows you to integrate Servlet APIs. It is a great choice for Java applications. To put it simply for millennials who began their careers with Python instead of Java, Spring Security does what Django does for your Python application and more. OAuth2, OpenSSL, Let’s Encrypt, and Auth0 are other frameworks out there in the market attempting to do what Spring Security does.

Companies like Monkey Exchange, Debut, Monbanquet, AfricanStock, ZapLabs, OfferPointer, Mubasher.info, Site, Insoft and so many more make use of Spring Security in their technology Stack. And thanks to its open source status, if you’re getting started with Spring Security you have over twenty thousand answered questions on Stackoverflow waiting to assist you.

 

About author: Professionals of Java Development in India have shared this article to brief you about Understanding the Spring Security Architecture.

Related Posts:

  • newFile-4
    Dorsey Says Bitchat Software Lacks Security Review
  • updated_blog_hero_image__1.width-1200.format-webp
    Google TV Adds Gemini Tab, Richer Visuals and Sports Briefs
  • skynews-google-chrome-logo_6753346
    Google Chrome To Debut Support for ARM64 Linux This Spring
  • zwZByeKjWvA4Lpia2d5wee-1200-80
    Apple's AI Strategy Faces Investor Scepticism as…
  • OpenClaw moltbot AI assistant
    OpenClaw’s Viral Rise Exposes Security Risks in Agentic AI
  • apple-and-google-featured-image
    Apple Intelligence and Google Gemini Integration Is…
  • android
    Google Patches 107 Flaws Including 2 Android Zero-Days
  • deepkeep
    New CLI Tool Exposes Blind Spot in AI Agent Security…

Discover more from TechBooky

Subscribe to get the latest posts sent to your email.

Tags: AuthenticationjavaprogrammingsecuritySpring SecuritySpring Security Architecturetech tips
Contributor

Contributor

Posts by contributors. You can send in a post to be reviewed and published to info@techbooky.com

BROWSE BY CATEGORIES

Receive top tech news directly in your inbox

subscription from
Loading

Freshly Squeezed

  • Elon Musk Hits $1.1 Trillion as SpaceX Surpasses $2 Trillion Valuation June 13, 2026
  • SpaceX Prices Record $75 Billion IPO as Elon Musk Nears Trillionaire Status June 12, 2026
  • DoorDash Launches AI Chatbot for Food Orders June 12, 2026
  • Pool Launches App That Makes Screenshots More Useful June 12, 2026
  • Deezer Launches Tool to Detect AI-Generated Music June 12, 2026
  • Coinbase Introduces Platform for Agents to Trade Assets and Buy Premium Insights June 12, 2026
  • Meta Expands Edits App With AI Features and Desktop Access June 12, 2026
  • Ready-made LMS and custom development. Pros and cons of each path. June 11, 2026
  • TELCOs Pay 75 Million Users For Poor Network Service June 10, 2026
  • Anthropic Launches Claude Fable 5, Bringing Mythos-Class AI to the Public June 10, 2026
  • Discord Data Breach Reportedly Impacts Over 10 Million Users June 10, 2026
  • TikTok Removed Four Million Videos & Disrupted 86,000 LIVE Sessions In Nigeria June 10, 2026

Browse Archives

June 2026
MTWTFSS
1234567
891011121314
15161718192021
22232425262728
2930 
« May    

Quick Links

  • About TechBooky
  • Advertise Here
  • Contact us
  • Submit Article
  • Privacy Policy
Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages
  • African
  • Artificial Intelligence
  • Gadgets
  • Metaverse
  • Tips
  • AI Search
  • About TechBooky
  • Advertise Here
  • Submit Article
  • Contact us

© 2025 Designed By TechBooky Elite

Discover more from TechBooky

Subscribe now to keep reading and get access to the full archive.

Continue reading

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.