{"id":29016573,"url":"https://github.com/chef/omniauth-chef-oauth2","last_synced_at":"2025-06-25T22:30:41.727Z","repository":{"id":15040422,"uuid":"17766340","full_name":"chef/omniauth-chef-oauth2","owner":"chef","description":"An OmniAuth Strategy for Chef OAuth2 identity service","archived":false,"fork":false,"pushed_at":"2021-08-24T16:15:55.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":5,"subscribers_count":73,"default_branch":"main","last_synced_at":"2025-06-23T15:15:19.286Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chef.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-03-15T02:17:45.000Z","updated_at":"2021-11-27T18:07:13.000Z","dependencies_parsed_at":"2022-09-07T16:04:24.082Z","dependency_job_id":null,"html_url":"https://github.com/chef/omniauth-chef-oauth2","commit_stats":null,"previous_names":["opscode/omniauth-chef-oauth2"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/chef/omniauth-chef-oauth2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chef%2Fomniauth-chef-oauth2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chef%2Fomniauth-chef-oauth2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chef%2Fomniauth-chef-oauth2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chef%2Fomniauth-chef-oauth2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chef","download_url":"https://codeload.github.com/chef/omniauth-chef-oauth2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chef%2Fomniauth-chef-oauth2/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261962079,"owners_count":23236866,"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":"2025-06-25T22:30:39.378Z","updated_at":"2025-06-25T22:30:41.711Z","avatar_url":"https://github.com/chef.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# omniauth-chef-oauth2\n\nAn [OmniAuth](https://github.com/intridea/omniauth) OAuth2 strategy for Chef.\n\n  * [Documentation](https://github.com/opscode/omniauth-chef-oauth2/wiki)\n  * [Source](https://github.com/opscode/omniauth-chef-oauth2)\n  * [Issues](https://github.com/opscode/omniauth-chef-oauth2/issues?state=open)\n\n## Usage\n\nFirst, add it to your Gemfile:\n\n    gem 'omniauth-chef-oauth2'\n\n.. then:\n\n    $ bundle install\n\nTo configure omniauth-chef-oauth2 in a Rails application, create an OmniAuth initializer file -- e.g., ``config/initializers/omniauth.rb`` -- then set your application key and secret:\n\n    Rails.application.config.middleware.use OmniAuth::Builder do\n      provider :chef_oauth2, ENV['YOUR_APP_KEY'], ENV['YOUR_APP_SECRET']\n    end\n\nAdd a couple of handlers to ``routes.rb`` -- one for responding to authentication successes, one for failures:\n\n    YourRailsApp::Application.routes.draw do\n      ...\n      get '/auth/:provider/callback', to: 'sessions#create'\n      get '/auth/failure', to: 'sessions#invalid'\n    end\n\nOn successful authentication, omniauth-chef-oauth2 will provide you with a Hash (as ``env['omniauth.auth']``) representing the authenticated user:\n\n    class SessionsController \u003c ApplicationController\n      def create\n        auth_hash = env['omniauth.auth']\n        ...\n      end\n\n      def invalid\n        #\n      end\n    end\n\nAn successful auth_hash should look something like this:\n\n    {\n      \"provider\" =\u003e \"chef_oauth2\",\n      \"uid\" =\u003e \"abrown\",\n      \"info\" =\u003e {\n        \"username\" =\u003e \"abrown\",\n        \"first_name\" =\u003e \"Alton\",\n        \"last_name\" =\u003e \"Brown\",\n        \"email\" =\u003e \"alton@altonbrown.com\",\n        \"public_key\" =\u003e \"-----BEGIN PUBLIC KEY-----...\"\n      },\n      \"credentials\" =\u003e {\n        \"token\" =\u003e \"d3dbdb57\",\n        \"refresh_token\" =\u003e \"3b508c06\",\n        \"expires_at\" =\u003e 1395955085,\n        \"expires\" =\u003e true\n      }\n    }\n\n... where ``token`` contains the OAuth 2 access token you'll use to make authenticated API requests by passing a Bearer token in an Authorization header.  For example:\n\n    GET /id/users/me\n    Authorization: Bearer d3dbdb57\n    Accept: application/json\n\n## Tests\n\n    $ bundle exec rspec\n\n# License\n\n|                      |                                            |\n|:---------------------|:-------------------------------------------|\n| **Author**           | Christian Nunciato (cnunciato@getchef.com) |\n| **Copyright:**       | Copyright (c) 2014 Chef Software, Inc.     |\n| **License:**         | Apache License, Version 2.0                |\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchef%2Fomniauth-chef-oauth2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchef%2Fomniauth-chef-oauth2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchef%2Fomniauth-chef-oauth2/lists"}