Steam Authentication for Symfony
PHP HTML
Permalink
Failed to load latest commit information.
DependencyInjection steam bundle Sep 12, 2016
Resources fixed values Sep 13, 2016
Security removed try/catch Dec 15, 2016
Service fixed values Sep 13, 2016
.gitignore cleaned gitignore Sep 12, 2016
LICENSE Initial commit Sep 12, 2016
README.md updated README.md Dec 13, 2016
SteamAuthBundle.php steam bundle Sep 12, 2016
composer.json changed symfony version requirements Jan 20, 2017

README.md

SteamAuthBundle

Steam Authentication for Symfony

Configuration and Usage

A couple things are necessary for this bundle to work. Your user class will have to be managed by Doctrine ORM (does not support Mongo or Propel at the moment.) At first, add the EightPoints GuzzleBundle and the SteamAuthBundle to your AppKernel.php

$bundles = [
...
new EightPoints\Bundle\GuzzleBundle\GuzzleBundle(),
new SteamAuthBundle\SteamAuthBundle()
...
];

In the app/config/config.yml you will need the following parameters

steam_auth:
    steam_key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    user_class: AppBundle\Entity\User

And your security yml firewall will need

  • steam as a firewall option
  • with a default_route option with the name of the route to go to once a user has logged in
  • a user provider marked as steam.user_provider
security:
    providers:
        steamauth:
            id: steam.user_provider

    firewalls:
        main:
            provider: steamauth
            steam:
                default_route: home

Your User class will need to implement SteamAuthBundle\Security\User\SteamUserInterface as well as Symfony\Component\Security\Core\User\UserInterface

Note that this bundle will create a new instance of your user class with an empty default constructor, will set the username, nickname, avatar and password, and will persist it to the database. This occurs when a user signs in with their steam account and do not already exist in your database.

This bundle also works with Symfony's Remember Me functionality if you wish to use it.

main:
    steam:
        default_route: home
    remember_me:
        secret: '%secret%'

Login Template

On your login page, you can either use your own form with the OpenID parameters, or include the SteamAuthBundle Template

{% include "SteamAuthBundle:Login:login.html.twig" %}