This article compares SSO and OAuth 2.0, detailing the CAS-based SSO authentication flow, OAuth 2.0's four grant types (authorization code, implicit, password, client credentials), and clarifies how OAuth 2.0 can implement SSO while distinguishing both from security frameworks like Spring Security and Shiro.
Authorization Code GrantCASClient Credentials Grant
The article explains CountDownLatch's implementation as a thin wrapper over AQS, detailing how it overrides tryAcquireShared and tryReleaseShared with CAS for thread-safe countdown, and teaches a high-level-to-detail interview answering strategy.
This article explains how the JVM handles threads that fail to acquire a synchronized lock, detailing the three-tier upgrade from lightweight CAS-based spinning to adaptive ObjectMonitor spinning and finally OS-level blocking, with Java 17's simplified lock states and Mark Word transitions.
This article explains how to implement Single Sign-On (SSO) using CAS to unify authentication across multiple company systems, covering session mechanics, cluster session sharing with Redis, and providing complete Spring Boot code examples for both the CAS server and client applications.
This article provides a line-by-line analysis of Java's AbstractQueuedSynchronizer (AQS), covering its CLH variant queue, CAS-based state management, exclusive and shared synchronization modes, Condition implementation, and core design decisions like CLH vs MCS and volatile vs synchronized.
This article demystifies Java's Compare‑And‑Swap (CAS) instruction, shows how atomic classes like AtomicInteger achieve lock‑free increments, discusses CAS's three main drawbacks, surveys the entire java.util.concurrent.atomic family, and explains how LongAdder improves high‑contention counting.
The article explains why traditional session mechanisms break in clustered and multi‑service environments, compares session replication and centralized storage, introduces CAS‑based single sign‑on with ticket flow, contrasts it with OAuth2, and provides a complete Spring‑Boot demo with Redis‑backed session handling.
This article presents a detailed technical blueprint for building an enterprise‑grade single sign‑on system that combines Apereo CAS, OAuth2, and JWT across four microservices, covering service responsibilities, data models, API contracts, deployment trade‑offs, and operational safeguards.
When a company’s internal tools each required separate logins, the team built an enterprise‑grade CAS single sign‑on system that unified identity, login entry, logout handling, and extensible integration, and they document the entire process across nine detailed articles.
The article explains that locks are not the root cause of performance bottlenecks, examines how locked and lock‑free queues work, compares their trade‑offs with concrete benchmarks, and provides a decision guide to choose the right queue implementation for different concurrency and latency requirements.
When a service’s QPS jumps from two to eight million, a single global lock can turn a multi‑core machine into a bottleneck, so the article walks through coarse‑lock problems, fine‑grained locking, read‑write separation, optimistic reads, CAS‑based lock‑free techniques, LongAdder and advanced data structures, showing when each step is appropriate for high‑throughput systems.
This article walks through ten essential Java concurrency interview topics—including the Java Memory Model, volatile semantics, synchronized lock upgrades, CAS pitfalls, AQS internals, ReentrantLock versus synchronized, ThreadPoolExecutor parameters, ThreadLocal memory‑leak issues, CountDownLatch vs CyclicBarrier, and deadlock conditions—providing code snippets, tables and detailed explanations to help candidates answer interview questions confidently.
This article examines the challenges of managing user authentication across many corporate systems, explains traditional session mechanisms, explores session sharing solutions for clustered environments, and provides a detailed walkthrough of implementing single sign‑on using CAS with Java and Redis, including code samples and a comparison with OAuth2.
This article explains Java's volatile and CAS primitives, detailing volatile's visibility and ordering guarantees, the memory barriers the JVM inserts, CAS's atomic compare‑and‑swap operation, common pitfalls like the ABA problem, and how their combination enables lock‑free thread safety, with code examples and interview tips.
This article explains Single Sign-On (SSO) fundamentals, detailing its three core components—CAS Server, CAS Client, and Browser—illustrating the overall architecture and walking through the complete authentication flow from accessing a service to ticket validation.
The article examines the challenges of multiple corporate systems requiring separate logins, explains traditional session mechanisms and their limitations in clustered environments, compares session replication versus centralized storage, and presents a complete Java Spring implementation of CAS‑based single sign‑on with code samples and a discussion of differences from OAuth2.
This article demystifies lock‑free queues by explaining their low‑level implementation, atomic operations, memory barriers, and the four SPSC/MPMC models, while also covering ABA problems, false sharing avoidance, and practical C++ code examples to help developers truly understand high‑concurrency fundamentals.
This article explains the core concepts of Single Sign‑On (SSO), detailing the roles of the CAS Server, CAS Client, and browser, and walks through the complete authentication flow with diagrams, illustrating how a single login grants access to multiple systems.
This article explains three core Single Sign-On architectures—same‑domain cookie/session, distributed token‑based (JWT/OAuth2), and Central Authentication Service—detailing their workflows, advantages, drawbacks, and ideal use cases, helping architects choose the right SSO solution for web, mobile, and micro‑service environments.
Single Sign-On (SSO) lets users authenticate once and automatically gain access to all trusted applications, eliminating repeated logins and streamlining user experience across heterogeneous systems such as e‑commerce, payment, and collaboration platforms.
This article explains the fundamentals of Single Sign-On (SSO), detailing its centralized authentication principle, the roles of CAS Server, CAS Client, and browser, and walks through the complete login flow with diagrams and code snippets for distributed systems.
This article explains the fundamentals of Single Sign-On (SSO), describing its purpose of simplifying user authentication across multiple services, the core components such as CAS Server, CAS Client, and the browser, and walks through the step‑by‑step authentication flow with illustrative diagrams.
This article dives deep into Go’s sync/atomic package, explaining its low‑level CPU implementation, performance advantages over mutexes, core operation families, practical examples like CAS‑based spin locks and atomic.Value hot‑reloading, and provides guidance on when to choose atomic primitives.
This article explains the concepts of Single Sign‑On (SSO) and the Central Authentication Service (CAS), then provides a detailed, code‑rich tutorial for setting up a CAS server, configuring clients, disabling HTTPS for development, and testing the end‑to‑end SSO workflow using Java and Spring.
Lock‑free queues replace costly mutexes with atomic operations, eliminating lock contention, deadlocks, and scalability limits, and this article explains their principles, classic implementations, C++ code examples, performance testing, and real‑world applications such as game engines and high‑throughput servers.
This article compares Single Sign‑On (SSO) and OAuth2.0, detailing their conceptual distinctions, token‑based workflows, implementation frameworks like CAS, the four OAuth2.0 grant types, and how each can be used to achieve seamless authentication across applications.
This article explains traditional session mechanisms, the challenges of session handling in clustered environments, explores session sharing strategies, introduces single sign‑on concepts, compares CAS and OAuth2, and provides complete Java code examples for implementing SSO with Redis.
This article explores the JVM bytecode instructions behind Java’s synchronized keyword and CAS mechanism, detailing monitorenter/monitorexit, ACC_SYNCHRONIZED flags, static synchronization, and the underlying Unsafe.compareAndSetInt implementation with example code and analysis.
This article explains why multiple independent login systems hurt user experience and security, reviews traditional session mechanisms and their limitations in clustered environments, and then presents two session‑sharing strategies and a complete CAS‑based SSO solution with Java code examples.
This article explains the principles, advantages, and drawbacks of CAS, LongAdder, and AtomicLong in Java, illustrating why Alibaba recommends LongAdder for high‑concurrency counter scenarios, how the ABA problem arises, and how AtomicStampedReference can mitigate it.
This article explains the fundamentals of Single Sign-On (SSO), detailing its cross‑system authentication mechanism, core components such as CAS Server, CAS Client, and User Agent, and walks through the step‑by‑step flow that enables users to log in once and access multiple trusted applications seamlessly.
This article provides an in‑depth analysis of the Java ConcurrentHashMap implementation, covering its constructor logic, hash‑table sizing, the core put and get operations, element counting with addCount, multi‑threaded resizing via transfer, treeification of bins, removal, computeIfAbsent, and the design choices that forbid null keys and values to simplify concurrency handling.
This article explains the principles, advantages, and drawbacks of Java's AtomicLong and LongAdder counters, describes the CAS operation and its ABA problem, and analyzes why Alibaba recommends LongAdder for high‑concurrency, high‑availability scenarios in distributed systems.
This article uses real‑world analogies to dissect the three core challenges of Java concurrency—ordering, visibility, and atomicity—and explains how hardware instructions, JVM mechanisms, and Java SDK tools such as locks, CAS, and waiting/notification utilities provide efficient solutions.
The article explains the Java Memory Model and its core concepts of visibility, atomicity, and ordering, detailing how volatile, synchronized, and final keywords work, the impact of CPU cache and instruction reordering, and low‑level mechanisms such as lock, cmpxchg, and false sharing.
In high‑concurrency Java applications, LongAdder—introduced in JDK 8 and using partitioned cells to reduce contention—generally outperforms the single‑value AtomicLong, which relies on CAS and can cause CPU waste under heavy load, so Alibaba advises LongAdder for scalable distributed counters, though memory usage and workload specifics must be considered.
Pointer collision is an efficient memory allocation technique that can trigger severe concurrency problems in multithreaded Java environments, and this article explains the underlying causes, illustrates conflict scenarios, and presents common remedies such as CAS (Compare‑And‑Swap) and TLAB (Thread‑Local Allocation Buffer) with sample code.
This article explains the principles of CAS, compares Java's AtomicLong and LongAdder counters, highlights the ABA problem, and shows why Alibaba recommends LongAdder for high‑concurrency scenarios due to its segmented lock design, better performance, scalability, and ease of use.
This article explains the principles of optimistic and pessimistic locking in Java, shows how atomic classes and synchronized constructs implement them, provides runnable code examples, and compares their strategies, scenarios, performance, and typical implementations.
This article explains the classic ABA issue in Java's Compare‑And‑Swap (CAS) operations, outlines why long spin loops and single‑variable limitations can degrade performance, and presents practical solutions such as AtomicStampedReference, LockSupport, ReentrantLock, and optimized data structures to mitigate these challenges.
This article explains the limitations of traditional HTTP session handling, explores session sharing strategies for clustered environments, and demonstrates how to build a single sign‑on solution using CAS and OAuth2 concepts with complete Java code examples for filters, controllers, and login pages.
This article examines typical high‑concurrency scenarios such as payment processing, online ordering, and cross‑bank transfers, introduces the Compare‑and‑Swap (CAS) approach to ensure strong consistency, explains the ABA problem it can cause, and presents application‑level and data‑layer strategies—including versioning and SQL examples—to mitigate it.
This article explains traditional session mechanisms, challenges in clustered environments, and presents solutions such as session replication and centralized storage, then details the design and implementation of a CAS-based Single Sign-On system in Java, including code for user forms, controllers, filters, and configuration.
This article provides a comprehensive guide to Java atomic variables, explaining their core concepts, underlying CAS mechanism, key classes such as AtomicInteger, AtomicLong, AtomicReference, and AtomicBoolean, and demonstrating practical code examples, use‑cases, performance benefits, limitations, and comparisons with traditional lock‑based synchronization.
This article explains the challenges of multiple product logins, reviews traditional session mechanisms, discusses session sharing solutions in clustered environments, and presents a CAS‑based single sign‑on implementation with Java code examples, highlighting differences between CAS and OAuth2 for secure authentication.
This article explores how various unique identifier schemes—random UUIDs, sequential numbers, hierarchical paths, and distributed ID generators—are applied across programming languages, file systems, databases, and networks, and explains when and how to enforce uniqueness using pre‑validation, database constraints, or distributed locks such as Redis and Zookeeper, while also linking these mechanisms to CAS‑based concurrency control.
This comprehensive guide walks you through Shiro's core concepts, authentication and authorization mechanisms, various realm implementations, session management, distributed session handling with Redis, caching strategies, and step‑by‑step integration of CAS single sign‑on using SpringBoot and pac4j, complete with code samples.
This article explains the concept, definitions, and three deployment types of Single Sign-On (SSO), introduces the Central Authentication Service (CAS) mechanism, and details step‑by‑step login and logout processes across multiple web applications, illustrating each flow with diagrams and examples.
This article explains the principles and implementation of Java's Compare-and-Swap (CAS) and AbstractQueuedSynchronizer (AQS), illustrating how CAS enables lock‑free algorithms and how AQS underpins high‑level synchronization constructs like ReentrantLock and CountDownLatch, while also providing practical step‑by‑step examples.
This article explores the challenges of maintaining data consistency under high concurrency in distributed systems, reviewing common consistency issues, distributed lock implementations, optimistic and pessimistic strategies, CAS and ABA problems, and practical solutions such as Redis locks, Zookeeper, and transaction protocols.
This article explains the Java volatile keyword, covering its underlying principles, effects on visibility and instruction reordering, appropriate usage scenarios, limitations, and provides a practical code example demonstrating how volatile ensures thread visibility and prevents dead loops in multithreaded programs.
This article explains the Central Authentication Service (CAS) single sign‑on system, detailing its token‑based architecture, the roles of the CAS server, client, and protected services, and outlines typical scenarios such as e‑commerce, enterprise intranets, online platforms, and cloud services.
This article explains the fundamentals of Single Sign-On (SSO), why it is needed in distributed systems, details the components and workflow of the CAS (Central Authentication Service) implementation, and outlines common application scenarios such as e‑commerce, enterprise portals, education, and finance.
This article walks through the fundamentals of HTTP session handling, the challenges of session sharing in clustered environments, and presents a step‑by‑step design of a Single Sign‑On solution using CAS, including concrete code examples, Redis‑based session storage, and a comparison with OAuth2.
Single Sign-On (SSO) lets users log in once to access multiple trusted applications, and this article explains its necessity, core components like CAS Server, Client, and Service, the authentication flow, and common use cases in e‑commerce, enterprises, education, and finance.
This article explains the problems of traditional session management in multi‑service environments, introduces session replication and centralized storage (using Redis), and demonstrates a complete CAS‑based single sign‑on solution with Java code examples for user, controller, filter, and configuration components.
This article explains the concept of optimistic locking in concurrent programming, details four common implementation approaches—version number, timestamp, CAS, and serial number—their underlying mechanisms, and outlines typical scenarios where optimistic locks improve data consistency and performance.
This article explains what optimistic locking is, why it matters for concurrent Java applications, and details four implementation methods—version numbers, timestamps, CAS, and sequence numbers—along with their principles, usage scenarios, and practical considerations for high‑performance, distributed systems.
The article explains why multiple independent systems hurt user experience, reviews traditional session and cookie based authentication, discusses session sharing problems in clustered environments, and presents centralized Redis storage and CAS‑based single sign‑on solutions with code examples and a comparison to OAuth2.
This article explains the fundamentals of Single Sign‑On (SSO) and OAuth2.0, compares their token‑based authentication mechanisms, details typical implementation flows such as CAS, and clarifies the distinctions among SSO, OAuth2, JWT, Spring Security and Shiro, while also noting related promotional content.
This article explains how Java achieves lock‑free concurrency using CAS and volatile for optimistic locking, discusses its advantages and drawbacks such as the ABA problem and contention hotspots, and presents solutions including versioned CAS classes and contention‑reduction techniques provided by the JUC package.
The article explains Vitess's approach to generating globally unique identifiers by using dedicated sequence tables, details the underlying MySQL schema and Go implementation, and compares it with VtDriver's CAS‑based method, highlighting trade‑offs between transaction locks and lock‑free updates.
This article reviews the shortcomings of simple cookie‑based single sign‑on, introduces a unified authentication center architecture, explains the Central Authentication Service (CAS) design and its deployment, and walks through the complete login process—including first, second, and cross‑domain accesses—highlighting key tickets, filters, and session handling.
The article explains how the Java Memory Model addresses concurrency challenges by defining visibility, ordering, and atomicity guarantees through mechanisms such as volatile, synchronized, cache coherence, memory barriers, CAS operations, and happens‑before relationships, enabling correct and portable multi‑threaded programming.
This article explains the concepts, architecture, core tickets, and practical implementation steps of CAS-based Single Sign-On, including detailed API specifications, security considerations, and example code snippets for integrating SSO across multiple applications.
This article explains why Redis offers transactions, introduces the five core transaction commands, demonstrates practical examples including WATCH and CAS optimistic locking, and discusses error handling and the reasons Redis does not support rollback.
This article explains the concept, benefits, and inner workings of CAS optimistic locks in Java, illustrating how Compare‑And‑Swap enables lock‑free synchronization and providing a practical AtomicInteger counter example to demonstrate atomic increments without traditional locking.
This article explains the concepts, workflows, and key differences between Single Sign‑On (SSO) and OAuth2.0, illustrating how token‑based authentication replaces passwords, detailing typical CAS‑based SSO steps, OAuth2.0 authorization‑code flow, and clarifying related terminology and grant types.
This article explains the concept, background, and definition of Single Sign‑On (SSO), outlines three SSO deployment types, introduces the Central Authentication Service (CAS) with detailed ticket mechanisms, and provides step‑by‑step SSO and Single Logout (SLO) processes for multiple applications.
This article explains the concepts of optimistic and pessimistic locking, the CAS mechanism and its ABA issue, and demonstrates Java implementations such as AtomicInteger, AtomicStampedReference, ReentrantReadWriteLock, and various lock types with practical code examples.
This article explains what a spinlock is, outlines its advantages and disadvantages, describes suitable usage scenarios, and provides a detailed Java implementation using CAS, including code examples and an explanation of the underlying CAS algorithm.
This article analyzes the limitations of traditional HTTP session mechanisms in single‑server and clustered environments, explains why session sharing is essential for multi‑system products, and presents practical solutions such as session replication and centralized Redis storage, followed by a detailed walkthrough of CAS‑based single sign‑on implementation with Java Spring code examples and a comparison to OAuth2.
This article provides a step‑by‑step guide for building a CAS server and client with Spring Boot, covering WAR deployment, configuration file adjustments, custom authentication redirect strategies, CORS setup, and troubleshooting ticket validation and cross‑origin issues.
This article explains the principles of Single Sign‑On (SSO) and OAuth2.0, compares their workflows, describes common implementation patterns such as CAS and token‑based authentication, and clarifies the distinctions between SSO, OAuth2.0, and related security frameworks.
This article provides a comprehensive tutorial on implementing Single Sign-On using the Central Authentication Service (CAS), covering its concepts, features, architecture, environment setup, server and client configuration, and testing procedures with detailed code examples for Java developers.
This article examines cache update strategies in high‑concurrency systems, analyzing the trade‑offs of delete‑then‑write versus write‑then‑write approaches, illustrating race conditions, and presenting solutions such as CAS, distributed locks, asynchronous updates, and delayed double‑delete to maintain data consistency.
The article analyzes the challenges of keeping cache and database consistent after write operations, evaluates four update‑order strategies, discusses their concurrency pitfalls, and presents practical solutions such as CAS, distributed locks, asynchronous updates, and delayed double‑delete techniques.
This article explains the challenges of multiple product systems, reviews traditional session mechanisms and their limitations in clustered environments, compares session replication and centralized storage using Redis, and details the design and implementation of Single Sign-On using CAS and OAuth2 with Java Spring code examples.
This article explains why locks are needed in Java, describes the fundamentals of volatile and synchronized, details the monitor‑based implementation of synchronized, introduces CAS operations, and outlines advanced lock mechanisms such as biased, lightweight, lock coarsening, elimination, and the AbstractQueuedSynchronizer framework.
This article explains traditional HTTP session handling, the problems of session sharing in clustered and multi‑service environments, and presents practical SSO solutions—including session replication, centralized Redis storage, and a complete CAS‑based single sign‑on implementation with Java code examples.
This article explains the limitations of traditional HTTP session handling, explores session sharing strategies for clustered environments, and walks through a complete Java CAS‑based single sign‑on solution with code examples, highlighting the differences between CAS and OAuth2.
This article explains the challenges of traditional session mechanisms in distributed systems, explores session sharing solutions such as replication and centralized storage, details the design and flow of Single Sign‑On (SSO) using CAS, compares CAS with OAuth2, and provides complete Java code examples for a demo implementation.
The article explains why concurrent write transactions cause lost updates, then details practical solutions such as atomic update statements, explicit row‑level locking, automatic lost‑update detection, compare‑and‑swap (CAS) techniques, and special considerations for multi‑replica databases.
The article explains the concepts of Single Sign-On and OAuth2.0, compares their trust, resource, and flow differences, and details how to implement SSO using OAuth2.0 or the CAS framework, while also promoting related Spring Cloud Alibaba video tutorials.
This article explains traditional HTTP session handling, the problems of session sharing in clustered environments, two common session‑sharing strategies, and introduces single sign‑on (SSO) concepts with a detailed CAS‑based implementation using Spring Boot, Redis, and Java filters.
This article explains traditional session and authentication mechanisms, the problems of session sharing in clustered and multi‑service environments, and presents practical SSO solutions—including CAS‑based single sign‑on and its differences from OAuth2—accompanied by complete Java Spring code examples.
This article explains the limitations of traditional HTTP session mechanisms, explores session sharing strategies in clustered environments, and provides a detailed walkthrough of implementing Single Sign-On using CAS, including code samples and a comparison with OAuth2 authentication.
This article explains the challenges of multiple system logins, reviews traditional HTTP session handling, presents session sharing solutions like replication and Redis‑based central storage, and details a CAS‑based single sign‑on implementation with code examples, while also comparing CAS to OAuth2.
This article explains why unified authentication is essential for product suites, reviews traditional session mechanisms and their limitations in clustered environments, explores session‑sharing strategies, introduces CAS‑based SSO workflows, compares CAS with OAuth2, and provides a complete Spring Boot demo with code snippets and configuration details.
This article explains Java's five thread‑safety categories—from immutable to thread‑hostile—and details practical ways to achieve safety, including mutex synchronization, non‑blocking CAS techniques, and no‑sync approaches such as re‑entrant code and thread‑local storage.
This article explains the fundamentals of Compare‑And‑Swap (CAS), its implementation in Java through the Unsafe class, demonstrates AtomicInteger's lock‑free operations, and discusses CAS drawbacks such as spin‑wait overhead, single‑variable limitation, and the ABA problem with mitigation strategies.
This article explains the principles of CAS, the ABA problem, and how Java's AbstractQueuedSynchronizer underpins ReentrantLock, comparing fair and non‑fair lock implementations, with code examples and discussion of their performance trade‑offs in.
This article explains the fundamentals of CAS (compare‑and‑swap), the ABA problem and its version‑stamp solution, introduces AbstractQueuedSynchronizer (AQS) as the core of Java concurrency utilities, and compares fair and non‑fair lock implementations in ReentrantLock with code examples and diagrams.
This tutorial explains what SSO and CAS are, outlines the required development environment, walks through downloading, building, and deploying the CAS Server, shows how to configure the server and client (including disabling HTTPS for testing), and demonstrates successful cross‑application authentication with code examples.
This article explains how to integrate the CAS (Central Authentication Service) single sign‑on solution into a Spring Boot backend by adding necessary dependencies, configuring a series of CAS filters, creating a custom MyAuthenticationFilter to handle AJAX requests, and demonstrating a Vue.js frontend that interacts with the authentication flow, complete with screenshots of the login, ticket validation, and logout processes.
This article provides a comprehensive tutorial on implementing Single Sign-On using the CAS (Central Authentication Service) framework, covering the concepts of SSO and CAS, required development environment, server-side deployment, client configuration, and end‑to‑end testing with detailed code examples.
This article explains how to deploy a CAS server, configure the cas-client dependency, set up Spring Boot annotations and cookie handling, share sessions across multiple services, and resolve cross‑origin and authentication redirects for a Vue front‑end separated from legacy JSP back‑ends.
This article provides a comprehensive tutorial on implementing Single Sign‑On using the open‑source CAS solution, covering the concepts of SSO and CAS, required development environment, server‑side deployment, client integration with Spring Boot, configuration details, and a complete end‑to‑end testing workflow.
This article explores the evolution from early mechanical calculators to modern CPUs, explains thread states, synchronization mechanisms, memory barriers, volatile semantics, and JVM lock implementations, and reveals why Java's notify method consistently awakens a specific waiting thread.
Lock‑free (non‑blocking) algorithms replace traditional locks with hardware primitives such as compare‑and‑swap (CAS) to ensure data consistency during concurrent access, offering superior scalability and eliminating deadlocks, and the article explains Java’s atomic variables, CAS‑based implementations, and how to address the ABA problem with AtomicStampedReference.