Steam Authentication for Symfony
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\UserAnd your security yml firewall will need
steamas a firewall option- with a
default_routeoption 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: homeYour 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%'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" %}