{"id":19900613,"url":"https://github.com/gobuffalo/buffalo-auth","last_synced_at":"2025-07-20T08:35:42.128Z","repository":{"id":26641349,"uuid":"109433410","full_name":"gobuffalo/buffalo-auth","owner":"gobuffalo","description":"Buffalo auth plugin helps adding username password authentication to your app","archived":false,"fork":false,"pushed_at":"2023-02-06T12:38:20.000Z","size":2094,"stargazers_count":43,"open_issues_count":1,"forks_count":27,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-02T23:35:32.656Z","etag":null,"topics":["authentication","generator","go","gobuffalo","golang","plugin"],"latest_commit_sha":null,"homepage":"https://gobuffalo.io","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/gobuffalo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"markbates","patreon":"buffalo"}},"created_at":"2017-11-03T19:10:28.000Z","updated_at":"2025-02-06T17:05:48.000Z","dependencies_parsed_at":"2023-02-18T17:45:25.430Z","dependency_job_id":null,"html_url":"https://github.com/gobuffalo/buffalo-auth","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/gobuffalo/buffalo-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gobuffalo%2Fbuffalo-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gobuffalo%2Fbuffalo-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gobuffalo%2Fbuffalo-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gobuffalo%2Fbuffalo-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gobuffalo","download_url":"https://codeload.github.com/gobuffalo/buffalo-auth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gobuffalo%2Fbuffalo-auth/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266092839,"owners_count":23875545,"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":["authentication","generator","go","gobuffalo","golang","plugin"],"created_at":"2024-11-12T20:12:45.867Z","updated_at":"2025-07-20T08:35:42.094Z","avatar_url":"https://github.com/gobuffalo.png","language":"Go","funding_links":["https://github.com/sponsors/markbates","https://patreon.com/buffalo"],"categories":["Go"],"sub_categories":[],"readme":"# Auth Generator for Buffalo\n\n[![Standard Test](https://github.com/gobuffalo/buffalo-auth/actions/workflows/standard-go-test.yml/badge.svg)](https://github.com/gobuffalo/buffalo-auth/actions/workflows/standard-go-test.yml)\n[![Go Reference](https://pkg.go.dev/badge/github.com/gobuffalo/buffalo-auth.svg)](https://pkg.go.dev/github.com/gobuffalo/buffalo-auth)\n[![Go Report Card](https://goreportcard.com/badge/github.com/gobuffalo/buffalo-auth)](https://goreportcard.com/report/github.com/gobuffalo/buffalo-auth)\n\n## Installation\n\n```console\n$ buffalo plugins install github.com/gobuffalo/buffalo-auth@latest\n```\n\n## Usage\n\nTo generate a basic username / password authentication you can run:\n\n```console\n$ buffalo generate auth\n```\n\nThis will do:\n\n- Generate User authentication actions in `actions/auth.go`:\n  - AuthNew\n  - AuthCreate\n  - AuthDestroy\n\n- Generate User signup actions in `actions/users.go`:\n  - UsersNew\n  - UsersCreate\n\n- Generate User model and migration ( model will be in `models/user.go`):\n\n- Generate Auth Middlewares\n  - SetCurrentUser\n  - Authorize\n\n- Add actions and middlewares in `app.go`:\n  - [GET] /users/new -\u003e UsersNew\n  - [POST] /users -\u003e UsersCreate\n  - [GET] /signin -\u003e AuthNew\n  - [POST] /signin -\u003e AuthCreate\n  - [DELETE] /signout -\u003e AuthDestroy\n\n- Use middlewares for all your actions and skip\n  - HomeHandler\n  - UsersNew\n  - UsersCreate\n  - AuthNew\n  - AuthCreate\n\n### User model Fields\n\nSometimes you would want to add extra fields to the user model, to do so, you can pass those to the auth command and use the pop notation for those fields, for example:\n\n```console\n$ buffalo generate auth first_name last_name notes:text\n```\n\nWill generate a User model (inside `models/user.go`) that looks like:\n\n```go\ntype User struct {\n  ID                   uuid.UUID `json:\"id\" db:\"id\"`\n  CreatedAt            time.Time `json:\"created_at\" db:\"created_at\"`\n  UpdatedAt            time.Time `json:\"updated_at\" db:\"updated_at\"`\n  Email                string    `json:\"email\" db:\"email\"`\n  PasswordHash         string    `json:\"password_hash\" db:\"password_hash\"`\n  FirstName            string    `json:\"first_name\" db:\"first_name\"`\n  LastName             string    `json:\"last_name\" db:\"last_name\"`\n  Notes                string    `json:\"notes\" db:\"notes\"`\n  Password             string    `json:\"-\" db:\"-\"`\n  PasswordConfirmation string    `json:\"-\" db:\"-\"`\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgobuffalo%2Fbuffalo-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgobuffalo%2Fbuffalo-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgobuffalo%2Fbuffalo-auth/lists"}