Form-less authentication using standard Symfony2 security

I have the following scenario: I have a secured area of my domain under the pattern "/register", for which I have associated a fixed user called "registrant", with the unique role USER_REGISTRANT. The relevant security.yml sections are:

providers:
    in_memory:
        memory:
            users:
                registrant: { password: registrant, roles: 'REGISTERING_USER' }

firewalls:
    register:
        pattern: ^/register/.*
        anonymous: false
        form_login:
            login_path: /register/initiate_registration
            check_path: /register/start_registration

My goal is the following: whenever the user tries to enter the "/register" security context, she should be automatically authenticated as the user "registrant", without any form interaction or other user-side authentication steps.

I want to achieve this using the standard form-login mechanisms in Symfony2, i.e. when the user is sent to the login_path, the system should simply generate the necessary token/form data and pass it to check_path, just as would be done if the user had filled in a form and submitted it.

The general outline of the logic should go something like this:

/**
 * @Route("/register/initiate_registration", name="initiate_registration")
 */
public function startAction() {

    // TODO: Generate form data etc here

    return $this->redirect($this->generateUrl('start_registration'));
}

What steps should be taken in the login_path controller in order to get the functionality desired above?

Answers


Is this docs can be usefull for you security?


Need Your Help

ggplot2 heatmap with colors for ranged values

r ggplot2 heatmap

I want to make a heatmap in ggplot2. My toy data and code is:

Create table from Json response using Knockout.js

javascript jquery json knockout.js

I am trying to create a table using Json response and Knockout.js