Skip to content

Latest commit

History

138 Commits

Folders and files

NameName
Last commit message
Last commit date

Ogiri

Ogiri is a Spring Boot library for secure, database-backed opaque sessions. It provides a persistence-neutral session core, Spring Security integration, JPA storage, optional HTTP endpoints, distributed sign-in throttling, and test fixtures.

Features

  • Selector/verifier credentials with digest-only persistence
  • Immediate revocation against an authoritative session store
  • Atomic credential rotation with bounded previous-token grace
  • Session limits, listing, sign-out, and per-session revocation
  • Bearer, secure cookie, and devise-token-auth compatibility transports
  • Consumer-owned Spring Security authorization
  • Drop-in JPA persistence and clustered cleanup leases
  • Optional Redis-backed distributed sign-in throttling
  • Java-friendly APIs and reusable in-memory test support
  • Spring Boot metrics, health indicators, and RFC 9457 errors

Ogiri v4 supports Java 17, Spring Boot 3.5, and servlet applications.

Modules

ModulePurpose
ogiri-session-coreSpring-free session state machine and store contract
ogiri-coreSpring Security, transport, endpoint, and observability integration
ogiri-jpaDefault JPA session store and database lease implementation
ogiri-redisDistributed sign-in rate limiter
ogiri-testIn-memory store, fake clock, and test helpers
ogiri-bomAligned dependency versions for all Ogiri modules

Install

Use the BOM and select the adapters your application needs:

dependencies {
implementation(platform("com.quantipixels.ogiri:ogiri-bom:VERSION"))
implementation("com.quantipixels.ogiri:ogiri-jpa")
implementation("org.flywaydb:flyway-core")
runtimeOnly("org.flywaydb:flyway-database-postgresql")
runtimeOnly("org.postgresql:postgresql")
testImplementation("com.quantipixels.ogiri:ogiri-test")
}

Add com.quantipixels.ogiri:ogiri-redis when distributed rate limiting is required.

Configure

Ogiri is opt-in. Supply a UserDetailsService or SubjectStatusChecker, then configure a Base64-encoded key containing at least 32 random bytes:

ogiri:
session:
enabled: truetransport: bearertoken-hash:
current-key-id: primarykeys:
primary: ${OGIRI_TOKEN_HASH_KEY_BASE64}endpoints:
enabled: truebase-path: /auth

Generate key material outside source control, for example:

openssl rand -base64 32

When the application defines a SecurityFilterChain, apply OgiriHttpConfigurer to that same chain so authentication and authorization remain together.

Use

val subject =OgiriSessions.subject("users", "opaque-user-id", "tenant-a")
val client =OgiriSessions.client("browser-id", "Work laptop")
val issued = sessions.issue(subject, client)
val authenticated = sessions.authenticate(issued.credential.encoded(codec))
sessions.revoke(authenticated)

The optional endpoint starter provides sign-in, refresh, sign-out, current-session, session-listing, and revocation routes under the configured base path.

Documentation

Build

./gradlew check

Licensed under Apache-2.0.

About

Òǵìrì - Reusable Spring Boot security components for token-based auth with pluggable sub-tokens.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages