{"id":20532894,"url":"https://github.com/la3rence/mfa","last_synced_at":"2025-04-14T06:32:31.176Z","repository":{"id":38884523,"uuid":"285273466","full_name":"la3rence/MFA","owner":"la3rence","description":"Multi-Factor Authentication by Java with Spring. Java/Spring 接入身份验证器两步验证。Java 实现多因子认证。","archived":false,"fork":false,"pushed_at":"2025-03-21T07:06:24.000Z","size":23,"stargazers_count":16,"open_issues_count":7,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-21T08:22:57.133Z","etag":null,"topics":["2fa","mfa","multi-factor-authentication"],"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/la3rence.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":"2020-08-05T11:52:55.000Z","updated_at":"2023-12-14T03:10:30.000Z","dependencies_parsed_at":"2023-12-18T09:55:27.894Z","dependency_job_id":"74b07f7b-1f8d-4e44-88dd-be2acbb495d6","html_url":"https://github.com/la3rence/MFA","commit_stats":null,"previous_names":["la3rence/mfa"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/la3rence%2FMFA","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/la3rence%2FMFA/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/la3rence%2FMFA/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/la3rence%2FMFA/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/la3rence","download_url":"https://codeload.github.com/la3rence/MFA/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248833975,"owners_count":21168940,"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":["2fa","mfa","multi-factor-authentication"],"created_at":"2024-11-16T00:17:41.426Z","updated_at":"2025-04-14T06:32:31.072Z","avatar_url":"https://github.com/la3rence.png","language":"Java","readme":"# 使用 Java/Spring 接入身份验证器\n\n# Multi-Factor Authentication by Java with Spring\n多因素认证 ｜ 多因子认证 ｜ Google Authenticator ｜ 2FA ｜ MFA | 时间戳同步 ｜ Java实现 | Spring后端\n\n## 工具类\n\n[MultiFactorAuthenticator](src/main/java/com/auth/www/util/MultiFactorAuthenticator.java)\n\n## 接入自己的用户体系\n\n[TestController](src/main/java/com/auth/www/controller/TestController.java)\n\n## 客户端\n\n- [Google Authenticator](https://apps.apple.com/app/google-authenticator/id388497605)\n- [Authy](https://authy.com/)\n- [Step Two](https://steptwo.app/) \n\n## 注意\n\n- 服务端时间必须与客户端一致。\n- 接入自己的用户系统时，可以设计一个 user - secret 一一映射的表用来绑定身份验证。\n本案例偷懒了，直接放内存里的。\n- 二维码的展示放在了 JSON 中，使用了国内可以访问的一个 API，可能会失效。\n\n## 快速开始\n启动此服务。\n用户下载、安装好客户端应用后，尝试发出此请求。\n```shell script\ncurl -XGET localhost:8080/bind?username=test\n```\n将返回 JSON 中的二维码地址通过浏览器打开，或者使用 wget 等客户端下载到本地。\n使用客户端导入此二维码，或者填写密文导入。导入成功后，应用会出现相应的 6 位数验证码。\n将验证码作为以下 HTTP 请求的 codeInput 字段内容。\n```shell script\ncurl -XGET localhost:8080/check?username=test\u0026codeInput={codeInput}\n```\n返回的结果为 true 则验证成功。\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fla3rence%2Fmfa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fla3rence%2Fmfa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fla3rence%2Fmfa/lists"}