LIGHT

  • News
  • Docs
  • Community
  • Reddit
  • GitHub

Mras

This is a customized handler that is used to access an external service through a corporate network with web gateway. The reason we cannot use the generic external service handler is that the service requires two-way TLS and customized access token endpoint.

This handler is located in the light-4j repo ingress-proxy module. The default config template can be customized in the values.yml file.

mras.yml

# Configuration for MrasHandler
# Indicate if the handler is enabled or not
enabled: ${mras.enabled:false}
# keyStoreName
keyStoreName: ${mras.keyStoreName:}
# keyStorePass
keyStorePass: ${mras.keyStorePass:}
# keyPass
keyPass: ${mras.keyPass:}
# trustStoreName
trustStoreName: ${mras.trustStoreName:apigatewayuat.pfx}
# trustStorePass
trustStorePass: ${mras.trustStorePass:password}
# Proxy Host if calling within the corp network with a gateway like Mcafee gateway.
proxyHost: ${mras.proxyHost:}
# Proxy Port if proxy host is used. default value will be 443 which means HTTPS.
proxyPort: ${mras.proxyPort:}
# If HTTP2 is used to connect to the MRAS site.
enableHttp2: ${mras.enableHttp2:false}
# When MrasHandler is used in the http-sidecar or light-gateway, it can collect the metrics info for
# the total response time of the downstream API. With this value injected, users can quickly determine how much
# time the http-sidecar or light-gateway handlers spend and how much time the downstream API spends, including
# the network latency. By default, it is false, and metrics will not be collected and injected into the metrics
# handler configured in the request/response chain.
metricsInjection: ${mras.metricsInjection:false}
# When the metrics info is injected into the metrics handler, we need to pass a metric name to it so that the
# metrics info can be categorized in a tree structure under the name. By default, it is mras-response, and
# users can change it.
metricsName: ${mras.metricsName:mras-response}

# URL rewrite rules, each line will have two parts: the regex patten and replace string separated
# with a space. For details, please refer to the light-router router.yml configuration.
# Test your rules at https://www.freeformatter.com/java-regex-tester.html
urlRewriteRules: ${mras.urlRewriteRules:}

# A list of applied request path prefixes and authentication config, other requests will skip this handler.
pathPrefixAuth: ${mras.pathPrefixAuth:}
# format with JSON for config server
#  {"/mras":"accessToken","/test":"basicAuth","/pdf/generator":"anonymous","/advisor":"microsoft"}

# format with YAML for readability
#  /mras: accessToken
#  /test: basicAuth
#  /pdf/generator: anonymous
#  /advisor: microsoft

# MRAS basic authentication configuration for some endpoints
basicAuth:
  # username for the authentication
  username: ${mras.basicAuth.username:}
  # password for the authentication
  password: ${mras.basicAuth.password:}
  # host for the endpoint
  serviceHost: ${mras.basicAuth.serviceHost:}
# MRAS accessToken issued by the MRAS service
accessToken:
  # MRAS get token URL to send the request
  tokenUrl: ${mras.accessToken.tokenUrl:https://test.mras.com/services/oauth2/token}
  # username for the authentication
  username: ${mras.accessToken.username:}
  # password for the authentication
  password: ${mras.accessToken.password:}
  # is cache enabled for the token
  cacheEnabled: ${mras.accessToken.cacheEnabled:}
  # memory key
  memKey: ${mras.accessToken.memKey:}
  # grace period
  gracePeriod: ${mras.accessToken.gracePeriod:}
  # host for the endpoint
  serviceHost: ${mras.accessToken.serviceHost:}

# MRAS Microsoft token issued by Microsoft service
microsoft:
  # MRAS get token URL to send the request
  tokenUrl: ${mras.microsoft.tokenUrl:https://test.mras.com/services/oauth2/token}
  # username for the authentication
  clientId: ${mras.microsoft.clientId:}
  # password for the authentication
  clientSecret: ${mras.microsoft.clientSecret:}
  # resource for the authentication
  resource: ${mras.microsoft.resource:}
  # is cache enabled for the token
  cacheEnabled: ${mras.microsoft.cacheEnabled:}
  # memory key
  memKey: ${mras.microsoft.memKey:}
  # grace period
  gracePeriod: ${mras.microsoft.gracePeriod:}
  # host for the endpoint
  serviceHost: ${mras.microsoft.serviceHost:}

# MRAS anonymous access for some endpoints.
anonymous:
  # MRAS target service host for service access with the token get with above property.
  serviceHost: ${mras.anonymous.serviceHost:}

The handler has a customzied TLS context object that is used to establish the two-way TLS connect to the target server. Also, it supports the proxyHost and proxyPort configuration to access the external service via the corporate gateway.

  • 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
“Mras” was last updated: March 28, 2023: fixes #374 update metrics handler doc (bbd7301)
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