Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: use app tokens for authentication #55

Open
cboehm-it opened this issue Feb 16, 2024 · 5 comments
Open

feature: use app tokens for authentication #55

cboehm-it opened this issue Feb 16, 2024 · 5 comments

Comments

@cboehm-it
Copy link

I want to use CaPyCLI inside an automated pipeline. Therefore it's not recommended to use personal tokens because they are coupled directly with the personal user account of Github.

Idea

  1. I create a Github App with necessary rights which can be shared between multiple people.
  2. With the ClientId, ClientSecret and ClientCertificate I generate a short-living JWT-Token each time the pipeline runs.
    src: Generating a JSON Web Token (JWT) for a GitHub App

Expected Change

Requests with this authentication look a bit different.
src: Authentifizieren bei der REST-API

Here is an example of searching repositiories.

curl --request GET \
  --url 'https://api.github.com/search/repositories?q=Sowas' \
  --header 'Accept: application/vnd.github+json' \
  --header 'Authorization: Bearer <jwt-token>' \
  --header 'X-GitHub-Api-Version: 2022-11-28' \
  --cookie logged_in=no
@gernot-h
Copy link
Collaborator

@cboehm-it, perhaps it's only me, but I'm a bit confused about your idea. Is this about CI integration of CaPyCli? How would this affect authentication with SW360?

@cboehm-it
Copy link
Author

Hey @gernot-h ,
you are right, it's about using CaPyCli inside a CI. I do not understand your question fully.
Why should the authentication against Github affect authentication against SW360?

@tngraf
Copy link
Collaborator

tngraf commented Feb 22, 2024

@cboehm-it Hm, I also do not really get the issue. Why should someone authenticate against GitHub? The only thing that CaPyCLI requires is access to SW360, depending on the use case either read-only or read-write.

@cboehm-it
Copy link
Author

Hey @gernot-h and @tngraf,
it has nothing to do with SW360. You're mixing something up. CaPyCli has a functionality to get the sources of the BOM file. (bom findsources)
Therefore CaPyCli uses the official API of Github to retrieve information about that. To have a bit more requests per hour you can add the parameters with an username and a token of your personal Github user.

My idea is now that I can give CaPyCli the credentials of a Github App not from my personal user.

@gernot-h
Copy link
Collaborator

Ah, got it now, sorry. We're speaking about capycli bom findsources -gt. That's a part of CaPyCli I don't know that well, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants