GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ordered-system/ordered-commons: Shared library for ordered-system microservices: JWT claims auth filter, common exception handling, and pagination DTOs.

BranchesTags
Open more actions menu

Latest commit

 

History

3 Commits
3 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
.mvn/wrapper
.mvn/wrapper
 
 
src
src
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
mvnw
mvnw
 
 
mvnw.cmd
mvnw.cmd
 
 
pom.xml
pom.xml
 
 

Repository files navigation

ordered-commons

CI

Shared library for the ordered-system microservices — the small set of things that would otherwise be copy-pasted into every service's security and common packages.

Not a Spring Boot application: no spring-boot-maven-plugin, packaged as a plain .jar that order-service, product-service, user-service, and engagement-service each add as a Maven dependency. It isn't published to Maven Central — every consumer builds it locally first (see below).

<groupId>pl.dybcio</groupId>
<artifactId>ordered-commons</artifactId>
<version>0.0.1-SNAPSHOT</version>

What's in it

Class Purpose
JwtClaimsAuthenticationFilter Reads the JWT already verified upstream by the gateway and populates Spring Security's context from its custom claims (userId, roles) — services trust the gateway's signature check and just parse claims, they don't re-verify the token.
AuthenticatedUser The Principal implementation exposed to controllers (@AuthenticationPrincipal AuthenticatedUser user) — wraps userId and granted roles.
ProblemDetailAuthenticationEntryPoint Turns unauthenticated requests into a proper RFC 7807 ProblemDetail 401 response instead of Spring Security's default.
CommonExceptionHandler Base @RestControllerAdvice with the exception → ProblemDetail mappings shared across services (validation errors, not-found, etc.), extended per-service for domain-specific exceptions.
PageResponse A consistent pagination envelope so list endpoints look the same across every service's API.

Stack

Java 21 · Spring Boot 4.1.0 (as provided-scope dependencies, not pulled in transitively — each consuming service supplies its own Spring Boot version) · JJWT 0.12.6

Consuming it from another service

Local development — build once, every service on the machine picks it up from ~/.m2:

git clone https://github.com/ordered-system/ordered-commons.git
cd ordered-commons
make install          # mvn clean install, skips tests

Then in the consuming service, just run ./mvnw spring-boot:run as normal — Maven resolves ordered-commons from the local repo.

Docker builds don't have access to ~/.m2, so each service's Dockerfile compiles ordered-commons from source in an earlier build stage using a named additional build context:

FROM eclipse-temurin:21-jdk-alpine AS commons-build
WORKDIR /commons
COPY --from=commons . .
RUN apk add --no-cache maven && mvn -B -q clean install -DskipTests

which ordered-infra's docker-compose.prod.yml wires up per service:

order-service:
  build:
    context: ../ordered-order-service
    additional_contexts:
      commons: ../ordered-commons

i.e. ordered-commons must be cloned as a sibling directory next to whichever service you're building, at the same folder depth ordered-infra expects (see its README for the exact layout).

CI does the same thing without Docker — every service's GitHub Actions workflow checks out ordered-system/ordered-commons@main into a subfolder and runs mvn install -DskipTests on it before testing the service itself.

Testing

make test

Each class has a matching unit test under src/test.

Where this fits

Part of the ordered-system organization. Consumed by ordered-order-service, ordered-product-service, ordered-user-service, and ordered-engagement-service.

License

MIT — see LICENSE.

About

Shared library for ordered-system microservices: JWT claims auth filter, common exception handling, and pagination DTOs.

Topics

javajwtmicroservicesshared-libraryspring-bootspring-security

Resources

Readme
MIT license
Activity
Custom properties

Stars

1 star

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.