{"id":51497045,"url":"https://github.com/yylego/kratos-custom-auth","last_synced_at":"2026-07-07T16:30:33.208Z","repository":{"id":367900699,"uuid":"1179822189","full_name":"yylego/kratos-custom-auth","owner":"yylego","description":"Custom token authentication middleware with self-defined validation functions","archived":false,"fork":false,"pushed_at":"2026-06-28T06:35:33.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-28T08:14:14.180Z","etag":null,"topics":["authentication","kratos","middleware","token-validation"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/yylego.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-12T12:18:53.000Z","updated_at":"2026-06-28T06:33:35.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/yylego/kratos-custom-auth","commit_stats":null,"previous_names":["yylego/kratos-custom-auth"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/yylego/kratos-custom-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yylego%2Fkratos-custom-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yylego%2Fkratos-custom-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yylego%2Fkratos-custom-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yylego%2Fkratos-custom-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yylego","download_url":"https://codeload.github.com/yylego/kratos-custom-auth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yylego%2Fkratos-custom-auth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35235815,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-07T02:00:07.222Z","response_time":90,"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":["authentication","kratos","middleware","token-validation"],"created_at":"2026-07-07T16:30:32.344Z","updated_at":"2026-07-07T16:30:33.198Z","avatar_url":"https://github.com/yylego.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/yylego/kratos-custom-auth/release.yml?branch=main\u0026label=BUILD)](https://github.com/yylego/kratos-custom-auth/actions/workflows/release.yml?query=branch%3Amain)\n[![GoDoc](https://pkg.go.dev/badge/github.com/yylego/kratos-custom-auth)](https://pkg.go.dev/github.com/yylego/kratos-custom-auth)\n[![Coverage Status](https://img.shields.io/coveralls/github/yylego/kratos-custom-auth/main.svg)](https://coveralls.io/github/yylego/kratos-custom-auth?branch=main)\n[![Supported Go Versions](https://img.shields.io/badge/Go-1.25+-lightgrey.svg)](https://go.dev/)\n[![GitHub Release](https://img.shields.io/github/release/yylego/kratos-custom-auth.svg)](https://github.com/yylego/kratos-custom-auth/releases)\n[![Go Report Card](https://goreportcard.com/badge/github.com/yylego/kratos-custom-auth)](https://goreportcard.com/report/github.com/yylego/kratos-custom-auth)\n\n# kratos-custom-auth\n\nCustom token authentication middleware with self-defined validation functions.\n\n---\n\n\u003c!-- TEMPLATE (EN) BEGIN: LANGUAGE NAVIGATION --\u003e\n\n## CHINESE README\n\n[中文说明](README.zh.md)\n\n\u003c!-- TEMPLATE (EN) END: LANGUAGE NAVIGATION --\u003e\n\n## Main Features\n\n🎯 **Custom Validation**: Authenticate with self-defined token check functions\n🔌 **Context Injection**: Auto-inject authenticated data into request context\n🛡️ **Route Scope Filtering**: Selective authentication based on route scope\n📡 **APM Tracing**: Pluggable span hook integration via `authkratos.SpanHook`\n⚙️ **Configurable Fields**: Custom request field name and debug mode\n\n## Installation\n\n```bash\ngo get github.com/yylego/kratos-custom-auth\n```\n\n## Usage\n\n```go\nimport \"github.com/yylego/kratos-custom-auth/customkratosauth\"\n\n// Define custom token check function\ncheckFunc := func(ctx context.Context, token string) (context.Context, *errors.Error) {\n    // validate token and inject account info into context\n    return ctx, nil\n}\n\n// Create config and middleware\ncfg := customkratosauth.NewConfig(routeScope, checkFunc)\nmw := customkratosauth.NewMiddleware(cfg, logger)\n```\n\n---\n\n\u003c!-- TEMPLATE (EN) BEGIN: STANDARD PROJECT FOOTER --\u003e\n\u003c!-- VERSION 2025-11-25 03:52:28.131064 +0000 UTC --\u003e\n\n## 📄 License\n\nMIT License - see [LICENSE](LICENSE).\n\n---\n\n## 💬 Contact \u0026 Feedback\n\nContributions are welcome! Report bugs, suggest features, and contribute code:\n\n- 🐛 **Mistake reports?** Open an issue on GitHub with reproduction steps\n- 💡 **Fresh ideas?** Create an issue to discuss\n- 📖 **Documentation confusing?** Report it so we can improve\n- 🚀 **Need new features?** Share the use cases to help us understand requirements\n- ⚡ **Performance issue?** Help us optimize through reporting slow operations\n- 🔧 **Configuration problem?** Ask questions about complex setups\n- 📢 **Follow project progress?** Watch the repo to get new releases and features\n- 🌟 **Success stories?** Share how this package improved the workflow\n- 💬 **Feedback?** We welcome suggestions and comments\n\n---\n\n## 🔧 Development\n\nNew code contributions, follow this process:\n\n1. **Fork**: Fork the repo on GitHub (using the webpage UI).\n2. **Clone**: Clone the forked project (`git clone https://github.com/yourname/repo-name.git`).\n3. **Navigate**: Navigate to the cloned project (`cd repo-name`)\n4. **Branch**: Create a feature branch (`git checkout -b feature/xxx`).\n5. **Code**: Implement the changes with comprehensive tests\n6. **Testing**: (Golang project) Ensure tests pass (`go test ./...`) and follow Go code style conventions\n7. **Documentation**: Update documentation to support client-facing changes\n8. **Stage**: Stage changes (`git add .`)\n9. **Commit**: Commit changes (`git commit -m \"Add feature xxx\"`) ensuring backward compatible code\n10. **Push**: Push to the branch (`git push origin feature/xxx`).\n11. **PR**: Open a merge request on GitHub (on the GitHub webpage) with detailed description.\n\nPlease ensure tests pass and include relevant documentation updates.\n\n---\n\n## 🌟 Support\n\nWelcome to contribute to this project via submitting merge requests and reporting issues.\n\n**Project Support:**\n\n- ⭐ **Give GitHub stars** if this project helps you\n- 🤝 **Share with teammates** and (golang) programming friends\n- 📝 **Write tech blogs** about development tools and workflows - we provide content writing support\n- 🌟 **Join the ecosystem** - committed to supporting open source and the (golang) development scene\n\n**Have Fun Coding with this package!** 🎉🎉🎉\n\n\u003c!-- TEMPLATE (EN) END: STANDARD PROJECT FOOTER --\u003e\n\n---\n\n## GitHub Stars\n\n[![Stargazers](https://starchart.cc/yylego/kratos-custom-auth.svg?variant=adaptive)](https://starchart.cc/yylego/kratos-custom-auth)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyylego%2Fkratos-custom-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyylego%2Fkratos-custom-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyylego%2Fkratos-custom-auth/lists"}