Skip to content

SameeraSI/custom-jwt-transformer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Custom JWT Transformer

This repository contains a sample custom JWT transformer for WSO2 API Manager (APIM) version 4.1.0. The transformer modifies incoming JWT roles claim as needed, specifically converting the roles claim from an array to a string if the token's issuer is http://localhost:8080/realms/master.

Example Transformation If the incoming JWT contains the following roles claim:

"roles": [
    "default-roles-master",
    "offline_access",
    "uma_authorization"
]

The transformer will convert it to:

"roles": "default-roles-master offline_access uma_authorization"

This repository serves as an example, and you can customize the transformer to modify any claims as per your requirements.

Prerequisites

  • WSO2 API Manager 4.1.0
  • Maven build tool

How to Use

Build the Project Use Maven to build the project:

mvn clean install

Deploy the JAR File

After building, locate the generated JAR file in the target folder. Copy the JAR file to the:

<API-M_HOME>/repository/components/dropins directory

Restart the Server

Restart the WSO2 API Manager to apply the changes.

References

JWT Claim Transformation Documentation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages