SShortSingh.
Back to feed

Developer Replaces Basic Auth with JWT and OAuth2 in Spring Security App

0
·28 views

A developer has upgraded a Spring Security application by replacing HTTP Basic Authentication with JWT-based login and OAuth2 support. Under the old setup, raw credentials were sent with every request using only base64 encoding, offering no token expiry or proper logout mechanism. The new flow issues a signed JWT upon login, which carries user identity and role claims and is validated on each subsequent request via a custom filter. OAuth2 login was also integrated, automatically creating a local user record with a default role on first sign-in, ensuring both authentication paths feed into the same role-based access control system. The developer also implemented distinct error responses to differentiate expired tokens from invalid ones, improving client-side handling of authentication failures.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Chrome's forced dark mode changed how it treats small logos in a recent update

Chrome's forced dark mode, which repaints light pages dark unless a site has its own dark theme, decides whether to invert an image based on its size. Images drawn at 64 CSS pixels or less in each dimension are considered icons and may be flipped, while larger images are left alone. The threshold replaced an earlier screen-proportion rule in Chrome 151, which was dropped because it scaled with screen size and pixel density. Smaller grey images are then sorted by how many shades of grey they contain, with a neural network deciding borderline cases. The author reverse-engineered the classifier in Python and found it matched Chrome's decisions on all 35 images tested.

0
ProgrammingDEV Community ·

Linux and Robot Framework treat Dublin winter time as daylight saving due to tz database quirk

Ireland keeps GMT in winter and an hour ahead in summer, as the UK does, but a legal quirk means Irish law defines summer time as standard and winter as a daylight-saving-style period. Since 2018, the tz database that most computers use encodes Dublin's winter as negative daylight saving time, causing tools like Robot Framework to report Dublin as an hour off. Some distributions, such as Rocky Linux and Red Hat, ship an alternative 'rearguard' version that avoids this, while Debian, Ubuntu, Fedora and others use the main version. Many languages inherit the flag, and Java behaves differently by converting the offset into ordinary summer time. Python's common UTC-offset snippet also gets Dublin wrong, and the author recommends using tm_gmtoff and tm_zone instead, with a fix proposed but not yet reviewed.

0
ProgrammingDEV Community ·

Linktree's October price rise: what a bio link really costs a small shop over three years

A local barber pays $9 a month for a Linktree page that has not changed since 2024, and Linktree raised its prices again in late October. The Starter tier rose from $6 to $7 a month and Pro from $12 to $14 on annual billing, while Premium held at $30. The author argues the cheapest plan that removes Linktree branding, or lets a shop sell from its link, is Pro at $14 a month, or $168 a year. The article also contends that link lists suit creators but not shops, since visitors need prices, opening hours, and a call button without extra taps. The author discloses that they build a competing tool.

0
ProgrammingDEV Community ·

Rust Beats Go on Tail Latency and Memory for High-Load Inference Microservices, Go Wins on Dev Speed

A benchmark comparison of Rust (with tokio and hyper) and Go (with net/http and gRPC-go) ran on identical AMD EPYC hardware under AI-inference-style loads such as gRPC streaming and rate limiting. Rust showed substantially lower p999 latency (2.9 ms versus 18.4 ms), about 71% less memory per 10k streams, and fewer memory-safety incidents, while Go compiled far faster and let new hires reach a first pull request sooner. The authors attribute Go's tail-latency spikes mainly to garbage-collection assist work under heavy allocation, along with scheduler preemption and scattered heap layout. The article concludes that Rust is preferable where GPU dispatch or strict p999 targets matter, whereas Go suits teams prioritizing development velocity.