Tuesday, 15 April 2014

Symfony2 Basic Authentication. Token not set -



Symfony2 Basic Authentication. Token not set -

good morning everyone. playing symfony2 little , have implemented basic authentication documentation says.

i can log in in debug bar said "you not authenticated".

when seek retrieve token, null, so, cannot user, username or whatever want.

i have read tons of posts , cannot find clue why going way.

any solution possible?

login form

{% if error %} <div>{{ error.message }}</div> {% endif %} <form action="{{ path('login_check') }}" method="post"> <label for="username">user:</label> <input id="username" type="text" name="_username" value="{{ last_username }}" /> <label for="password">password:</label> <input id="password" type="password" name="_password" /> <input type="submit" name="login" /> </form>

loginaction

public function loginaction() { $request = $this->getrequest(); $session = $request->getsession(); if ($request->attributes->has(securitycontext::authentication_error)) { $error = $request->attributes->get(securitycontext::authentication_error); } else { $error = $session->get(securitycontext::authentication_error); } homecoming $this->render('jillfbadminbundle:security:login.html.twig', array( 'last_username' => $session->get(securitycontext::last_username), 'error' => $error, )); }

security.yml

providers: administrators: entity: { class: jillfbsitebundle:user, property: username } firewalls: admin_area: provider: administrators security: true anonymous: false pattern: ^/admin/ form_login: check_path: /admin/login_check login_path: /login logout: path: /admin/logout target: /home access_control: - { path: /login, roles: is_authenticated_anonymously } - { path: ^/user, roles: role_user} - { path: ^/admin, roles: role_admin}

tokens

5123898f6f3d2 192.168.1.83 http://192.168.1.83:88/jill/app_dev.php/admin/ tue, 19 feb 2013 15:17:51 +0100 5123898f07be5 192.168.1.83 post http://192.168.1.83:88/jill/app_dev.php/admin/login_check tue, 19 feb 2013 15:17:51 +0100

authentication symfony2 doctrine token

No comments:

Post a Comment