{"id":15294771,"url":"https://github.com/casdoor/casdoor-spring-boot-starter","last_synced_at":"2025-04-05T02:10:22.001Z","repository":{"id":43893470,"uuid":"387429211","full_name":"casdoor/casdoor-spring-boot-starter","owner":"casdoor","description":"Spring Boot 2.x \u0026 3.x Starter for Casdoor, see example at: https://github.com/casdoor/casdoor-spring-boot-example","archived":false,"fork":false,"pushed_at":"2024-10-18T12:23:38.000Z","size":56,"stargazers_count":18,"open_issues_count":0,"forks_count":20,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T01:13:06.701Z","etag":null,"topics":["casdoor","java","oauth","oidc","saml","sdk","spring-boot","spring-boot-2","spring-boot-3","springboot","sso"],"latest_commit_sha":null,"homepage":"https://mvnrepository.com/artifact/org.casbin/casdoor-spring-boot-starter","language":"Java","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":"CODE_OF_CONDUCT.md","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":"2021-07-19T10:43:58.000Z","updated_at":"2024-10-18T12:22:36.000Z","dependencies_parsed_at":"2023-01-23T17:15:11.119Z","dependency_job_id":"a66f3ade-dd53-4702-935c-ada322ad1fe2","html_url":"https://github.com/casdoor/casdoor-spring-boot-starter","commit_stats":{"total_commits":29,"total_committers":14,"mean_commits":"2.0714285714285716","dds":0.7586206896551724,"last_synced_commit":"9681527fef23468b044eb845314a67a7befd3254"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casdoor%2Fcasdoor-spring-boot-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casdoor%2Fcasdoor-spring-boot-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casdoor%2Fcasdoor-spring-boot-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casdoor%2Fcasdoor-spring-boot-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/casdoor","download_url":"https://codeload.github.com/casdoor/casdoor-spring-boot-starter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247276189,"owners_count":20912288,"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","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":["casdoor","java","oauth","oidc","saml","sdk","spring-boot","spring-boot-2","spring-boot-3","springboot","sso"],"created_at":"2024-09-30T17:06:53.116Z","updated_at":"2025-04-05T02:10:21.981Z","avatar_url":"https://github.com/casdoor.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Casdoor SpringBoot Starter\n\n[![build](https://github.com/casdoor/casdoor-spring-boot-starter/actions/workflows/maven-ci.yml/badge.svg)](https://github.com/casdoor/casdoor-spring-boot-starter/actions/workflows/maven-ci.yml)\n[![License](https://img.shields.io/github/license/casdoor/casdoor-spring-boot-starter.svg?style=flat-square\u0026color=blue)](http://www.apache.org/licenses/LICENSE-2.0.txt)\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](code_of_conduct.md)\n[![SpringBootVersion](https://img.shields.io/badge/SpringBoot-2.5.2-heightgreen.svg?style=flat-square)](https://spring.io/projects/spring-boot)\n[![Javadocs](https://www.javadoc.io/badge/org.casbin/casdoor-spring-boot-starter.svg)](https://www.javadoc.io/doc/org.casbin/casdoor-spring-boot-starter)\n[![Maven Central](https://img.shields.io/maven-central/v/org.casbin/casdoor-spring-boot-starter.svg)](https://mvnrepository.com/artifact/org.casbin/casdoor-spring-boot-starter/latest)\n[![Release](https://img.shields.io/github/release/casdoor/casdoor-spring-boot-starter.svg)](https://github.com/casdoor/casdoor-spring-boot-starter/releases/latest)\n[![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord\u0026label=discord\u0026color=5865F2)](https://discord.gg/5rPsrAzK7S)\n\nCasdoor SpringBoot Starter is designed to help you easily integrate [Casdoor](https://github.com/casbin/casdoor) into\nyour Spring Boot project.\n\n## What you need\n\nThe Casdoor should be deployed.\n\nYou can refer to the Casdoor official documentation for the [Server Installation](/docs/basic/server-installation).\n\nAfter a successful deployment, you need to ensure:\n\n- The Casdoor server is successfully running on **http://localhost:8000**.\n- Open your favorite browser and visit **http://localhost:7001**, you will see the login page of Casdoor.\n- Input `admin` and `123` to test login functionality is working fine.\n\n\n## Quickstart\n\n### Include the dependency\n\nAdd ```casdoor-spring-boot-starter``` to the Spring Boot project.\n\nFor Apache Maven:\n\n```Maven\n\u003c!-- https://mvnrepository.com/artifact/org.casbin/casdoor-spring-boot-starter --\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.casbin\u003c/groupId\u003e\n    \u003cartifactId\u003ecasdoor-spring-boot-starter\u003c/artifactId\u003e\n    \u003cversion\u003e1.x.y\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nFor Gradle:\n\n```gradle\n// https://mvnrepository.com/artifact/org.casbin/casdoor-spring-boot-starter\nimplementation group: 'org.casbin', name: 'casdoor-spring-boot-starter', version: '1.x.y'\n```\n\n### Configure your properties\n\nInitialization requires 6 parameters, which are all string type.\n\n| Name (in order)  | Must | Description                                         |\n|------------------|------|-----------------------------------------------------|\n| endpoint         | Yes  | Casdoor Server Url, such as `http://localhost:8000` |\n| clientId         | Yes  | Application.client_id                               |\n| clientSecret     | Yes  | Application.client_secret                           |\n| certificate      | Yes  | The public key for the Casdoor application's cert   |\n| organizationName | Yes  | Application.organization                            |\n| applicationName  | No   | Application.name                                    |\n\nYou can use Java properties or YAML files to init as below.\n\nFor properties:\n\n```properties\ncasdoor.endpoint = http://localhost:8000\ncasdoor.clientId = \u003cclient-id\u003e\ncasdoor.clientSecret = \u003cclient-secret\u003e\ncasdoor.certificate = \u003cjwt-public-key\u003e\ncasdoor.organizationName = built-in\ncasdoor.applicationName = app-built-in\n```\n\nFor yaml:\n\n```yaml\ncasdoor:\n  endpoint: http://localhost:8000\n  client-id: \u003cclient-id\u003e\n  client-secret: \u003cclient-secret\u003e\n  certificate: \u003cjwt-public-key\u003e\n  organization-name: built-in\n  application-name: app-built-in\n```\n\n### Get the Service and use\n\nNow provide 5 services: `CasdoorAuthService`, `CasdoorUserService`, `CasdoorEmailService`, `CasdoorSmsService` and `CasdoorResourceService`.\n\nYou can create them as below in SpringBoot project.\n\n```java\n@Resource\nprivate CasdoorAuthService casdoorAuthService;\n```\n\nExamples of APIs are shown below.\n\n- CasdoorAuthService\n  - `String token = casdoorAuthService.getOAuthToken(code, \"app-built-in\");`\n  - `CasdoorUser casdoorUser = casdoorAuthService.parseJwtToken(token);`\n- CasdoorUserService\n  - `CasdoorUser casdoorUser = casdoorUserService.getUser(\"admin\");`\n  - `CasdoorUser casdoorUser = casdoorUserService.getUserByEmail(\"admin@example.com\");`\n  - `CasdoorUser[] casdoorUsers = casdoorUserService.getUsers();`\n  - `CasdoorUser[] casdoorUsers = casdoorUserService.getSortedUsers(\"created_time\", 5);`\n  - `int count = casdoorUserService.getUserCount(\"0\");`\n  - `CasdoorResponse response = casdoorUserService.addUser(user);`\n  - `CasdoorResponse response = casdoorUserService.updateUser(user);`\n  - `CasdoorResponse response = casdoorUserService.deleteUser(user);`\n- CasdoorEmailService\n  - `CasdoorResponse response = casdoorEmailService.sendEmail(title, content, sender, receiver);`\n- CasdoorSmsService\n  - `CasdoorResponse response = casdoorSmsService.sendSms(randomCode(), receiver);`\n- CasdoorResourceService\n  - `CasdoorResponse response = casdoorResourceService.uploadResource(user, tag, parent, fullFilePath, file);`\n  - `CasdoorResponse response = casdoorResourceService.deleteResource(file.getName());`\n\n## What's more\n\nYou can explore the following projects/docs to learn more about the integration of Java with Casdoor.\n\n- [casdoor-java-sdk](https://github.com/casdoor/casdoor-java-sdk)\n- [casdoor-spring-boot-example](https://github.com/casdoor/casdoor-spring-boot-example)\n- [casdoor-spring-boot-security-example](https://casdoor.org/docs/category/spring-security)\n- [casdoor-spring-boot-shiro-example](https://github.com/casdoor/casdoor-spring-boot-shiro-example)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasdoor%2Fcasdoor-spring-boot-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcasdoor%2Fcasdoor-spring-boot-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasdoor%2Fcasdoor-spring-boot-starter/lists"}