{"id":21888628,"url":"https://github.com/swisscom/sample-uaa-ruby-service-provider","last_synced_at":"2025-07-17T16:39:04.382Z","repository":{"id":72530266,"uuid":"143738477","full_name":"swisscom/sample-uaa-ruby-service-provider","owner":"swisscom","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-16T15:19:10.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-03-04T22:02:06.496Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/swisscom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2018-08-06T14:15:43.000Z","updated_at":"2024-10-16T15:19:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"607e83e1-2a32-4071-aab8-111c2f397a4a","html_url":"https://github.com/swisscom/sample-uaa-ruby-service-provider","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/swisscom%2Fsample-uaa-ruby-service-provider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swisscom%2Fsample-uaa-ruby-service-provider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swisscom%2Fsample-uaa-ruby-service-provider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swisscom%2Fsample-uaa-ruby-service-provider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swisscom","download_url":"https://codeload.github.com/swisscom/sample-uaa-ruby-service-provider/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244895564,"owners_count":20527908,"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-11-28T11:16:17.914Z","updated_at":"2025-03-22T02:24:07.954Z","avatar_url":"https://github.com/swisscom.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sample ruby OAuth2 service provider for UAA\nThis demo app in ruby authenticates its users against UAA as a identity provider.\nIt saves its session (and JWT) in the backend.\nFor this architecture scenario, it uses the `authorization_code` grant type and acts as OAuth2 service provider.\n\nIt's roughly based on https://github.com/cloudfoundry/omniauth-uaa-oauth2/blob/master/examples/config.ru and uses this library.\n\nAlthough it needs this library that's tailored for UAA interaction, any OAuth2 library should do.\n\nIt is primarily designed to run on CloudFoundry, since it expects the OAuth2 configuration to be passed in `VCAP_SERVICES`.\n\n## How it works\nWhen the `Sign in` link is clicked by an unauthorized user,\nit redirects the user to UAA as IDP (standard OAuth2 `Authorization code` flow).\n\nWhen the user logs in on UAA provider, he is redirected back to the sample app.\nThe app completes the OAuth2 flow and receives the user's info (using the Userinfo endpoint), i.e. its attributes like firstname, lastname.\n\n**Disclaimer: Not for production use**\n\nAlthough it is meant to be pushed on CF, be aware that this app can only run one instance (since it's using the File based session store, because the Cookie store limit of 4k is easily exceeded with UAA's large tokens when syncing a large number of groups).\nSo, do not use this demo app for production. If you have to do so, you can base on this code, but please use a prod-ready the session store (i.e. with Redis or DBMS backend) to be able to run it with multiple instances.\n\n## Configure, deploy and test\n```\ncf push sample-app --random-route --no-start -i 1\n\n# Now create the user provided service which will be provided to the app in `VCAP_SERVICES`.\n# The client specified here must be created manually beforehand on the OAuth2 provider.\nCREDENTIALS='{\"authorizationEndpoint\": \"\u003cuaa-url\u003e/oauth/authorize\", \"tokenEndpoint\": \"\u003cuaa-url\u003e/oauth/token\", \"userInfoEndpoint\": \"\u003cuaa-url\u003e/userinfo\", \"logoutEndpoint\": \"\u003cuaa-url\u003e/logout.do\", \"clientId\": \"\u003cclient-id\u003e\", \"clientSecret\": \"\u003cclient-secret\u003e\"}'\ncf create-user-provided-service OAUTH2-CLIENT -p $CREDENTIALS -t oauth2\n\n# Bind \u0026 start the app to make the service instance available\ncf bind-service sample-uaa OAUTH2-CLIENT\ncf start sample-app\n\nNow access the app in your browser.\n```\n\n\n## Sample overview\n### Authorization code\n- Service provider (Spring boot): https://github.com/swisscom/sample-uaa-spring-boot-service-provider\n- Service provider (Ruby): https://github.com/swisscom/sample-uaa-ruby-service-provider\n\n### Implicit flow \u0026 Client Credentials\n- Client (VueJS): https://github.com/swisscom/sample-uaa-vue-client\n- Client (React \u0026 Redux):https://github.com/swisscom/sample-uaa-react-redux-client\n- Client (AngularJS): https://github.com/swisscom/sample-uaa-angular-client\n\n- Resource Server (Spring boot): https://github.com/swisscom/sample-uaa-spring-boot-resource-server\n- Resource Server (Ruby): https://github.com/swisscom/sample-uaa-ruby-resource-server\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswisscom%2Fsample-uaa-ruby-service-provider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswisscom%2Fsample-uaa-ruby-service-provider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswisscom%2Fsample-uaa-ruby-service-provider/lists"}