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 - Q300Z/scribejava: Simple OAuth library for Java

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

1,540 Commits
1,540 Commits

Folders and files

NameName
Last commit message
Last commit date
.agents/agents
.agents/agents
 
 
.github
.github
 
 
.vscode
.vscode
 
 
docs
docs
 
 
scribejava-apis
scribejava-apis
 
 
scribejava-core
scribejava-core
 
 
scribejava-httpclient-armeria
scribejava-httpclient-armeria
 
 
scribejava-httpclient-okhttp
scribejava-httpclient-okhttp
 
 
scribejava-integration-helpers
scribejava-integration-helpers
 
 
scribejava-oauth1
scribejava-oauth1
 
 
scribejava-oidc
scribejava-oidc
 
 
specs
specs
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
.markdownlint.json
.markdownlint.json
 
 
.release-it.json
.release-it.json
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
Dockerfile.ci
Dockerfile.ci
 
 
LICENSE.txt
LICENSE.txt
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
checkstyle.xml
checkstyle.xml
 
 
ci-local.sh
ci-local.sh
 
 
core-jacoco.xml
core-jacoco.xml
 
 
docker-compose.ci.yml
docker-compose.ci.yml
 
 
docker-compose.keycloak.yml
docker-compose.keycloak.yml
 
 
mkdocs.yml
mkdocs.yml
 
 
oidc-jacoco.xml
oidc-jacoco.xml
 
 
package.json
package.json
 
 
pmd.xml
pmd.xml
 
 
pnpm-lock.yaml
pnpm-lock.yaml
 
 
pom.xml
pom.xml
 
 
scribejava-keycloak-realm.json
scribejava-keycloak-realm.json
 
 

Repository files navigation

ScribeJava :: La bibliothèque OAuth simple et robuste pour Java

Tests Dernière Release Licence MIT Android Ready

ScribeJava est une bibliothèque client OAuth légère, thread-safe et modulaire. Elle est conçue pour les développeurs qui exigent un contrôle total, une sécurité maximale et zéro dépendance inutile.


Sommaire

  1. Pourquoi ScribeJava
  2. Architecture Modulaire
  3. Démarrage Rapide
  4. Integration OIDC Enterprise
  5. Installation
  6. Compatibilite et Android
  7. Documentation & Exemples

Pourquoi ScribeJava

ScribeJava est le choix idéal pour les projets qui refusent l'opacité des frameworks "tout-en-un".

Matrice de Choix : ScribeJava vs Frameworks Lourds

Caractéristique ScribeJava v9.5.2 Spring Security / Pac4j
Poids (Core) < 1 Mo > 50 Mo (avec dépendances)
Dépendances Zéro (JDK natif) Énorme graphe de transitivité
Courbe d'apprentissage Minutes Jours / Semaines
Contrôle du flux Total Abstraction rigide
Android Ready Oui (Natif) Difficile / Incompatible

Architecture Modulaire

ScribeJava est conçu comme un écosystème de composants indépendants :

graph TD
    subgraph Core
        C[scribejava-core]
    end
    subgraph Extensions
        C --> O[scribejava-oidc]
        C --> A[scribejava-apis]
        C --> I[scribejava-integration-helpers]
    end
    subgraph Transport
        C --> H1[scribejava-httpclient-okhttp]
        C --> H2[scribejava-httpclient-armeria]
    end

Loading

Comment ça marche ?

ScribeJava repose sur trois piliers fondamentaux :

  1. L'API (DefaultApi20, DefaultApi10a) : Définit les points de terminaison (URLs) et les verbes HTTP du fournisseur (ex: GitHub, Google).

  2. Le Service (OAuth20Service) : Gère la logique d'exécution des requêtes, la signature et l'échange de jetons.

  3. Le Grant (OAuth20Grant) : Définit la stratégie d'obtention du jeton (Code, Mot de passe, Device Flow, Client Credentials).


Demarrage Rapide

1. OAuth 2.0 Standard (Authorization Code)

Utilisé pour les applications web et mobiles. PKCE (RFC 7636) est fortement recommandé pour sécuriser l'échange de code.

Fonctionnement du PKCE :

  • Génération : ScribeJava crée un code_verifier (secret cryptographique) et calcule son code_challenge (SHA-256).

  • Autorisation : Le challenge est envoyé au serveur dans l'URL initiale.

  • Échange : Le verifier secret est envoyé lors de la demande de jeton pour prouver l'identité du client.

// Configuration
OAuth20Service service = new ServiceBuilder(clientId)
    .apiSecret(clientSecret)
    .callback("https://mon-app.com/callback")
    .build(GitHubApi.instance());

// Génération de l'URL d'autorisation
PKCE pkce = PKCEService.defaultInstance().generatePKCE();
String authUrl = service.createAuthorizationUrlBuilder()
    .pkce(pkce)
    .build();

// Échange du code contre un jeton
AuthorizationCodeGrant grant = new AuthorizationCodeGrant(code);
grant.setPkceCodeVerifier(pkce.getCodeVerifier());
OAuth2AccessToken token = service.getAccessToken(grant);

Integration OIDC Enterprise

Utilisez notre coordinateur spécialisé ou l'API native pour une autonomie totale (Zero-Dependency).

Configuration Magique (via Discovery)

Vous n'avez plus besoin de configurer les URLs d'API manuellement. Fournissez uniquement l'URL de l'émetteur (Issuer) :

// Configure tout automatiquement à partir de /.well-known/openid-configuration
OidcServiceBuilder builder = new OidcServiceBuilder(clientId)
    .apiSecret(clientSecret)
    .baseOnDiscovery("https://accounts.google.com", httpClient, userAgent);

// Remplacez par votre API OIDC concrète (ex. OidcGoogleApi20.instance())
OAuth20Service service = builder.build(OidcGoogleApi20.instance());
String authUrl = service.getAuthorizationUrl(); // L'URL est découverte dynamiquement !

🛠️ Utilisation Avancée (Découverte manuelle)

// 1. Découverte dynamique des endpoints et des clés (Natif)
OidcDiscoveryService discovery = new OidcDiscoveryService(issuer, httpClient, userAgent);
OidcProviderMetadata metadata = discovery.getProviderMetadata();
Map<String, OidcKey> keys = discovery.getJwks(metadata.getJwksUri());

// 2. Initialisation du Validateur (Natif ScribeJava)
IdTokenValidator validator = new IdTokenValidator(metadata.getIssuer(), clientId, "RS256", keys);

// 3. Orchestration via Coordinateur (Helpers)
OidcAuthFlowCoordinator<String> coordinator = new OidcAuthFlowCoordinator<>(oidcService, repository);
OidcAuthResult result = coordinator.finishAuthorization(userId, code, state, sessionContext);

Helpers d'Intégration (Nouveautés v9.1)

Pour les applications réelles, ScribeJava propose le module scribejava-integration-helpers qui orchestre tout le cycle de vie.

1. Auto-rafraîchissement des jetons

Le développeur ne gère plus les refresh_token. ScribeJava le fait silencieusement.

AuthorizedClientService<String> client = new AuthorizedClientService<>(service, renewer);

// Exécute la requête : rafraîchit le jeton automatiquement s'il est expiré (Thread-safe)
Response resp = client.execute(userId, new OAuthRequest(Verb.GET, "https://api.example.com/me"));

2. Observabilité et Audit

Branchez vos logs (ELK/Grafana) pour surveiller la santé de vos connexions.

// Configurez le listener d'événements sur le coordinateur de flux (ou le TokenAutoRenewer)
coordinator.setListener(new AuthEventListener<String>() {
    @Override
    public void onCsrfDetected(String key, String got, String expected) {
        logger.error("ALERTE SÉCURITÉ : Tentative CSRF sur l'utilisateur " + key);
    }
    // ... onTokenRefreshed, onRefreshFailed
});

Installation

ScribeJava est distribué via GitHub Releases.

💡 Note actuelle : v9.5.2

Maven

Installez le JAR téléchargé localement ou utilisez votre dépôt privé :

<dependency>
    <groupId>com.github.scribejava</groupId>
    <artifactId>scribejava-core</artifactId>
    <version>9.5.2</version>
</dependency>
<dependency>
    <groupId>com.github.scribejava</groupId>
    <artifactId>scribejava-oidc</artifactId>
    <version>9.5.2</version>
</dependency>
<!-- Hautement recommandé : Pour l'automatisation et l'OIDC Enterprise -->
<dependency>
    <groupId>com.github.scribejava</groupId>
    <artifactId>scribejava-integration-helpers</artifactId>
    <version>9.5.2</version>
</dependency>

Compatibilite et Android

  • Java : Compatible de Java 8 à Java 25.
  • Android : Support complet (API 21+).

Documentation & Exemples

📖 Consulter notre tout nouveau Hub de Documentation en ligne — Un site moderne regroupant l'intégralité des guides, tutoriels de démarrage rapide et bonnes pratiques.

📚 Guides détaillés (Markdown)

  • 🚀 Démarrage Rapide (Quick Start) - Exemples complets pour CLI (OAuth2, OIDC, M2M).

  • ⚡ Guide de Migration - Passer de la v8 à la v9.

  • ⚙️ Guide ScribeJava Core - Moteur OAuth, requêtes, résilience et diagnostic.

  • 🛡️ Sécurité Avancée (DPoP/PAR) - RFC 9449 et 9126.

  • 🔐 Guide des Fonctionnalités OIDC - Discovery, JWT natif et Logout.

  • 🗺️ Guide des Flux Architecturaux (OAuth/OIDC) - Diagrammes Mermaid et description pas-à-pas des échanges de données de connexion.

  • 📖 Guide d'Intégration Helpers - Orchestration, Auto-refresh et multi-tenant.

  • 📖 Catalogue des Fonctionnalités - Liste exhaustive par module.

  • 🛠️ Documentation CI/CD - Architecture du pipeline qualité.

  • 🚑 Guide de Dépannage - Solutions aux erreurs courantes.

  • 📱 Guide d'Intégration Mobile / Android - Configuration Android, Custom Tabs et Deep Linking.

  • 📖 Modules : Core | OIDC | Integration Helpers

  • 🎯 Exemples :

    • OpenID Connect avec Découverte Dynamique
    • OIDC Enterprise avec Auto-Refresh

🏗️ API Javadoc

  • Consulter la Javadoc d'API en ligne

⭐ Soutenez-nous ! Mettez une étoile sur le projet pour nous aider à grandir.

About

Simple OAuth library for Java

q300z.github.io/scribejava/

Resources

Readme
License

Contributing

Contributing

Security policy

Security policy
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

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.