https://github.com/mopp/mseauth
https://github.com/mopp/mseauth
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/mopp/mseauth
- Owner: mopp
- Created: 2021-05-16T16:22:09.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-05-16T16:22:29.000Z (about 5 years ago)
- Last Synced: 2025-03-26T03:04:28.359Z (about 1 year ago)
- Language: Elixir
- Size: 35.2 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mseauth
Authentication and distributed session management.
## How to run
```console
mix deps.get
mix compile
iex -S mix
```
## How to run with cluster.
```console
> docker-compose build
> docker-compose run --rm --service-ports mseauth1 mix release --overwrite
> docker-compose run --rm --service-ports mseauth1 mix ecto.create
> docker-compose up
> curl -X POST -H "Content-Type: application/json" http://0.0.0.0:8080/register -d '{"identifier": "mopp", "password": "lgtm"}'
{"status":"succeeded"}%
> curl -X POST -H "Content-Type: application/json" http://0.0.0.0:8080/authenticate -d '{"identifier": "mopp", "password": "lgtm"}'
{"access_token":{"expired_at":"2021-05-16T16:58:04","value":"77a2c4a3-48f9-421a-ab2c-87cfafc3690f"},"identifier":"f87bd5f4-bf1b-467c-a515-b6678dc9be25","refresh
_token":{"expired_at":"2021-05-16T18:58:04","value":"c22cd5bf-bf18-49d4-8999-2b4494b227bf"},"status":"succeeded"}%
> curl -X POST -H "Content-Type: application/json" http://0.0.0.0:8080/validate -d '{"access_token": "77a2c4a3-48f9-421a-ab2c-87cfafc3690f"}'
{"identifier":"f87bd5f4-bf1b-467c-a515-b6678dc9be25","status":"succeeded"}%
> mix end_to_end_test
```
Clean up the database.
```console
> docker-compose run --rm --service-ports mseauth1 mix ecto.drop
> docker-compose run --rm --service-ports mseauth1 mix ecto.create
```
## How to test
```console
> docker-compose up -d postgres
> MIX_ENV=test mix ecto.create
> mix test
```