Habr•July 22, 2026•🇷🇺Translated from Russian

Spring Security Tutorial Details Refresh Token Implementation to Complement JWT Authentication

A comprehensive tutorial on Spring Security demonstrates how to extend JWT authentication with refresh tokens to balance security and usability. The guide begins by explaining the limitations of short-lived access tokens, which typically expire within 15 minutes to one hour, and introduces refresh tokens that can last from one week to one month.

The article details the creation of a RefreshToken entity annotated with JPA mappings, including fields for the token string, associated user, expiration instant, and revocation flag. It also provides the corresponding RefreshTokenRepository interface with methods to find tokens and delete all tokens for a given user.

In the service layer, RefreshTokenService implements token creation by removing existing tokens for the user, generating a new UUID-based token, setting an expiration based on a configurable property, and persisting it. The verify method checks for existence, expiration, and revocation status, throwing a custom RefreshTokenException when necessary, while the revoke method marks tokens as revoked.

Security considerations are thoroughly covered, highlighting benefits such as reduced exposure time for access tokens, automatic session renewal, centralized session control, and minimized password transmission. Risks discussed include potential database compromise mitigated by hashing with SHA-256 or HMAC-SHA256, increased database load due to statefulness, implementation complexity involving token rotation, and client-side storage vulnerabilities addressed by using HttpOnly cookies instead of localStorage.

The tutorial updates DTOs to include AuthResponse and RefreshRequest, modifies AuthService to integrate refresh token creation during registration and login, and enhances AuthController with endpoints for refresh and logout. A helper method sets secure, HTTP-only cookies with appropriate path and max-age settings.

Finally, adjustments to SecurityConfig are shown to permit public access to authentication endpoints and profile retrieval while restricting administrative routes, ensuring a complete implementation of refresh token mechanics alongside JWT handling.

Related articles

Habr•Other

NetRuleRouter Alpha Released to Route Traffic Across Multiple Connections Without Disabling VPN

Developer krox1 has released the first public alpha of NetRuleRouter v0.1.0-alpha.1 for Windows and Linux, a local network policy manager that distributes traffic between primary and secondary connections based on domains, IP ranges, applications, and subnets. The tool emerged from practical issues that intensified after Russian authorities discussed VPN restrictions in March 2026, with operators and platforms later prompting users to disable VPN for domestic services. NetRuleRouter sits on top of existing connections rather than acting as a VPN client or proxy, allowing users to keep corporate VPNs, personal VPNs, and direct internet active simultaneously. It supports seven matching methods including exact domains, wildcard subdomains, CIDR ranges, and application paths, with priority rules to resolve overlaps and built-in leak protection that prevents protected destinations from falling back when the secondary connection drops. The alpha includes diagnostic tracing, preset rule sets for Russia and other regions, import/export capabilities, and a first-run wizard that configures the background service and initial bindings. Limitations around DNS, shared IPs, and brief startup windows are documented, and the project explicitly does not protect against account-level blocks by services such as Anthropic.

Habr•Other

Setting Up Nextcloud Talk on TrueNAS with Custom Domain for Private Family Calls

A detailed guide explains how to deploy Nextcloud Talk on a TrueNAS server behind a custom domain to create a self-hosted messaging and calling platform for family use. The author addresses problems with commercial messengers such as VK notifications failing on iOS and Telegram requiring VPN connections. The solution uses HestiaCP on a VPS for reverse proxying, Let's Encrypt SSL certificates, and port forwarding on a home router to reach the TrueNAS instance at 192.168.0.17:30027. Additional steps cover configuring coturn for TURN relay to enable reliable voice and video calls, updating trusted domains in Nextcloud, and disabling router DoS protection. The setup also enables Screen Sharing, reactions, and push notifications while keeping all data under user control.

AntiMalware•Other

Aladdin Launches Enterprise CA 3.0 with Kubernetes Support and Fourfold Faster Certificate Issuance

Russian vendor Aladdin has released version 3.0 of its corporate certificate authority product, Aladdin Enterprise CA. The update emphasizes Kubernetes and Deckhouse integration to automate certificate lifecycle management and improve cluster resilience. Mass issuance of file-based certificates is now up to four times faster than in the previous release. The product includes native ACME protocol support for automated SSL certificate deployment and adds centralized security logging with SIEM integration. It is positioned as a drop-in replacement for Microsoft CA that allows migration without service interruption. Additional features include support for RED Database, an English-language interface, and expanded administrative capabilities. The new version is currently undergoing FSTEC Russia certification while version 2.x continues to receive security updates.

Habr•Other

Reviving Huawei SANEX9510: Expired Certificates, Zero-Byte Keystore and Lost '@' Symbol Fixed Without Database Restart

A three-day postmortem revealed seven independent failures across four TLS contours in a legacy Huawei SANEX9510 telecom OSS platform that had been offline for ten months. The issues included expired certificates, an empty 0-byte PKCS#12 keystore, a missing '@' character in an encrypted TrustStore password, incompatible PKCS#8 private key encryption formats, and connection leaks to Sybase IQ. All components were restored without rebooting servers, restarting the database, or resetting passwords. The engineer mapped every keystore reference across multiple property files to avoid breaking working segments while fixing others. A final table creation for missing DAS_DIRSIZE metadata resolved a month-old import failure unrelated to the certificate problems.