PackagePackagetypeA library you install and call yourself.See every one →What this type is →independently maintainedindependently maintainedoriginPublished by one person or a small company outside SAP. Says nothing about quality; the readings say that.See every one →

abap_jwt_generator

Generates a signed JSON Web Token in ABAP from an explicit header and claim, a stored profile in table ZJWT_PROFILE, or a shared secret, signing through a PSE profile or with the secret.

zcl_jwt_generator builds a JWT from a header and claim it is given, signing it through a PSE profile with generate_jwt, or derives one directly from a named entry in table ZJWT_PROFILE with get_jwt_by_profile; get_access_token_by_profile returns an access token the same way. generate_jwt_with_secret signs a token with a shared secret instead of a certificate, matching what a tool like a JWT debugger would produce. It stops at producing the token: what it is presented to, and how that side validates it, is outside the repository.

Facts

Last pushLicenceMIT

Where it sits

Lives in
Provides
AuthenticationABAPAuthenticationcapabilityEstablishing who is calling: validating credentials or tokens, resolving the user, and making that identity available to the application. [Authorization](capability:authorization) decides what that identity may do; [identity provisioning](capability:identity-provisioning) manages its lifecycle across systems.

Who is behind it

Chao LiuChao LiuPersonMaintains this
In the atlas: maintains 1, contributes to 2
@abapChaoLiu
maintainerJaime Rodriguez CapotePersonContributes to this
In the atlas: maintains 1, contributes to 9
@jrodriguez-rc
Lars HvamPersonContributes to this
In the atlas: maintains 13, contributes to 92, wrote 1
@larshp
2 contributors

Before choosing this

Signals

ActivityQuietNo published releases; repository quiet for 68 months

It publishes no releases, and its repository has been quiet for at least 24 full months. This may be normal for stable software; check whether its current state still fits your use.

What it declares

Every artifact

Type
Package
Origin
Independently maintained

As a package

Where it runs
does not say
Distributed through
does not say

Connections1

README

quoted from abapChaoLiu/abap_jwt_generator under MIT, read
abapChaoLiu/abap_jwt_generator/README.mdOn GitHub

abapLint

ABAP JWT Generator

Generate Json Web Token (JWT) in ABAP.

Demo 1 - method get_jwt_by_profile().

If JWT profile is maintained in table ZJWT_PROFILE, use method get_jwt_by_profile() to derive JWT token by profile name.

JWT profile screenshot

DATA: jwt_generator TYPE REF TO zcl_jwt_generator,
      jwt TYPE string.

CREATE OBJECT jwt_client.
jwt = jwt_client->get_jwt_by_profile( 'JWT_PROFILE_NAME' ).

Demo 2 - method generate_jwt().

If JWT profile is not maintained, use method generate_jwt() to derive JWT token.

REPORT zrpt_jwt_generator_demo.

DATA: jwt_generator TYPE REF TO zcl_jwt_generator.
DATA: jwt_header TYPE zcl_jwt_generator=>ty_jwt_header,
      jwt_claim  TYPE zcl_jwt_generator=>ty_jwt_claim.
DATA: exp_second        TYPE int8,
      ssf_info           TYPE ssfinfo.
DATA: start_timestamp TYPE timestamp VALUE '19700101000000',
      ssf_id          TYPE ssfid VALUE '<implicit>',
      "PSE profile with private key
      ssf_profile     TYPE ssfprof VALUE 'SAPZJWTSF001.pse'.


jwt_header-alg  = 'RS256'.
jwt_claim = VALUE #(  iss = 'UserID'
                      sub = 'example@gmail.com'
                      aud = 'https://login.example.com'
                      exp = exp_second ).

ssf_info = VALUE #( id = ssf_id profile = ssf_profile ).

CREATE OBJECT jwt_generator.
TRY.
    jwt_generator->generate_jwt(
      EXPORTING
        jwt_header     = jwt_header
        jwt_claim      = jwt_claim
        ssf_info       = ssfinfo
      RECEIVING
        jwt            = DATA(jwt) ).
  CATCH zcx_jwt_generator INTO DATA(lo_exp).
    WRITE /: 'ERROR when generate JWT token.'.
    WRITE /: lo_exp->get_text( ).
ENDTRY.

Demo 3 - method get_access_token_by_profile().

If JWT profile is maintained in table ZJWT_PROFILE, use method get_access_token_by_profile() to get JWT Access Token.

JWT profile screenshot

DATA: jwt_generator TYPE REF TO zcl_jwt_generator,
      jwt_access_token TYPE string.

CREATE OBJECT jwt_client.
jwt_access_token = jwt_client->get_access_token_by_profile( 'JWT_PROFILE_NAME' ).

Demo 4 - method generate_jwt_with_secret().

You can use method generate_jwt_with_secret() to generate a JWT with the secret key, like JWT Debugger.

GET TIME STAMP FIELD DATA(timestamp).

DATA(jwt_generator) = NEW zcl_jwt_generator( ).

TRY.
    DATA(jwt_result) =
        jwt_generator->generate_jwt_with_secret(
            jwt_header = VALUE #( alg  = 'HS256' typ = 'JWT' )
            jwt_claim  = VALUE #( sub  = '1234567890'
                                  name = 'John Doe'
                                  iat  = jwt_generator->convert_abap_timestamp_to_unix( timestamp ) )
            secret     = '1WRAv0Usf90-jr2W7UQBQBLvIBBFq8vumq-VzrR3h7E'
            algorithm  = 'SHA256' ).
  CATCH zcx_jwt_generator INTO DATA(lx_jwt).
ENDTRY.

Credits and references

Class ZCL_JWT_Generator is modified from Dimitri Seifmann's post Connect from AS ABAP to Google Cloud Platform App-Engine resource secured with Google Identity-Aware Proxy.

MIT, read
Authentication
  1. abap-pwnedpasswordsChecks passwords against Have I Been Pwned from ABAP
  2. abapOAuthAzureOA2C_SPECIFICS implementation for Microsoft Azure OAuth 2.0 in ABAP
  3. abap2oauth2ABAP API for OAuth 2.0 authentication
  4. abapNTLMHTTP NTLM client for ABAP
  5. abap_cloud_platformTypeScript library reaching ABAP service instances on Cloud Foundry
  6. decodesapsso2TypeScript decoder for MYSAPSSO2 logon tickets
  7. Cloud ConnectorSAP's on-premises agent linking SAP BTP to customer-network systems
  8. abap-aws-sigv4Signs outbound HTTP calls to AWS APIs with AWS Signature Version 4, directly from ABAP.

Details

Sources3
dotabapdiscovered herechecked
github.com/abapChaoLiu/abap_jwt_generatortree, pushes, contributors, CIchecked
README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
discovered viadotabap
first seen in the atlas
ecosystem and domainabap, security-and-compliance
abaplint
issues under its own abaplint configuration0
lines592
statements248
objects4
files5
analysed, master
abaplint version2.120.84
Contributors2

From the repository’s contributor list, .

History in the atlas1
  1. First seen.
For your agent
Ref
artifact:abapchaoliu-abap-jwt-generator
JSON
/artifacts/abapchaoliu-abap-jwt-generator.json
MCP
Connecting an agent