{"id":33319666,"url":"https://github.com/primait/localauth0","last_synced_at":"2025-12-24T02:58:30.644Z","repository":{"id":39800242,"uuid":"458224957","full_name":"primait/localauth0","owner":"primait","description":"Mock auth0 service for local development","archived":false,"fork":false,"pushed_at":"2025-09-12T09:28:52.000Z","size":294,"stargazers_count":61,"open_issues_count":9,"forks_count":11,"subscribers_count":42,"default_branch":"master","last_synced_at":"2025-09-12T11:38:02.880Z","etag":null,"topics":["auth0","development","docker","oauth","oauth2","openid","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/primait.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-02-11T14:44:41.000Z","updated_at":"2025-09-01T13:08:34.000Z","dependencies_parsed_at":"2023-02-18T13:15:31.869Z","dependency_job_id":"2521b759-4f68-4c45-a1e6-ea72cfb99663","html_url":"https://github.com/primait/localauth0","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"purl":"pkg:github/primait/localauth0","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primait%2Flocalauth0","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primait%2Flocalauth0/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primait%2Flocalauth0/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primait%2Flocalauth0/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/primait","download_url":"https://codeload.github.com/primait/localauth0/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primait%2Flocalauth0/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286079811,"owners_count":27282121,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-24T02:00:07.096Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auth0","development","docker","oauth","oauth2","openid","rust"],"created_at":"2025-11-19T21:02:52.067Z","updated_at":"2025-11-24T16:00:50.373Z","avatar_url":"https://github.com/primait.png","language":"Rust","funding_links":[],"categories":["Developer Ecosystem"],"sub_categories":[],"readme":"# Localauth0\n\n[![Build Status](https://github.com/primait/localauth0/actions/workflows/ci.yml/badge.svg)](https://github.com/primait/localauth0/actions/workflows/ci.yml/badge.svg)\n\n![localauth0](web/assets/static/media/localauth0.png)\n\nLocalauth0 is a project that aims to be a helper while developing\nauthentications inspired by [localstack](https://localstack.cloud/). Most of the\ntime people tend to mock authentication in order to not be forced to create\ncomplex mocks. With localauth0 you can fake your [auth0](https://auth0.com/)\ntenant and test it offline for \"real\".\n\n## Table of contents\n\n- [Installation](#installation)\n- [APIs](#apis)\n  - [Web page](#web-page)\n  - [Jwt](#jwt)\n  - [Jwks](#jwks)\n- [Configuration](#configuration)\n  - [Local development](#local-development)\n  - [Integrate Localauth0 in an existing docker compose project](#integrate-localauth0-in-an-existing-docker-compose-project)\n- [Healthchecks](#healthchecks)\n\n## Installation\n\nIn order to run localauth0 docker image execute the following:\n\n```shell\ndocker run -d -p 3000:3000 public.ecr.aws/primaassicurazioni/localauth0:0.8.3\n```\n\nBy default, the container exposes an http server on the port 3000 and an https\none on port 3001.\n\nNote: The latest version is the same `version` written in the `Cargo.toml` file.\n\n## APIs\n\n### Web page\n\nAfter having run the localauth0 machine a web interface is available at\n\u003chttp://localhost:3000/\u003e. Here it's possible to:\n\n- get a fresh new JWT with given `audience`.\n- add/remove permissions for a given `audience`.\n\n### Jwt\n\n- `POST` \u003chttp://localhost:3000/oauth/token\u003e: used to get a freshly new JWT.\n  Body should be:\n\n  ```json\n  {\n    \"client_id\": \"client_id\",\n    \"client_secret\": \"client_secret\",\n    \"audience\": \"{{your-audience}}\",\n    \"grant_type\": \"client_credentials\"\n  }\n  ```\n  for the client credentials grant and\n\n  ```json\n  {\n    \"client_id\": \"client_id\",\n    \"client_secret\": \"client_secret\",\n    \"grant_type\": \"authorization_code\",\n    \"code\": \"{{your-auth-code}}\"\n  }\n  ```\n  for the authorization code grant.\n\n- `GET` \u003chttp://localhost:3000/permissions\u003e: used to get a the list of all\n  audiences with their associated permissions.\n\n- `POST` \u003chttp://localhost:3000/permissions\u003e: used to set a list of permissions\n  for given audience. Everytime a new JWT is requested for that audience those\n  permissions will be injected in the JWT payload. Body should be:\n\n  ```json\n  {\n    \"audience\": \"{{your-audience}}\",\n    \"permissions\": [\"your-permission-1\", \"your-permission-2\", \"..\"]\n  }\n  ```\n\n- `GET` \u003chttp://localhost:3000/permissions/{audience}\u003e: used to get the list of\n  all permissions for the given audience.\n\n- `GET` \u003chttp://localhost:3000/oauth/token/custom_claims\u003e: used to get the list\n  of custom claims that will be injected in the JWT payload.\n\n- `POST` \u003chttp://localhost:3000/oauth/token/custom_claims\u003e: used to add or\n  update one or more custom claim fields. Body should be:\n\n  ```json\n  {\n    \"custom_claims\": [{\n      \"name\": \"custom_claim_field_name\",\n      \"value\": \"custom claim field value. Can be a string or a list of strings\"\n    }]\n  }\n  ```\n\n- `GET` \u003chttp://localhost:3000/oauth/token/user_info\u003e: used to get the user\n  info.\n\n- `POST` \u003chttp://localhost:3000/oauth/token/user_info\u003e: used to update the user\n  info. Body should be:\n\n  ```json\n  {\n    \"subject\": \"optional field\",\n    \"name\": \"optional field\",\n    \"given_name\": \"optional field\",\n    \"family_name\": \"optional field\",\n    \"nickname\": \"optional field\",\n    \"locale\": \"optional field\",\n    \"gender\": \"optional field\",\n    \"birthdate\": \"optional field\",\n    \"email\": \"optional field\",\n    \"email_verified\": \"optional field\",\n    \"picture\": \"optional field\",\n    \"updated_at\": \"optional field\",\n    \"custom_fields\": \"optional field\"\n  }\n  ```\n\n### Jwks\n\n- `GET` \u003chttp://localhost:3000/.well-known/jwks.json\u003e: it's possible to fetch\n  running instance jwks. Those jwks are randomly created starting from random\n  certificates. Note that every generated JWT will be signed using one of those\n  JWKS.\n\n- `GET` \u003chttp://localhost:3000/rotate\u003e: discard the last JWK of the JWKS list\n  and prepend a freshly new JWK.\n\n- `GET` \u003chttp://localhost:3000/revoke\u003e: discard all the JWKs in the JWKS list\n  and replace them with 3 freshly new JWKs.\n\n## SSO page\n\nLocalauth0 could behave like Google SSO page. In order to achieve this your web\npage should navigate to \u003chttp://localhost:3000/authorize\u003e providing these query\nparams:\n\n- redirect_uri: your web app callback page\n- audience: the audience you want to use to generate the token\n- response_type (optional): could be `token` or `code`. Use `token` to perform\n  an implicit grant flow and retrieve an access token directly and use `code` to\n  perform an authorization code flow and recieve an authorization code. If auth\n  is succesful, the requested redirect is performed with the code or token\n  contained in the query params.\n- state (optional): An opaque value, used for security purposes. If this request\n  parameter is set in the request, then it is returned to the application as\n  part of the `redirect_uri`.\n- bypass (optional): this is a dev feature. If set to true directly redirect to\n  `redirect_uri`.\n\nAfter redirection the redirect_url will contain these http fragments:\n\n- access_token: the JWT token.\n- token_type: always set to `Bearer`.\n- expires_in: when will the jwt expires.\n- state: present if set in authorize url; contains the same value.\n\nFor example navigating to:\n\n\u003chttp://localhost:3000/authorize?redirect_uri=http%3A%2F%2Flocalhost%3A3000%2F\u0026audience=audience1\u0026client_id=client_id\u0026connection=whatever\u0026response_type=token\u0026scope=whatever\u0026state=test-state\u0026bypass=true\u003e\n\nThe page will automatically redirect to:\n\n\u003chttp://localhost:3000/#access_token=eyJ..RrQ\u0026token_type=Bearer\u0026expires_in=3600\u0026state=test-state\u003e\n\n## Configuration\n\nLocalauth0 can be configured using a `localauth0.toml` file (see\n[localauth0.toml](localauth0.toml) as an example) or using the\n`LOCALAUTH0_CONFIG` environment variable.\n\nTake a look [here](#Integrate-localauth0-in-existing-project) to see how to\nconfigure your docker compose cluster.\n\n### Local development\n\nTo build and run localauth0 locally run the following commands:\n\n```shell\ndocker build -f Dockerfile -t localauth0 . \u0026\u0026 \\\ndocker run -it -p 3000:3000 -v .:/code localauth0 bash\n```\n\nKeep in mind that installing `trunk` will take some time.\n\n#### Run localauth0 from within a docker-compose\n\nGet into docker-compose container with:\n\n```shell\ndocker-compose run --service-ports web bash\n```\n\nBuild the artifact, the web dist and run the http server with:\n\n```shell\n# Build the web dist with trunk. Then run the server\ncargo make run\n```\n\nNow website is available at \u003chttp://localhost:3000\u003e.\n\n#### Build and run localauth0 as an image\n\nAs mandatory step it's needed to create the artifact and the web dist. In order\nto achieve this run `cargo make build` or `cargo make run` commands from within\nthe docker-compose container (alternatively from host machine if `cargo` and\n`trunk` are installed).\n\nFor someone this error could occur on host machine\n\n```shell\nerror[E0463]: can't find crate for `core`\n  |\n  = note: the `wasm32-unknown-unknown` target may not be installed\n  = help: consider downloading the target with `rustup target add wasm32-unknown-unknown`\n\nerror[E0463]: can't find crate for `compiler_builtins`\n```\n\nIn order to fix it run\n\n```shell\nrustup target add wasm32-unknown-unknown --toolchain nightly\n```\n\nThen run:\n\n```shell\ndocker build -f Dockerfile -t localauth0 . \u0026\u0026 \\\ndocker run -d -p 3000:3000 localauth0\n```\n\n### Integrate Localauth0 in an existing docker compose project\n\nAdd this snippet to your `docker-compose.yml` file and reference it in your app\n`depends_on` section.\n\n```yaml\nauth0:\n  image: public.ecr.aws/primaassicurazioni/localauth0:0.8.3\n  healthcheck:\n    test: [\"CMD\", \"/localauth0\", \"healthcheck\"]\n  ports:\n    - \"3000:3000\"\n```\n\n#### Configuration using inline environment variable\n\nIt is possible to add the `LOCALAUTH0_CONFIG` environment variable with an\ninline configuration to let Localauth0 load the configuration at startup. For\nexample:\n\n```yaml\nauth0:\n  image: public.ecr.aws/primaassicurazioni/localauth0:0.8.2\n  healthcheck:\n    test: [\"CMD\", \"/localauth0\", \"healthcheck\"]\n  ports:\n    - \"3000:3000\"\n  environment:\n    LOCALAUTH0_CONFIG: |\nissuer = \"https://prima.localauth0.com/\"\n[user_info]\ngiven_name = \"Locie\"\n```\n\n#### Configuration using a config file\n\nAnother way to configure Localauth0 is to mount a configuration file in the\ncontainer. For example, create a `localauth0.toml` file with the following:\n\n```toml\nissuer = \"https://prima.localauth0.com/\"\n\n[user_info]\ngiven_name = \"Locie\"\n```\n\nThen mount the file in the container using the following snippet in your\n`docker-compose.yml` file:\n\n```yaml\nauth0:\n  image: public.ecr.aws/primaassicurazioni/localauth0:0.8.2\n  healthcheck:\n    test: [\"CMD\", \"/localauth0\", \"healthcheck\"]\n  environment:\n    LOCALAUTH0_CONFIG_PATH: /etc/localauth0.toml\n  volumes:\n    - ./localauth0.toml:/etc/localauth0.toml:ro\n  ports:\n    - \"3000:3000\"\n```\n\n### Healthchecks\n\nThe localauth0 binary can perform a healthcheck on the running localauth0\nservice. Simply run `localauth0 healtcheck`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprimait%2Flocalauth0","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprimait%2Flocalauth0","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprimait%2Flocalauth0/lists"}