Go to your external Jenkins route.
To configure JWT authentication:
-
Go to Manage Jenkins
-
Under Security, select Configure Global Security
-
Under Authentication > Security Realm, select JWT Header Authentication Plugin
Under Global JWT Auth Settings, you’ll see form fields where you can enter JWT claims. Pomerium forwards a user’s associated identity information in a signed attestation JWT that’s included in upstream requests in an X-Pomerium-Jwt-Assertion
header.
With the JWT Auth plugin installed, Jenkins can receive and parse the assertion header to authenticate users – you just need to give it the right instructions to find the header and JWT claims.
Enter the following information in the Global JWT Auth Settings field:
Table 1. Global JWT Auth Settings
Field |
Value |
Header name |
x-pomerium-jwt-assertion
|
Username claim name |
name or email
|
Groups claim name |
groups
|
Groups claim list separator |
,
|
Email claim name |
email
|
Acceptable issuers |
authenticate.corp.example.com
|
Acceptable audiences |
jenkins.corp.example.com
|
JWKS JSON URL |
https://jenkins.corp.example.com/.well-known/pomerium/jwks.json
|
Note the following details about the fields above:
-
Username claim name can be either your name or email
-
Acceptable issuers must be the URL of the authentication domain that issued the JWT. The iss
claim tells the target application who the issuing authority is and provides context about the subject.
-
Acceptable audiences must be the URL of the target application. The aud
claim defines what application the JWT is intended for.
-
JWKS JSON URL appends /.well-known/pomerium/jwks.json
to the external route URL. The JWKS endpoint provides Jenkins the user’s public key to verify their JWT signature.
You can go to the external verify
route defined in your policy to view your JWT claims.
In the Authorization dropdown, configure Jenkins permissions so that Anonymous has Administer privileges.
-
Select Matrix-based security
-
Under Overall, assign Administer to Anonymous and Authenticated Users
If JWT authentication doesn’t authenticate you successfully, Jenkins signs you in as an anonymous user. With administer privileges, you can troubleshoot JWT settings as an anonymous user and try again.
Select save to apply the security settings.
Test JWT authentication
Restart your container. If the JWT authentication worked, your name appears in the dashboard instead of admin. To see more details about the request, add /whoAmI
to the URL. For example, https://jenkins.localhost.pomerium.io/whoAmI
.