{"id":15021899,"url":"https://github.com/knojector/steamauthenticationbundle","last_synced_at":"2025-04-10T20:33:23.713Z","repository":{"id":30517962,"uuid":"337186799","full_name":"knojector/SteamAuthenticationBundle","owner":"knojector","description":":steam_locomotive: A Symfony Bundle that provides authentication via Steam for your application.","archived":false,"fork":false,"pushed_at":"2024-02-01T21:20:50.000Z","size":35,"stargazers_count":11,"open_issues_count":1,"forks_count":8,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-08T23:36:40.084Z","etag":null,"topics":["steam","symfony","symfony-bundle"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/knojector.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":"2021-02-08T19:30:27.000Z","updated_at":"2024-03-16T23:26:49.000Z","dependencies_parsed_at":"2024-06-21T19:12:21.425Z","dependency_job_id":null,"html_url":"https://github.com/knojector/SteamAuthenticationBundle","commit_stats":{"total_commits":17,"total_committers":4,"mean_commits":4.25,"dds":0.5294117647058824,"last_synced_commit":"e05b5982e07a65cf7eafdc1c6c29669c588d74b7"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knojector%2FSteamAuthenticationBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knojector%2FSteamAuthenticationBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knojector%2FSteamAuthenticationBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knojector%2FSteamAuthenticationBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/knojector","download_url":"https://codeload.github.com/knojector/SteamAuthenticationBundle/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248290042,"owners_count":21078923,"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":["steam","symfony","symfony-bundle"],"created_at":"2024-09-24T19:57:11.978Z","updated_at":"2025-04-10T20:33:23.693Z","avatar_url":"https://github.com/knojector.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GitHub license](https://img.shields.io/github/license/knojector/SteamAuthenticationBundle)](https://github.com/knojector/SteamAuthenticationBundle/blob/main/LICENSE)\r\n[![GitHub issues](https://img.shields.io/github/issues/knojector/SteamAuthenticationBundle)](https://github.com/knojector/SteamAuthenticationBundle/issues)\r\n[![GitHub issues](https://img.shields.io/github/issues-pr/knojector/SteamAuthenticationBundle)](https://github.com/knojector/SteamAuthenticationBundle/pulls)\r\n[![GitHub issues](https://img.shields.io/github/stars/knojector/SteamAuthenticationBundle)](https://github.com/knojector/SteamAuthenticationBundle/stargazers)\r\n![Packagist Downloads](https://img.shields.io/packagist/dt/knojector/steam-authentication-bundle)\r\n\r\n# SteamAuthenticationBundle - Steam authentication for Symfony\r\n\r\nThe SteamAuthenticationBundle provides an easy way to integrate Steams OpenID login for your application.\r\n\r\n## Table of Contents\r\n- [Installation](#installation)\r\n- [Usage](#usage)\r\n- [Bugs and ideas?](#bugs-and-ideas)\r\n- [Requirements](#requirements)\r\n\r\n## Installation\r\n\r\n### Step 1 - Install the bundle\r\n```shell\r\ncomposer require knojector/steam-authentication-bundle\r\n```\r\n\r\n### Step 2 - Configuration\r\n```yaml\r\nknojector_steam_authentication:\r\n    login_success_redirect: 'app.protected_route'\r\n    login_failure_redirect: 'app.error_route'\r\n```\r\nAs you can see there are only two options available for configuration. Both are very self-explanatory. The option `login_success_redirect` contains the name of the route the user should be redirected to if the login was successful. The option `login_failure_redirect` contains the route the user is redirected to if the login fails.\r\n\r\n\r\nFurthermore you have to adjust your `security.yml`. In the following snippet you can see an example with a basic configuration. There are only two important things to consider:\r\n- The firewall name must be `steam`\r\n- You can use any user provider as long as the Steam CommunityId is the property to query for\r\n```yaml\r\nsecurity:\r\n    providers:\r\n        users:\r\n            entity:\r\n                class: 'App\\Entity\\User'\r\n                property: 'username'\r\n    firewalls:\r\n        dev:\r\n            pattern: ^/(_(profiler|wdt)|css|images|js)/\r\n            security: false\r\n        steam:\r\n            pattern: ^/\r\n            lazy: true\r\n            provider: users\r\n```\r\n\r\nThe final step is to enable the bundle's controller in your `routes.yaml`\r\n```yaml\r\nsteam_authentication_callback:\r\n  path: /steam/login_check\r\n  controller: Knojector\\SteamAuthenticationBundle\\Controller\\SteamController::callback\r\n```\r\n## Usage\r\n\r\n### Step 1 - Create your own registration subscriber\r\nTechnically there is no registration available in this bundle. The bundle receives an ID from Steam and tries to load a user via the configured user provider. If no user exists you can assume that the user logged in for the first time. Instead of throwing an exception, the bundle dispatches an event you can subscribe to. A simple example for your subscriber is shown below\r\n\r\n```php\r\n\u003c?php\r\n\r\nnamespace App\\Subscriber;\r\n\r\nuse App\\Entity\\User;\r\nuse Knojector\\SteamAuthenticationBundle\\Event\\AuthenticateUserEvent;\r\nuse Knojector\\SteamAuthenticationBundle\\Event\\FirstLoginEvent;\r\nuse Symfony\\Component\\EventDispatcher\\EventDispatcherInterface;\r\nuse Symfony\\Component\\EventDispatcher\\EventSubscriberInterface;\r\n\r\nclass FirstLoginSubscriber implements EventSubscriberInterface\r\n{\r\n    public function __construct(private EventDispatcherInterface $eventDispatcher)\r\n    {}\r\n\r\n    /**\r\n     * @inheritDoc\r\n     */\r\n    public static function getSubscribedEvents()\r\n    {\r\n        return [\r\n            FirstLoginEvent::NAME =\u003e 'onFirstLogin'\r\n        ];\r\n    }\r\n\r\n    public function onFirstLogin(FirstLoginEvent $event)\r\n    {\r\n        $communityId = $event-\u003egetCommunityId();\r\n        \r\n        $user = new User();\r\n        $user-\u003esetUsername($communityId);\r\n        \r\n        // e.g. call the Steam API to fetch more profile information\r\n        // e.g. create user entity and persist it\r\n        \r\n        // dispatch the authenticate event in order to sign in the new created user.\r\n        $this-\u003eeventDispatcher-\u003edispatch(new AuthenticateUserEvent($user), AuthenticateUserEvent::NAME);\r\n    }\r\n}\r\n```\r\n\r\n### Step 2 - Place the login button\r\nTo place the \"Sign in through Steam\" button you can include the following snippet in your template\r\n```\r\n{% include '@KnojectorSteamAuthentication/button.html.twig' %}\r\n```\r\n\r\n## Bugs and ideas?\r\nFeel free to open an issue or submit a pull request :wink:\r\n\r\n## Requirements\r\nThe bundle requires:\r\n- PHP 8.0.0+\r\n- Symfony 5.3/6\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknojector%2Fsteamauthenticationbundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknojector%2Fsteamauthenticationbundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknojector%2Fsteamauthenticationbundle/lists"}