sirwaddles/steamauth

Steam Authentication for Symfony

Installs: 1 009

Dependents: 0

Suggesters: 0

Security: 0

Stars: 11

Watchers: 4

Forks: 5

Open Issues: 2

Type:symfony-bundle

dev-master 2018-04-06 14:04 UTC

This package is not auto-updated.

Last update: 2024-05-05 07:09:08 UTC


README

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" %}