-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #323 from finos/321-bake-in-api-authorization-into…
…-v110-documentation
- Loading branch information
Showing
9 changed files
with
148 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
--- | ||
title: Approving a push | ||
description: How to approve a push in Git Proxy | ||
--- | ||
|
||
All pushes that flow through Git Proxy require an approval (authorisation). Until a push is approved, Git Proxy will block the commits from being sent to the upstream repository. To approve a push, you can use the REST API or web UI. | ||
|
||
## Using the REST API | ||
|
||
### Prerequisites | ||
|
||
- Proxy and REST API are running ([default behaviour](https://github.com/finos/git-proxy/blob/main/index.js)) | ||
- Proxy and REST API are running on `localhost:8000` and `localhost:8080`, respectively | ||
- [Intercepting a push](/docs/quickstart/intercept) instructions have been followed and you've reached [Push via Git Proxy](/docs/quickstart/intercept#push-via-git-proxy) | ||
- [`curl`](https://curl.se/) is installed | ||
|
||
### Instructions | ||
|
||
#### 1. Find the tracking `ID` | ||
|
||
Following on from [Push via Git Proxy](/docs/quickstart/intercept#push-via-git-proxy), you'll receive a unique URL: | ||
|
||
``` | ||
http://localhost:8080/requests/0000000000000000000000000000000000000000__79b4d8953cbc324bcc1eb53d6412ff89666c241f | ||
``` | ||
|
||
The `ID` for your push corresponds to the last part of the URL: | ||
|
||
``` | ||
0000000000000000000000000000000000000000__79b4d8953cbc324bcc1eb53d6412ff89666c241f | ||
``` | ||
|
||
#### 2. Authenticate with the API | ||
|
||
Use the default & auto-generated Git Proxy username & password credentials to obtain a cookie. The cookie value is saved to a file (`git-proxy-cookie`): | ||
|
||
```bash | ||
curl -H "Content-Type: application/json" -c git-proxy-cookie -X POST \ | ||
-d '{"username":"admin","password":"admin"}' http://localhost:8080/auth/login | ||
``` | ||
|
||
#### 3. Retrieve push with `ID` from database | ||
|
||
Using the [cookie](/docs/quickstart/approve#2-authenticate-with-the-api) generated, execute a `GET` request to confirm that your push with `ID` exists in the database: | ||
|
||
```bash | ||
curl -I -b ./git-proxy-cookie http://localhost:8080/api/v1/push/${ID} | ||
``` | ||
|
||
You should receive a `200 OK` in the response. | ||
|
||
#### 4. Approve the push with `ID` | ||
|
||
Using the same [cookie](/docs/quickstart/approve#2-authenticate-with-the-api) again, send a `POST` command to approve the push: | ||
|
||
```bash | ||
curl -b ./git-proxy-cookie \ | ||
-X POST http://localhost:8080/api/v1/push/${ID}/authorise | ||
``` | ||
|
||
#### 5. Re-push your code | ||
|
||
Execute `git push` to send your approved code through Git Proxy to the upstream repository: | ||
|
||
```bash | ||
$ git push | ||
Enumerating objects: 5, done. | ||
Counting objects: 100% (5/5), done. | ||
Delta compression using up to 10 threads | ||
Compressing objects: 100% (3/3), done. | ||
Writing objects: 100% (3/3), 470 bytes | 470.00 KiB/s, done. | ||
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0 | ||
remote: Resolving deltas: 100% (2/2), completed with 2 local objects. | ||
``` | ||
|
||
## Using the UI | ||
|
||
:::note | ||
|
||
The web UI is under active development. Keep an eye out for updates in our latest [releases](https://github.com/finos/git-proxy/releases). | ||
|
||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters