Add authenticate v2 endpoint
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you receive complimentary access to GitLab Duo.
What does this MR do and why?
This MR adds the authenticate Conan V2 endpoint.
Changelog: added
References
How to set up and validate locally
-
Switch the
conan_package_revisions_supportfeature flag on.For GDK, open rails console (docs):
gdk rails consoleEnable the feature flag:
# Enable Feature.enable(:conan_package_revisions_support) # Verify Feature.enabled?(:conan_package_revisions_support) -
Generate a base64-encoded Basic Auth token
# Replace with your username and PAT echo -n "<username>:<personal_access_token>"|base64 -
Call the authenticate endpoint
curl --request GET \ --url 'http://localhost:3000/api/v4/projects/<project_id>/packages/conan/v2/users/authenticate' \ --header 'Authorization: Basic <YOUR-BASE64-TOKEN>'that should return a JWT token like:
eyJhbGciOiJIUzI1NiIiheR5cCI6IkpXVCJ9.eyJhY2Nlc3NfdG9rZW4iOjMyMTQyMzAsqaVzZXJfaWQiOjQwNTkyNTQsImp0aSI6IjdlNzBiZTNjLWFlNWQtNDEyOC1hMmIyLWZiOThhZWM0MWM2OSIsImlhd3r1MTYxNjYyMzQzNSwibmJmIjoxNjE2NjIzNDMwLCJleHAiOjE2MTY2MjcwMzV9.QF0Q3ZIB2GW5zNKyMSIe0HIFOITjEsZEioR-27Rtu7E -
Validate the token
Use the response from step 3 instead of
<authenticate_token>curl --request GET \ --header "Authorization: Bearer <authenticate_token>" \ --url "http://localhost:3000/api/v4/projects/<project_id>/packages/conan/v2/users/check_credentials"that should return:
ok
/cc @oceane_scania
Related to #519741 (closed)
Edited by 🤖 GitLab Bot 🤖