SteamAuthBundle
Steam Authentication for Symfony, (*1)
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, (*2)
$bundles = [
...
new EightPoints\Bundle\GuzzleBundle\GuzzleBundle(),
new SteamAuthBundle\SteamAuthBundle()
...
];
In the app/config/config.yml
you will need the following parameters, (*3)
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
, (*4)
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
, (*5)
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., (*6)
This bundle also works with Symfony's Remember Me functionality if you wish to use it., (*7)
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, (*8)
{% include "SteamAuthBundle:Login:login.html.twig" %}