Bca.Jwt
Description
Bca.Jwt is a PowerShell module used to interract with JSON Web Token (JWT).
It can be used to create new tokens, test tokens, convert a raw token to an object to check properties, and back to a token.
Disclaimer
- Bca.Jwt has been created to answer my needs, but I provide it to people who may need such a tool.
- So far, only RS and HS algorithms are supported:
- HS algorithm tokens are signed with a secret
- RS algorithm tokens can be signed either by specifying the certificate private key, or the certificate containing its private key
- It may contain bugs or lack some features, in this case, feel free to open an issue, and I'll manage it as best as I can.
- This GitHub repository is not the primary one, but you are welcome to contribute, see transparency for more information.
Dependencies
(none)
Examples
Convert a raw token to an object
"eyJxxxxx.eyJyyyyyy.zzzzzz" | ConvertFrom-JwtToken
Convert a token object to raw token
$TokenObject = "eyJxxxxx.eyJyyyyyy.zzzzzz" | ConvertFrom-JwtToken
$TokenObject | ConvertTo-JwtToken
Documentation
Find extended documentation at this page.
How to install
The easiest way
In a PowerShell console, run the following:
Find-Module -Name Bca.Jwt | Install-Module
Package
Bca.Jwt is available as a package from PowerShell Gallery, NuGet and Chocolatey*, please refer to each specific plateform on how to install the package.
* Availability on Chocolatey is subject to approval.
Manually
If you decide to install Bca.Jwt manually, copy the content of src
into one or all of the path(s) contained in the variable PSModulePath
depending on the scope you need.
I'll advise you use a path with the version, that can be found in the module manifest psd1
file (e.g. C:\Program Files\WindowsPowerShell\Modules\Bca.Jwt\1.0.0
). In that case copy the content of src/Bca.Jwt
in this path.
Transparency
Please not that to date I am the only developper for this module.
- All code is primarily stored on a private Git repository on Azure DevOps;
- Issues opened in GitHub create a bug in Azure DevOps;
- All pushes made in GitHub are synced to Azure DevOps (that includes all branches except
master
); - When a GitHub Pull Request is submitted, it is analyzed and merged in
develop
on GitHub, then synced to Azure DevOps that will trigger the CI; - A Pull Request is then submitted in Azure DevOps to merge
develop
tomaster
, it runs the CI again; - Once merged to
master
, the CI is one last time, but this time it will create a Chocolatey and a NuGet packages that are pushed on private Azure DevOps Artifacts feeds; - If the CI succeeds and the packages are well pushed, the CD is triggered.
CI
The CI is an Azure DevOps build pipeline that will:
- Test the module and does code coverage with Pester;
- Run the PSScriptAnalyzer;
- Mirror the repository to GitHub
CD
The CD is an Azure DevOps release pipeline is trigerred that will:
- In a Prerelease step, install both Chocolatey and Nuget packages from the private feed in a container, and run tests again. If tests are successful, the packages are promoted to
@Prerelease
view inside the private feed; - In a Release step, publish the packages to NuGet and Chocolatey, and publish the module to PowerShell Gallery, then promote the packages to to
@Release
view inside the private feed.