{"id":20215569,"url":"https://github.com/casdoor/casdoor-cli","last_synced_at":"2025-09-22T01:31:35.917Z","repository":{"id":252418867,"uuid":"840387230","full_name":"casdoor/casdoor-cli","owner":"casdoor","description":"🔑 Command Line Interface (CLI) tool for Casdoor","archived":false,"fork":false,"pushed_at":"2025-06-25T16:45:19.000Z","size":15591,"stargazers_count":3,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-25T17:42:31.737Z","etag":null,"topics":["auth","authentication","authn","bash","cas","casbin","casdoor","cli","client","command-line","identity","oauth","oidc","saml","sdk","shell","sso"],"latest_commit_sha":null,"homepage":"https://github.com/casdoor/casdoor","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/casdoor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-09T15:33:59.000Z","updated_at":"2025-06-25T16:46:53.000Z","dependencies_parsed_at":"2024-08-09T17:35:47.660Z","dependency_job_id":null,"html_url":"https://github.com/casdoor/casdoor-cli","commit_stats":null,"previous_names":["casdoor/casdoor-cli"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/casdoor/casdoor-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casdoor%2Fcasdoor-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casdoor%2Fcasdoor-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casdoor%2Fcasdoor-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casdoor%2Fcasdoor-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/casdoor","download_url":"https://codeload.github.com/casdoor/casdoor-cli/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casdoor%2Fcasdoor-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276333823,"owners_count":25624044,"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-09-21T02:00:07.055Z","response_time":72,"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":["auth","authentication","authn","bash","cas","casbin","casdoor","cli","client","command-line","identity","oauth","oidc","saml","sdk","shell","sso"],"created_at":"2024-11-14T06:23:21.992Z","updated_at":"2025-09-22T01:31:30.904Z","avatar_url":"https://github.com/casdoor.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"img/logo.png\" align=\"right\" height=\"96\"/\u003e\n\n# Casdoor CLI\n\n![licence](https://img.shields.io/badge/licence-GPLv3-lightgray)\n![go version](https://img.shields.io/badge/go_version-1.22.0-green)\n\n*A clean and straightforward command line interface for Casdoor.*\n\n![](img/t-rec.gif)\n\n\u003e ⚠️ This is a student project. I will probably try to release a complete version in the near future as no Casdoor CLI is available yet. For now, this CLI is just a proof of concept.\n\n\u003c!-- TOC --\u003e\n* [Casdoor CLI](#casdoor-cli)\n  * [Description](#description)\n  * [Usage](#usage)\n  * [Features](#features)\n  * [How to install](#how-to-install)\n    * [MacOS](#macos)\n    * [Linux](#linux)\n  * [Configure](#configure)\n    * [Casdoor configuration](#casdoor-configuration)\n    * [Casdoor Cli](#casdoor-cli-1)\n  * [Test and development](#test-and-development)\n    * [Development backend](#development-backend)\n    * [Configuration](#configuration)\n\u003c!-- TOC --\u003e\n\n## Description\n\nCurrently, `casdoor-cli` provides a command line interface able to : \n\n- Manage users in Casdoor (create, edit, delete)\n- Manage users permissions within Casdoor using Casdoor's group feature. Built-in roles are the following :\n    - `lector` : read access only\n    - `editor` : can create users, but cannot edit users nor delete users\n    - `administrator`  : can create, delete, and edit users\n- Manage users groups within Casdoor (create, edit, delete)\n\nCurrently, permissions management is handled using Casdoor's Group feature. Current code checks wether a user is in a group or not and adapt the permissions accordingly. This is due to how Casdoor works, as the `api/add-user` route only allows attaching a group to a user upon creation. \n\n## Usage\n\n\u003e ⚠️ Currently, `casdoor-cli` only supports MacOS and Linux. Tested versions are Debian 12 and MacOS Sonoma. Using WSL on Windows won't work as the CLI relies on GNOME's implementation of Secret Service dbus interface (GNOME Keyring) to store secrets.\n\n```\nUsage:\n  casdoor [command]\n\nAvailable Commands:\n  completion  Generate the autocompletion script for the specified shell\n  groups      Manage Casdoor permissions\n  help        Help about any command\n  login       Login to your Casdoor account\n  logout      Logout from your Casdoor account\n  users       Manage Casdoor users\n\nFlags:\n  -d, --debug   verbose logging\n  -h, --help    help for casdoor\n\n```\n\n## Features\n\n- OAuth2 login via browser using Casdoor's API : \n\n![img.png](img/screenshoot.png)\n\n- Secure token storage using keyring interface :\n\n![keyring.png](img/screenshoot_1.png)\n\n- Fine tuned permissions management :\n\n![permissions.png](img/screenshoot_2.png)\n\n## How to install\n\n### MacOS\n\n```bash\nmake build TARGET_OS=darwin \u0026\u0026 make install TARGET_OS=darwin\n```\n\n### Linux\n\n```bash\nmake build TARGET_OS=linux \u0026\u0026 make install TARGET_OS=linux\n```\n\nYou then need to add `casdoor-cli` to your `PATH`. Depending on your shell, you can do this in one of the following ways:\n\n- bash : `echo 'export PATH=\\\"$(PREFIX)/bin:\\$$PATH\\\"' \u003e\u003e ~/.bashrc`\n- zsh : `echo 'export PATH=\\\"$(PREFIX)/bin:\\$$PATH\\\"' \u003e\u003e ~/.zshrc`\n\n## Configure\n\n### Casdoor configuration\n\nA `init_data.json` file is provided in order to bootstrap Casdoor's configuration so it can be used by `casdoor-cli`. Please refer to the [official documentation](https://casdoor.org/docs/deployment/data-initialization/) to learn how to use it.\n\nYou may also create an application yourself inside Casdoor and fill up the configuration according to your needs.\n\n### Casdoor Cli\n\nOn first launch, `casdoor-cli` will ask you to provide the path to a `config.yaml` file in order to be able to request the Casdoor API. Required field are describe within the `config.yaml.exemple` file : \n\n![](img/screenshoot_3.png)\n\n```\napplication_name:\ncasdoor_endpoint:\ncertificate:\nclient_id:\nclient_secret:\norganization_name:\nredirect_uri:\n```\n\nInformation will then be stored in `~/.casdoor-cli/config.yaml`, encoded in `base64`.\n\n## Test and development\n\n### Development backend\n\nFor local testing and development purposes, a `docker-compose` environment is provided : \n\n```bash\ndocker compose up -d\n```\n\nWait a few secondes before trying to log in as Casdoor container will reboot multiple times in order to initialize Casdoor's database.\n\n### Configuration\n\nCreate a `config.yaml` from the `config.yaml.example` at the root of the repo, with the following content :\n\n```yaml\napplication_name: casdoor-cli\ncasdoor_endpoint: http://localhost:8000\ncertificate: |\n  -----BEGIN CERTIFICATE-----\n  MIIE3TCCAsWgAwIBAgIDAeJAMA0GCSqGSIb3DQEBCwUAMCgxDjAMBgNVBAoTBWFk\n  bWluMRYwFAYDVQQDEw1jZXJ0LWJ1aWx0LWluMB4XDTI0MDQwMTIxNTgwOVoXDTQ0\n  MDQwMTIxNTgwOVowKDEOMAwGA1UEChMFYWRtaW4xFjAUBgNVBAMTDWNlcnQtYnVp\n  bHQtaW4wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDB7cZzw4VWg5Ys\n  MCfsqLfOB8elKtGYZXjIWRUAwWR++EO4y/+6A6BofKibH7hhP39hOhJM6b5KLNZQ\n  S368DcVOiIOpvS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YrRvXXV81FQHYZlGFRMezAUHGq9Qron68YMVforDzvBgxWdiJD\n  IOKK11AaKyWQXes7PQKC2K5Yhg08GMgQXtatR1RpUA3HYuqKG+s3zlfUqRh5giAr\n  Xt+YV6bLdjlWxzYBQQb74WeC6g4YhpW4JOgHJ1tM7El/Ir6kE4QaN/7PM66AVy2C\n  YTLrf5M8R2uASo+1pX4INeBoR8qQIVhkW9KWZHVJXRlhnHbhgSbqshjWVvJHcODN\n  Iglj/acHnQtuMf9sTL6d4eeb99K/nOClh5lNtFLNjy2GPXZVDIfWbEpaBza9kJjc\n  7A==\n  -----END CERTIFICATE-----\nclient_id: ae8ae52c43d23fe00683\nclient_secret: 504df32f2134b3176df2c3eade455319706aeba1\norganization_name: casdoor-cli\nredirect_uri: http://localhost:9000/callback\n```\n\nYou can then try to login using with user `casdoor-cli-admin` and password `123456`: \n\n```bash\ngo run main.go login\n```\n\nOr if you wish to use `casdoor` as a command : \n\n```bash\nmake build TARGET_OS=(darwin|linux) \u0026\u0026 make install TARGET_OS=darwin\ncasdoor login\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasdoor%2Fcasdoor-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcasdoor%2Fcasdoor-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasdoor%2Fcasdoor-cli/lists"}