https://github.com/znsio/specmatic_custom_auth_header_demo
https://github.com/znsio/specmatic_custom_auth_header_demo
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/znsio/specmatic_custom_auth_header_demo
- Owner: znsio
- Created: 2024-12-09T17:54:17.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-10T01:14:46.000Z (over 1 year ago)
- Last Synced: 2025-04-24T01:17:55.661Z (about 1 year ago)
- Size: 1.95 KB
- Stars: 0
- Watchers: 9
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Specmatic custom auth header demo
## Overview
This sample project showcases use of a custom authentication header for secure communication. Below are the key details about authentication and testing:
### Authentication
* The API requires a custom authorization header named X-Microtoken to authenticate requests.
* To facilitate this, a security scheme named MicroToken has been defined in the API specification.
* This header should be populated with a valid token during API calls to ensure successful authentication.
### Specmatic - Testing with Authorization Header
Here's a quick overview on how to test this API using Specmatic:
* Set the Security Scheme - Export the security token as an environment variable. For example:
```bash
export MicroToken=YOUR_VALID_TOKEN
```
* Start Specmatic Test - Run your Specmatic tests.
```bash
java -jar specmatic test
```
Specmatic will automatically pick up the MicroToken environment variable and apply it as the custom security header (X-Microtoken) to all API calls.
For more details please refer to the [Specmatic Auth & Auth documentation](https://specmatic.io/documentation/authentication.html#testing-with-real-auth)