LIGHT

  • News
  • Docs
  • Community
  • Reddit
  • GitHub
  • 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

Client Management

To access any service from a client, you need to have a valid JWT token that contains a scope that matches one of the scopes defined in the service specification for the endpoint. Typically, the original client should be a single page application or a mobile application. However, in a microservices deployment, there will be service to service invocation, and the caller will be the client of the service provider.

The original client will be authenticated and authorized by the code service through the authorization code flow. The JWT token will contain the user_id, roles, and possible custom claims for fine-grained authorization on each service in the invocation chain. Each intermediate service will obtain a secondary scope token with client credentials flow to indicate the immediate caller, and it is done automatically by the Http2Client in light-4j.

For more details about the security architecture, please refer to here

For each client except the last service in the chain, it needs to be registered on the OAuth 2.0 provider as a client to get the token with scopes to access the next service in the chain.

For all generated projects with light-codegen, the config folder contains certificates to verify the JWT token issued by the https://devoauth.lightapi.net behind the light-portal.

To use the light-portal, you need to register a client and get a client_id and client_secret pair. Once you login to the https://dev.lightapi.net, you should see the OAuth menu on the dashboard. Click the client menu, and all the registered clients will be shown up in a table for the host you belong to. By default, the host is lightapi.net, and you can request a new host based on your email domain from your profile menu.

Register Client

To register a new client, go to the end of the table and you can see a plus button. Click the button, a client form will be shown up. Fill in the form and click the submit button, a regsitered client info will be returned. Copy the client_id and client_secret and keep it in a safe place. This is the only time, you can see the client_secret and there is no way to recover it. If you forget client_secret, you have to delete the client and re-register it again.

To register a new client, go to the end of the table, and you can see a plus button. Click the button, and a client form will be shown up. Fill in the form and click the submit button, registered client info will be returned. Copy the client_id and client_secret and keep it in a safe place. This is the only time you can see the client_secret, and there is no way to recover it. If you forget client_secret, you have to delete the client and register another one.

Update Client

All the fields for the client can be updated except client_id and client_secret. For each client in the table, you can click the update icon at the end of the row to show the update form. Once the update is done, click the submit button to save the client.

Delete Client

To delete a client, go to the end of the table row and click the delete icon.

Create Token

In most of the cases, JWT tokens will be retrieved in real-time during the service invocation. However, for dev testing, we need to get a test token to invoke the API manually or from testing tools.

You can set the expired time to short or long, depending on your test. You can also set the scope to access any service that requires the scope. For authorization code token, you can set the user_id and roles to trigger the fine-grained authorization. Sometimes, you might need to set the custom claims for special authorization required in the service.

  • 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