Skip to content

Releases: mikeacjones/dw-jwt-module

Initial DataWeave JWT Module Release

08 Jun 17:57
Compare
Choose a tag to compare
Pre-release

DataWeave JWT Module

This module provides DataWeave functions for creating signed JWT using RSA or HMAC-SHA. Currently supports RSA256/384/512 and HMAC-SHA 256/384/512.

Add dependency to your POM:

<dependency>
  <groupId>af871948-2dd2-4f4c-8bbd-f6a997cd48d7</groupId>
  <artifactId>dw-module-jwt</artifactId>
  <version>1.0.0-SNAPSHOT</version>
</dependency>

Example usage:

output application/java
import jwt::RSA
---
{
	token: RSA::JWT(
		{
			iss: p('google.clientEmail'),
			aud: 'https://oauth2.googleapis.com/token',
			scope: 'https://www.googleapis.com/auth/drive.readonly',
			iat: now() as Number { unit: 'seconds' },
			exp: (now() + |PT3600S|) as Number { unit: 'seconds' }
		},
		p('google.privateKey')
	),
	expiration: now() + |PT3550S|
}