{"id":18904452,"url":"https://github.com/oopsguy/kaptcha-spring-boot","last_synced_at":"2026-04-04T07:01:25.867Z","repository":{"id":57726880,"uuid":"156356817","full_name":"oopsguy/kaptcha-spring-boot","owner":"oopsguy","description":"Kaptcha Spring Boot Starter help you use Google Kaptcha with Spring Boot easier. 一个简单封装了 Kaptcha 验证码库的 Spring Boot Starter","archived":false,"fork":false,"pushed_at":"2019-05-13T12:42:56.000Z","size":190,"stargazers_count":22,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-02-22T15:42:13.021Z","etag":null,"topics":["captcha","java","kaptcha","security","spring","spring-boot","springboot","starter","verify","yaml"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oopsguy.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}},"created_at":"2018-11-06T09:14:01.000Z","updated_at":"2026-02-07T16:38:29.000Z","dependencies_parsed_at":"2022-09-16T01:25:26.124Z","dependency_job_id":null,"html_url":"https://github.com/oopsguy/kaptcha-spring-boot","commit_stats":null,"previous_names":["12software/kaptcha-spring-boot"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/oopsguy/kaptcha-spring-boot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oopsguy%2Fkaptcha-spring-boot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oopsguy%2Fkaptcha-spring-boot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oopsguy%2Fkaptcha-spring-boot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oopsguy%2Fkaptcha-spring-boot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oopsguy","download_url":"https://codeload.github.com/oopsguy/kaptcha-spring-boot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oopsguy%2Fkaptcha-spring-boot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31390695,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T04:26:24.776Z","status":"ssl_error","status_checked_at":"2026-04-04T04:23:34.147Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["captcha","java","kaptcha","security","spring","spring-boot","springboot","starter","verify","yaml"],"created_at":"2024-11-08T09:08:34.451Z","updated_at":"2026-04-04T07:01:25.843Z","avatar_url":"https://github.com/oopsguy.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kaptcha Spring Boot Starter\n\nKaptcha Spring Boot Starter can help you use [Google Kaptcha](http://code.google.com/p/kaptcha/) with [Spring Boot](https://github.com/spring-projects/spring-boot) easier.\n\n- [中文文档](README_zh-CN.md)\n\n## Usage\n\nAdd `kaptcha-spring-boot-starter` dependency to your `pom.xml` file.\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.oopsguy.kaptcha\u003c/groupId\u003e\n    \u003cartifactId\u003ekaptcha-spring-boot-starter\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.0-beta-2\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Properties\n\nYou can use properties to custom captcha without Java code:\n\n```yaml\nkaptcha:\n  border:\n    enabled: true\n    color: '200,200,200'\n    thickness: 1\n  noise:\n    color: '239,166,131'\n    # you can specify your own implementation\n    impl:\n  obscurificator:\n    impl:\n  producer:\n    impl:\n  background:\n    impl:\n    color-from: '255,0,0'\n    color-to: '255,0,0'\n  text-producer:\n    impl:\n    character:\n      string: '01234567890ABCDEF'\n      length: 4\n      space: 10\n    font:\n      names:\n      color: '255,255,255'\n      size: 46\n  word:\n    impl:\n  image:\n    width: 200\n    height: 60\n  # You can configure multiple captcha\n  # and configure properties for them individually\n  items:\n    home:\n      path: /home/captcha\n      session:\n        key: homeCaptcha\n      background:\n        color-from: '255,255,255'\n        color-to: '255,255,255'\n      text-producer:\n        font:\n          color: '68,155,44'\n    # more items ...\n```\n\n## Examples\n\n### YAML\n\nThe following use yaml to configure common kaptcha properties \nand define two kaptcha servlets(`home` and `admin`),\nyou can configure them in your `application.yml`:\n\n```yaml\nserver:\n  port: 8080\n\nkaptcha:\n  border:\n    enbaled: true\n    image:\n      height: 60\n      width: 160\n  items:\n    # home captcha\n    home:\n      path: /home/capthca\n      text-producer:\n        font:\n          size: 16\n      image:\n        height: 40\n    # admin captcha\n    admin:\n      path: /admin/capthca\n      text-producer:\n        character:\n          length: 4\n```\n\nThen browse [http://localhost:8080/home/capthca](http://localhost:8080/home/capthca) and [http://localhost:8080/admin/capthca](http://localhost:8080/admin/capthca)\n\n### Java Code\n\nYou can also inject a `Producer` bean directly by annotation to generate captcha.\n\n```java\n@Controller\n@RequestMapping(\"/sys\")\nclass SystemController {\n    \n    @Resource\n    private Producer captchaProducer;\n\n    @GetMapping(\"/captcha\")\n    public void getKaptchaImage(HttpServletRequest request, HttpServletResponse response) throws Exception {\n        response.setDateHeader(\"Expires\", 0);\n        response.setHeader(\"Cache-Control\", \"no-store, no-cache, must-revalidate\");\n        response.addHeader(\"Cache-Control\", \"post-check=0, pre-check=0\");\n        response.setHeader(\"Pragma\", \"no-cache\");\n        response.setContentType(\"image/jpeg\");\n        String capText = captchaProducer.createText();\n        // Save the captcha code to the session\n        request.getSession().setAttribute(\"captchaCode\", capText);\n        BufferedImage bi = captchaProducer.createImage(capText);\n        ServletOutputStream out = response.getOutputStream();\n        ImageIO.write(bi, \"jpg\", out);\n        try {\n            out.flush();\n        } finally {\n            out.close();\n        }\n    }\n}\n```\n\nFor more examples, please see [kaptcha-spring-boot-starter-example](https://github.com/oopsguy/kaptcha-spring-boot/tree/master/kaptcha-spring-boot-starter-example)\n\n## Notice\n\nIf you custom your own `Producer` bean, it will replace the default.\n\n## License\n\nMIT License\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foopsguy%2Fkaptcha-spring-boot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foopsguy%2Fkaptcha-spring-boot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foopsguy%2Fkaptcha-spring-boot/lists"}