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

Authentication against private gitlab instance #6

Open
dosper7 opened this issue Jan 17, 2025 · 1 comment
Open

Authentication against private gitlab instance #6

dosper7 opened this issue Jan 17, 2025 · 1 comment

Comments

@dosper7
Copy link

dosper7 commented Jan 17, 2025

Hello, I've seen you comment in here but reading your github readme.md file you mentioned this:

Authentication is outside the scope of this project. However, I've tested both Personal Access Tokens and OAuth. They work just fine.

However, I'm not understanding how are you doing the authentication. If I understood correctly, this library generates the nuget package with the correct gitlab links, so source link works well. I've used and tested this library, I have a CICD pipeline that packs and pushes the nuget to our private nuget registry (in gitlab).

When I consume the nuget in a consumer project in my local machine, the nuget comes without that info. I use the same command locally as in the pipeline.

can you help clarify?

@Genbox
Copy link
Owner

Genbox commented Jan 20, 2025

It depends on the IDE used (and the underlying tooling). Ideally, your IDE should connect to the authenticated endpoint and get a 401 (Unauthorized) response. In that case, the IDE should redo the request but use credentials from a credential manager.

I use Jetbrains Rider, and the way it works, is to send a HTTP HEAD request to the server, it gets a 404 response back from GitLab (self managed), then it asks the user for credentials.

Image

I enter the credentials (username + personal access token) and GitLab now authorizes the request.

Image

The credentials are then saved to Windows Credential Manager and automatically used on the next requests.

I haven't tried it with any other IDE, but they should support authenticated requests to GitLab, GitHub, etc. already. The source link provider I've made, simply creates the correct links to the source files, everything else should be handled as with any other provider.

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

2 participants