[JIRA] (JENKINS-56520) Support for Bearer Token (needed for REST-Api calls from scripts)

2 views
Skip to first unread message

robert.schmidl@hansemerkur.de (JIRA)

unread,
Mar 12, 2019, 4:11:20 AM3/12/19
to jenkinsc...@googlegroups.com
Robert Schmidl created an issue
 
Jenkins / New Feature JENKINS-56520
Support for Bearer Token (needed for REST-Api calls from scripts)
Issue Type: New Feature New Feature
Assignee: D. Lauer
Components: keycloak-plugin
Created: 2019-03-12 08:10
Environment: Jenkins version: 2.150.2
Keycloak plugin version: 2.3.0
Priority: Minor Minor
Reporter: Robert Schmidl

We want to start Jenkins-Jobs remotely via shell-scripts and REST-API.
For other similar use cases where we call REST-Apis using Keycloak authentication the scripts

  • fetch an access token (type bearer) from Keycloak. Either using username/password or an offline token
  • then this bearer token is used to call the Rest-APIs. The bearer token is added as header in the HTTP-Request (e.g. -H "Authorization: Bearer $ACCESS_TOKEN" using curl)

We would like to do this also with Jenkins and the Keycloak plugin.

I do not know enough about Jenkins plugins and Keycloak to provide a decent implementation, but I created a working quick and dirty one:
https://github.com/vsgfe/keycloak-plugin/commit/e5606c2198b8ff8a44c394139cc9bb2866c331f4

It adds a filter that checks for an authorization header with a bearer token. If one is found, the token is checked and the login is set.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

jeanpierrefouche@gmail.com (JIRA)

unread,
Jan 31, 2020, 9:15:03 AM1/31/20
to jenkinsc...@googlegroups.com
Jean-Pierre Fouche updated an issue
Change By: Jean-Pierre Fouche
Priority: Minor Blocker
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages