https://github.com/mastercard/send-util-crossborder-oauth2
https://github.com/mastercard/send-util-crossborder-oauth2
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/mastercard/send-util-crossborder-oauth2
- Owner: Mastercard
- License: other
- Created: 2022-04-19T06:09:06.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-04-17T19:45:11.000Z (over 3 years ago)
- Last Synced: 2026-04-21T16:31:35.222Z (3 months ago)
- Language: Java
- Size: 23.4 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
## OAUTH2.0 Implementation for Token Generation
This is a OAUTH2.0 Client Utility application to generate the request token. Please see here for more details : [Mastercard Developers](https://developer.mastercard.com/cross-border-services/documentation/getting-started-oauth2/).
This application illustrates the generation of request token required to connect with the cross-border APIs with oauth2 authentication method.
### Setup
- Create an account at [Mastercard Developers](https://developer.mastercard.com/account/sign-up).
- Create a new project and add `Mastercard Cross-Border Services` API to your project. This project will provide access to APIs in sandbox the environment first.
- Download signing key(a zip file will get downloaded). These properties and file will be required in utility to generate request token.
- Select .p12 file from zip, copy it to some folder and give its path with filename.
### Build and Run
- Open OAUTH2 utility application in IDE and dependencies will be downloaded automatically. Open the maven window,
- Select MasterCard Cross-border Services - Oauth2Token - API
- Select Life cycle
- Run clean and install
### Decoding Request token
| Token Attributes | Significance | Possible Values |
| --------------------------| --------------------------------------------------|----------------------------------------------------------|
| x5t#S256 | Certificate thumbprint | Signature public key
| kid | Consumer key of cert | Consumer Key which we will get from DevZone
| cty | Content Type | JWS
| typ | JOSE object type | JWT
| alg | JWS Algorithm | RS256 / ES256
| nbf | Not before Date | auto populated
| exp | Expiry date | auto populated
| iat | Issued At date | auto populated
| jti | Unique JWT id | JWT Generated id
### Executing the use cases
**Generate a sample token**
- Go to [project folder](\src\test\java\com\mastercard\oauth2\requesttoken\generator), Open Oauth2RequestTokenGeneratorTest.java
- To generate sample token, pass required input parameters.
- Right click on testGenerateToken() method in the class and run. You will get the request token.