LIGHT

  • News
  • Docs
  • Community
  • Reddit
  • GitHub

Provider Registration

The service to support federated OAuth 2.0 providers.

For example, external OAuth 2.0 provider for external clients and internal OAuth 2.0 provider for internal clients.

The Internal AS needs to have the public key certificate from External AS in order to allow all resource server to verify the tokens signed by both servers.

Provider workflow

Provider workflow diagram

Provider workflow

Provider workflow steps

Pre-steps, Light-oauth server B and light-oauth server C register as light-oauth security provider on light-Oauth server A. Please follow Provider Registration section for detail of registration.

/oauth2/provider@post

And set the two digits provider Id in the request Json format body, for example:

{"providerId":"05","serverUrl":"http://google.ca/light-4j:8080","uri":"/oauth/key","providerName":"cloud light-4j"

If the provider Id is been registered by other light-oauth server, then the following error will be returned.

  "ERR12048": {
    "statusCode": 400,
    "code": "ERR12048",
    "message": "PROVIDER_ID_EXISTS",
    "description": "Provider id %s exists; It has been regristed already."
  }

Change the provider Id and the registration request again.

If the registration sucuessfully returned, we need add the provider Id to security.yml file of the light-oauth provider service (in our example, Light-oauth server B or light-oauth server C )

# light-oauth server also work as provider for other light-oauth server, following is the provider id

providerId: 05

# JWT signature public certificates. kid and certificate path mappings.
jwt:
  certificate:
    '100': oauth/primary.crt
    '101': oauth/secondary.crt
  clockSkewInSeconds: 60


  1. Client gets token from local light-oauth server (from the diagram, Light-Oauth B). The token header includes certificate Key Id
   {
     "kid": "05100",
     "alg": "RS256"
   }
  1. Client tries to access the service which registered on light-oauth A with the access token;

  2. The service will check the light-oauth server (Light-Oauth A) for the token to verify the access. The light-oauth server (Light-Oauth A) will try get the local certificate based on the key Id in the token header

  3. If light-oauth server (Light-Oauth A) can get the certificate directly from local server, verify the token directly. If light-oauth server (Light-Oauth A) cannot get the certificate directly from local server, then light-oauth key service will try to get the certificate from registered provider.

  4. If light-oauth key service will try to get the certificate from registered provider, then verify the token with the certificate. Otherwise, return with access error.

Provider Registration

To add a new provider.

curl -X POST \
  https://localhost:6889/oauth2/provider \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -d '{"providerId":"05","serverUrl":"http://google.ca/light-4j:8080","uri":"/oauth/key","providerName":"cloud light-4j"}'

To update a provider with new serverUrl.

curl -X POST \
  https://localhost:6889/oauth2/provider \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -d '{"providerId":"05","serverUrl":"http://google.ca/light-4j:8080","uri":"/oauth/key","providerName":"cloud light-4j"}'

To delete a provider by the providerId.

curl -X DELETE \
  https://localhost:6889/oauth2/provider/02 \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -d '{"providerId":"05","serverUrl":"http://networknt/light-4j:8080","uri":"/oauth/key","providerName":"cloud light-4j"}'

To query all provider.

curl -X GET \
  https://localhost:6889/oauth2/provider \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -d '{"providerId":"02","serverUrl":"http://yahoo.ca/light-4j:8080","uri":"/oauth/key","providerName":"cloud light-4j"}'

Result of the query request:

{
   "05": {
       "providerId": "05",
       "serverUrl": "http://networknt/light-4j:8080",
       "uri": "/oauth/key",
       "providerName": "cloud light-4j"
   },
   "02": {
       "providerId": "02",
       "serverUrl": "http://yahoo.ca/light-4j:8080",
       "uri": "/oauth/key",
       "providerName": "cloud light-4j"
   }
}

  • About Light
    • Overview
    • Testimonials
    • What is Light
    • Features
    • Principles
    • Benefits
    • Roadmap
    • Community
    • Articles
    • Videos
    • License
    • Why Light Platform
  • Getting Started
    • Get Started Overview
    • Environment
    • Light Codegen Tool
    • Light Rest 4j
    • Light Tram 4j
    • Light Graphql 4j
    • Light Hybrid 4j
    • Light Eventuate 4j
    • Light Oauth2
    • Light Portal Service
    • Light Proxy Server
    • Light Router Server
    • Light Config Server
    • Light Saga 4j
    • Light Session 4j
    • Webserver
    • Websocket
    • Spring Boot Servlet
  • Architecture
    • Architecture Overview
    • API Category
    • API Gateway
    • Architecture Patterns
    • CQRS
    • Eco System
    • Event Sourcing
    • Fail Fast vs Fail Slow
    • Integration Patterns
    • JavaEE declining
    • Key Distribution
    • Microservices Architecture
    • Microservices Monitoring
    • Microservices Security
    • Microservices Traceability
    • Modular Monolith
    • Platform Ecosystem
    • Plugin Architecture
    • Scalability and Performance
    • Serverless
    • Service Collaboration
    • Service Mesh
    • SOA
    • Spring is bloated
    • Stages of API Adoption
    • Transaction Management
    • Microservices Cross-cutting Concerns Options
    • Service Mesh Plus
    • Service Discovery
  • Design
    • Design Overview
    • Design First vs Code First
    • Desgin Pattern
    • Service Evolution
    • Consumer Contract and Consumer Driven Contract
    • Handling Partial Failure
    • Idempotency
    • Server Life Cycle
    • Environment Segregation
    • Database
    • Decomposition Patterns
    • Http2
    • Test Driven
    • Multi-Tenancy
    • Why check token expiration
    • WebServices to Microservices
  • Cross-Cutting Concerns
    • Concerns Overview
  • API Styles
    • Light-4j for absolute performance
    • Style Overview
    • Distributed session on IMDG
    • Hybrid Serverless Modularized Monolithic
    • Kafka - Event Sourcing and CQRS
    • REST - Representational state transfer
    • Web Server with Light
    • Websocket with Light
    • Spring Boot Integration
    • Single Page Application
    • GraphQL - A query language for your API
    • Light IBM MQ
    • Light AWS Lambda
    • Chaos Monkey
  • Infrastructure Services
    • Service Overview
    • Light Proxy
    • Light Mesh
    • Light Router
    • Light Portal
    • Messaging Infrastructure
    • Centralized Logging
    • COVID-19
    • Light OAuth2
    • Metrics and Alerts
    • Config Server
    • Tokenization
    • Light Controller
  • Tool Chain
    • Tool Chain Overview
  • Utility Library
  • Service Consumer
    • Service Consumer
  • Development
    • Development Overview
  • Deployment
    • Deployment Overview
    • Frontend Backend
    • Linux Service
    • Windows Service
    • Install Eventuate on Windows
    • Secure API
    • Client vs light-router
    • Memory Limit
    • Deploy to Kubernetes
  • Benchmark
    • Benchmark Overview
  • Tutorial
    • Tutorial Overview
  • Troubleshooting
    • Troubleshoot
  • FAQ
    • FAQ Overview
  • Milestones
  • Contribute
    • Contribute to Light
    • Development
    • Documentation
    • Example
    • Tutorial
“Provider Registration” was last updated: July 5, 2021: fixes #275 checked and corrected grammar/spelling for majority of pages (#276) (b3bbb7b)
Improve this page
  • News
  • Docs
  • Community
  • Reddit
  • GitHub
  • About Light
  • Getting Started
  • Architecture
  • Design
  • Cross-Cutting Concerns
  • API Styles
  • Infrastructure Services
  • Tool Chain
  • Utility Library
  • Service Consumer
  • Development
  • Deployment
  • Benchmark
  • Tutorial
  • Troubleshooting
  • FAQ
  • Milestones
  • Contribute