{"id":17599610,"url":"https://github.com/janekolszak/gin-hydra","last_synced_at":"2025-07-20T06:04:23.887Z","repository":{"id":74989038,"uuid":"66222039","full_name":"janekolszak/gin-hydra","owner":"janekolszak","description":"Hydra middleware for Gin","archived":false,"fork":false,"pushed_at":"2017-05-15T22:17:55.000Z","size":3,"stargazers_count":36,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-30T06:48:31.746Z","etag":null,"topics":[],"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/janekolszak.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":"2016-08-21T21:40:00.000Z","updated_at":"2024-03-29T05:53:29.000Z","dependencies_parsed_at":"2023-02-26T16:16:24.082Z","dependency_job_id":null,"html_url":"https://github.com/janekolszak/gin-hydra","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/janekolszak/gin-hydra","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janekolszak%2Fgin-hydra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janekolszak%2Fgin-hydra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janekolszak%2Fgin-hydra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janekolszak%2Fgin-hydra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/janekolszak","download_url":"https://codeload.github.com/janekolszak/gin-hydra/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janekolszak%2Fgin-hydra/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266076036,"owners_count":23872729,"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":[],"created_at":"2024-10-22T10:26:24.168Z","updated_at":"2025-07-20T06:04:23.861Z","avatar_url":"https://github.com/janekolszak.png","language":"Go","funding_links":[],"categories":["Archived, Outdated, and WIP"],"sub_categories":["Ory Fosite"],"readme":"# gin-hydra\n[Hydra](https://github.com/ory-am/hydra) middleware for [Gin](https://gin-gonic.github.io/gin/) framework.\nIt uses Hydra's API to extract and validate auth token.\n\n## Install\n``` bash\ngo get github.com/janekolszak/gin-hydra\n```\n\n## Example\n\n``` go\nimport (\n    \"github.com/gin-gonic/gin\"\n    \"github.com/ory-am/hydra/firewall\"\n  \thydra \"github.com/ory-am/hydra/sdk\"\n\n    gh \"go get github.com/janekolszak/gin-hydra\"\n\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 and gin-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\n\tgh.Init(hc)\n\n\t// Use the middleware\n \trouter := gin.Default()\n\trouter.GET(\"/\", gh.ScopesRequired(\"scope1\", \"scope2\"), handler)\n\trouter.Run()\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanekolszak%2Fgin-hydra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjanekolszak%2Fgin-hydra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanekolszak%2Fgin-hydra/lists"}