{"id":20806944,"url":"https://github.com/bddjr/basiclogin-gin","last_synced_at":"2025-05-11T17:32:00.256Z","repository":{"id":246835301,"uuid":"823718590","full_name":"bddjr/basiclogin-gin","owner":"bddjr","description":"为Cookie设计的轻量级登录框架。Lightweight login framework designed for cookie.","archived":true,"fork":false,"pushed_at":"2024-10-09T06:46:04.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-12T03:43:37.178Z","etag":null,"topics":["gin","go","golang","httpserver","login"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bddjr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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-07-03T15:10:58.000Z","updated_at":"2024-10-09T06:46:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"1603fb0b-72da-4e7c-8e5e-c57eedbd797a","html_url":"https://github.com/bddjr/basiclogin-gin","commit_stats":null,"previous_names":["bddjr/basiclogin-gin"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bddjr%2Fbasiclogin-gin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bddjr%2Fbasiclogin-gin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bddjr%2Fbasiclogin-gin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bddjr%2Fbasiclogin-gin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bddjr","download_url":"https://codeload.github.com/bddjr/basiclogin-gin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253604953,"owners_count":21934918,"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":["gin","go","golang","httpserver","login"],"created_at":"2024-11-17T19:29:00.757Z","updated_at":"2025-05-11T17:32:00.021Z","avatar_url":"https://github.com/bddjr.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Warning\n不建议使用，它不能记住密码。而且它会导致Firefox在不关闭浏览器的情况下无法安全退出登录。  \n\nIt is not recommended to use it, as it does not remember passwords and it can cause Firefox to be unable to securely log out without closing the browser.\n\n# basiclogin-gin\n\n为Cookie设计的轻量级登录框架，兼容chrome 、firefox浏览器，暂未测试safari浏览器。  \n\nLightweight login framework designed for cookie, compatible with chrome, firefox, not tested safari.  \n\nReference https://developer.mozilla.org/docs/Web/HTTP/Authentication\n\n## Get\n```\ngo get github.com/bddjr/basiclogin-gin\n```\n\n## Example\n[See test/main.go](test/main.go)  \n\n```go\nloginGroup := Router.Group(\"login\")\nbasiclogin.New(loginGroup, func(ctx *gin.Context, username, password string, secure bool) {\n    // ⚠ If you need *http.Cookie, please use\n    //   ctx.Writer.Header().Add(\"Set-Cookie\", cookie.String())\n    if username == staticUserName \u0026\u0026 hmac.Equal([]byte(password), []byte(StaticPassword)) {\n        ctx.SetCookie(cookieName, cookieValue, 0, \"/\", \"\", secure, true)\n        ctx.Header(\"Referrer-Policy\", \"no-referrer\")\n        basiclogin.ScriptRedirect(ctx, 401, \"/\")\n        return\n    }\n\tctx.String(401, \"Wrong usename or password\")\n})\n```\n\n## License\n[BSD-3-clause license](LICENSE.txt)  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbddjr%2Fbasiclogin-gin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbddjr%2Fbasiclogin-gin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbddjr%2Fbasiclogin-gin/lists"}