-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add chat provisioning #16
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
Open
gsanchietti
wants to merge
4
commits into
master
Choose a base branch
from
chat
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,16 +1,63 @@ | ||
| # ctiapp-authproxy | ||
|
|
||
| Authentication proxy for Acrobits application. | ||
| This repository contains a PHP proxy used to authenticate against a CTI cloud and return configuration to clients (SIP credentials, phonebook, quick dials). The main logic is in `app/index.php`. | ||
|
|
||
| The application needs a `TOKEN` environment application on startup. | ||
| The application needs the following environment variable on startup: | ||
| - `TOKEN`: a secret token used to validate incoming requests | ||
| - `VALIDATE_LK_URL`: URL to validate user credentials against a remote server | ||
| - `DEBUG`: optional, if set to "true" enables debug logging | ||
|
|
||
| Each request must be a POST request containing a JSON object. | ||
| The object must have the following fields: | ||
| - `username` | ||
| - `password` | ||
| - `token`: it's a SHA256 hash, it must be the same passed to the application at startup | ||
|
|
||
| Example with curl: | ||
| ## Local testing | ||
|
|
||
| Below are minimal steps and examples to test the application locally without Docker. These examples assume you have PHP 8+ installed and are running them from the repository root. | ||
|
|
||
| 1) Set environment variables required by the app (example values): | ||
|
|
||
| ```bash | ||
| export TOKEN="localtesttoken" | ||
| export VALIDATE_LK_URL="https://httpbin.org/status/200" # This is a fake endpoint for testing | ||
| export DEBUG="true" | ||
| ``` | ||
|
|
||
| 2) Start a built-in PHP web server to serve the `app` directory: | ||
|
|
||
| ```bash | ||
| php -S 127.0.0.1:8000 -t app/ | ||
| ``` | ||
|
|
||
| 3) Healthcheck (quick): | ||
|
|
||
| ```bash | ||
| curl -i http://127.0.0.1:8000/index.php/healthcheck | ||
| ``` | ||
| curl -d '{"username": "myuser@demo.example.com", "password": "mypass", "token": "11223344"}' https://ctiapp-authproxy.example.com | ||
|
|
||
| 4) Test the `login` flow (replace with real or mocked endpoints): | ||
|
|
||
| ```bash | ||
| curl -i -X POST http://127.0.0.1:8000/index.php \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{"username":"alice@cti.example.com","password":"secret","token":"localtesttoken","app":"login"}' | ||
| ``` | ||
|
|
||
| 5) Test the `contacts` flow: | ||
|
|
||
| ```bash | ||
| curl -i -X POST http://127.0.0.1:8000/index.php \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{"username":"alice@cti.example.com","password":"secret","token":"localtesttoken","app":"contacts"}' | ||
| ``` | ||
|
|
||
| 6) Test the `quickdial` flow: | ||
|
|
||
| ```bash | ||
| curl -i -X POST http://127.0.0.1:8000/index.php \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{"username":"alice@cti.example.com","password":"secret","token":"localtesttoken","app":"quickdial"}' | ||
| ``` |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.