Skip to content

Clarify what is guard in security docs #8342

Closed
@Xymanek

Description

@Xymanek

Right now when looking at guard-related "articles" it's unclear what exactly it is. For example:

How to Create a Custom Authentication System with Guard

Whether you need to build a traditional login form, an API token authentication system or you need to integrate with some proprietary single-sign-on system, the Guard component can make it easy... and fun!

When I first read my reaction was "Um, what's guard component and where did it come from?". Then I remembered that security component is split in parts and decided to check that, maybe guard is one of them?

  • symfony/security-core
  • symfony/security-http
  • symfony/security-csrf
  • symfony/security-acl

Um.... doesn't help. I hope you get the idea by now

An explanation by @wouterj in slack was a good one:

Well, Symfony Security is a big complex beast, with all kind of different classes doing just one thing. This meant that if you wanted to implement a custom authentication (like API key authentication), you needed to create like 5 different classes, 20 line of configuration, etc.
That isn't that great, so the Symfony Core Team (Ryan specifically) created one interface that implemented all methods required for the authentication and created all these 5 classes to call the method directly on the interface (with some extra stuff, like error handling): Guards were born!
So it's just an easy way (that is, relative to the old situation) to implement custom authentication logic

I think it should be added to docs. Perhaps a note on "The Security Component" page?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions