{"id":17310216,"url":"https://github.com/otraore/gatekeeper","last_synced_at":"2025-04-14T13:56:52.356Z","repository":{"id":57541256,"uuid":"66602481","full_name":"otraore/gatekeeper","owner":"otraore","description":"Hydra middleware for golang web frameworks","archived":false,"fork":false,"pushed_at":"2019-12-16T08:02:43.000Z","size":22,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T03:02:35.487Z","etag":null,"topics":["echo","gatekeeper","gin","go","goa","hydra","middleware"],"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/otraore.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":"2016-08-26T00:20:29.000Z","updated_at":"2022-03-06T10:29:14.000Z","dependencies_parsed_at":"2022-09-26T18:30:45.808Z","dependency_job_id":null,"html_url":"https://github.com/otraore/gatekeeper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/otraore%2Fgatekeeper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/otraore%2Fgatekeeper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/otraore%2Fgatekeeper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/otraore%2Fgatekeeper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/otraore","download_url":"https://codeload.github.com/otraore/gatekeeper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248893430,"owners_count":21179023,"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":["echo","gatekeeper","gin","go","goa","hydra","middleware"],"created_at":"2024-10-15T12:36:08.571Z","updated_at":"2025-04-14T13:56:52.326Z","avatar_url":"https://github.com/otraore.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gatekeeper\n[![GoDoc](https://godoc.org/github.com/otraore/gatekeeper?status.svg)](https://godoc.org/github.com/otraore/gatekeeper)\n[![Go Report Card](https://goreportcard.com/badge/github.com/otraore/gatekeeper)](https://goreportcard.com/report/github.com/otraore/gatekeeper)\n![License](https://img.shields.io/badge/License-MIT-blue.svg)\n\n[Hydra](https://github.com/ory-am/hydra) middleware for golang web frameworks. Inspired by [gin-hydra](https://github.com/janekolszak/gin-hydra), it current has support for [gin](https://github.com/gin-gonic/gin), [echo](https://github.com/labstack/echo), and [goa](https://github.com/goadesign/goa). More framework support is planned.\n\n## Install\n``` bash\ngo get -u github.com/otraore/gatekeeper\n```\n\n## Gin\n``` go\nimport (\n    \"github.com/gin-gonic/gin\"\n    \"github.com/ory-am/hydra/firewall\"\n    hydra \"github.com/ory-am/hydra/sdk\"\n    \"github.com/otraore/gatekeeper/gin\"\n)\n\nfunc handler(c *gin.Context) {\n\tctx := c.Get(\"hydra\").(*firewall.Context)\n\t// Now you can access ctx.Subject etc.\n}\n\nfunc main(){\n\t// Initialize Hydra\n\thc, err := hydra.Connect(\n\t\thydra.ClientID(\"...\"),\n\t\thydra.ClientSecret(\"...\"),\n\t\thydra.ClusterURL(\"...\"),\n\t)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t\n\t// Create a gatekeeper instance for Gin\n\tgk := gatekeeper.New(hc)\n\n \tr := gin.Default()\n\tr.GET(\"/protected\", gk.ScopesRequired(\"scope1\", \"scope2\"), handler)\n\tr.Run()\n}\n```\n## Echo\n``` go\nimport (\n    \"github.com/labstack/echo\"\n    \"github.com/labstack/echo/engine/standard\"\n    \"github.com/ory-am/hydra/firewall\"\n    hydra \"github.com/ory-am/hydra/sdk\"\n    \"github.com/otraore/gatekeeper/echo\"\n)\n\nfunc handler(c echo.Context) {\n\tctx := c.Get(\"hydra\").(*firewall.Context)\n\t// Now you can access ctx.Subject etc.\n}\n\nfunc main(){\n\t// Initialize Hydra\n\thc, err := hydra.Connect(\n\t\thydra.ClientID(\"...\"),\n\t\thydra.ClientSecret(\"...\"),\n\t\thydra.ClusterURL(\"...\"),\n\t)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t\n\t// Create a gatekeeper instance for Echo\n\tgk := gatekeeper.New(hc)\n\n \te := echo.Default()\n\te.GET(\"/protected\", handler, gk.ScopesRequired(\"scope1\", \"scope2\"),)\n\n\te.Run(standard.New(\":8080\"))\n}\n```\n## Goa\n\nExample coming soon\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fotraore%2Fgatekeeper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fotraore%2Fgatekeeper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fotraore%2Fgatekeeper/lists"}