| [Solved] Issues when installing sfGuard [message #21751] |
Thu, 15 February 2007 19:16  |
sfxpt Messages: 339 Registered: January 2007 Location: Canada |
Faithful Member |
|
|
Hi,
I'm trying to install the sfGuard.
Do I have to do the "Optionally add the following routing rules to routing.yml"? because "these routes are automatically registered by the plugin if the module sfGuardAuth is enabled", so that "if you try to access a secure page, you will be redirected to the login page. "
I didn't add them. All I got is the following instead of login page:
Credentials Required
This page is in a restricted area.
You do not have the proper credentials to access this page
Even though you are already logged in, this page requires special credentials that you currently don't have.
How to access this page
You must ask a site administrator to grant you some special credentials.
What's next
* Back to previous page
I do have the module sfGuardAuth enabled:
$ tail -14 apps/backend/config/settings.yml
all:
.actions:
login_module: sfGuardAuth
login_action: signin
secure_module: sfGuardAuth
secure_action: secure
all:
.settings:
# Activated modules from plugins or from the symfony core
enabled_modules: [default, sfGuardGroup, sfGuardUser, sfGuardPermission, sfGuardAuth]
*Edit*:
Adding those routing rules won't redirect me to the login page either.
How to make the auto redirect work for me?
I access my sf project as
http://localhost/sfpear/web/backend_dev.php
please help.
thanks
*Edit*:
Problem solved! Solution at
http://www.symfony-project.com/forum/index.php?t=msg&&am p;th=5071&goto=21848#msg_21848
[Updated on: Fri, 16 February 2007 21:43] http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
|
|
|
|
| Re: Issues when installing sfGuard [message #21834 is a reply to message #21804 ] |
Fri, 16 February 2007 18:56   |
sfxpt Messages: 339 Registered: January 2007 Location: Canada |
Faithful Member |
|
|
| marke wrote on Fri, 16 February 2007 05:28 | Try to put the routing rules for sfGuard before the default rules in the routing.yml file
|
thanks for the input, done that, but no help. still get that
Credentials Required
This page is in a restricted area.
page.
OK, I think I've at least found out why:
When "is_secure: off" in my apps/backend/config/security.yml, I can access the login page, http://localhost/sfpear/web/backend_dev.php/sfGuardAuth/sign in
However, if I turn it on, ie.,
$ cat apps/backend/config/security.yml
default:
is_secure: on
Then even accessing the sfGuardAuth/signin page is blocked by "Credentials Required
This page is in a restricted area."
So, how should I fix that?
thx
[Updated on: Fri, 16 February 2007 19:04] http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
|
|
|
|
|
|
| Re: Issues when installing sfGuard [message #21840 is a reply to message #21838 ] |
Fri, 16 February 2007 19:40   |
sfxpt Messages: 339 Registered: January 2007 Location: Canada |
Faithful Member |
|
|
thanks!
Somehow, even after I've turn on the security
$ cat ./apps/backend/config/security.yml
default:
is_secure: on
None of my previously protected pages are protected any more.
I haven't changed much, and I believe I've restored everything, except the new ./config/schema.yml file that I'm working on. Does it matter?
Anyway, it may take a while for me to get back to you.
thanks
http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
|
|
|
| Re: Issues when installing sfGuard [message #21841 is a reply to message #21838 ] |
Fri, 16 February 2007 20:31   |
sfxpt Messages: 339 Registered: January 2007 Location: Canada |
Faithful Member |
|
|
| marke wrote on Fri, 16 February 2007 13:22 | You should use /backend_dev.php/login and not signin according to the routing rule.
|
Ok, page protection is restored.
Yes, I should use /backend_dev.php/login, and yes it is accessible when "is_secure: off",
But no, the /backend_dev.php/login is blocked by "Credentials Required
This page is in a restricted area." if I turn the security on.
so...?
[Updated on: Fri, 16 February 2007 20:32] http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
|
|
|
|
|
| Re: Issues when installing sfGuard [message #21847 is a reply to message #21844 ] |
Fri, 16 February 2007 21:12   |
sfxpt Messages: 339 Registered: January 2007 Location: Canada |
Faithful Member |
|
|
| flat stanley wrote on Fri, 16 February 2007 15:01 | have you tried deleting your session cookies??
|
I don't think that matters because right after I turn the security on, I get blocked (to everywhere), and right after I turn the security off, I can access them again.
That being said, I did tried to remove my session cookies. but no, it didn't help.
thanks for the heads up though.
http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
|
|
|
| Re: Issues when installing sfGuard [message #21848 is a reply to message #21751 ] |
Fri, 16 February 2007 21:20   |
marke Messages: 23 Registered: January 2007 Location: Sweden |
Junior Member |
|
|
I've got a problem with this too and just found something that helped me.
In the sfGuardAuth module edit the security.yml file:
change:
loginSuccess:
is_secure: off
to:
signin:
is_secure: off
/Michael
[Updated on: Fri, 16 February 2007 21:22]
|
|
|
| Re: Issues when installing sfGuard [message #21849 is a reply to message #21847 ] |
Fri, 16 February 2007 21:23   |
sfxpt Messages: 339 Registered: January 2007 Location: Canada |
Faithful Member |
|
|
Hmm..., it is getting more difficult than I thought now. Ok, time to report all my tweaked file contents (according to the wiki):
Sorry for the long post...
$ cat apps/backend/config/settings.yml
prod:
.settings:
no_script_name: off
dev:
.settings:
# E_ALL | E_STRICT = 4095
error_reporting: 4095
web_debug: on
cache: off
no_script_name: off
etag: off
test:
.settings:
# E_ALL | E_STRICT & ~E_NOTICE = 2047
error_reporting: 2047
cache: off
web_debug: off
no_script_name: off
etag: off
#all:
# .actions:
# [....]
all:
.actions:
login_module: sfGuardAuth
login_action: signin
secure_module: sfGuardAuth
secure_action: secure
all:
.settings:
# Activated modules from plugins or from the symfony core
enabled_modules: [default, sfGuardGroup, sfGuardUser, sfGuardPermission, sfGuardAuth]
$ cat apps/backend/lib/myUser.class.php
<?php
class myUser extends sfGuardSecurityUser
{
}
$ cat apps/backend/config/routing.yml
# default rules
sf_guard_signin:
url: /login
param: { module: sfGuardAuth, action: signin }
sf_guard_signout:
url: /logout
param: { module: sfGuardAuth, action: signout }
sf_guard_password:
url: /request_password
param: { module: sfGuardAuth, action: password }
homepage:
url: /
param: { module: default, action: index }
default_symfony:
url: /symfony/:action/*
param: { module: default }
default_index:
url: /:module
param: { action: index }
default:
url: /:module/:action/*
$ cat apps/backend/config/security.yml
default:
is_secure: on
I think my sfGuard is installed ok, because the following urls can be accessed ok if the security is turned off:
http://localhost/sfpear/backend_dev.php/sfGuardUser
http://localhost/sfpear/backend_dev.php/login
http://localhost/sfpear/backend_dev.php/sfGuardAuth/signin
what could be the problem?
http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
|
|
|
| Re: Issues when installing sfGuard [message #21852 is a reply to message #21849 ] |
Fri, 16 February 2007 21:32   |
sfxpt Messages: 339 Registered: January 2007 Location: Canada |
Faithful Member |
|
|
Here is log, if it helps.
# type message
1 Info Routing connect "/login"
2 Info Routing connect "/logout"
3 Info Routing connect "/request_password"
4 Info Context initialization
5 Info Controller initialization
6 Info Routing match route [sf_guard_signin] "/login"
7 Info Request request parameters array ( 'module' => 'sfGuardAuth', 'action' => 'signin',)
8 Info Controller dispatch request
9 Info Filter executing filter "sfRenderingFilter"
10 Info Filter executing filter "sfWebDebugFilter"
11 Info Filter executing filter "sfBasicSecurityFilter"
12 Info Filter executing filter "sfRenderingFilter"
13 Info Filter executing filter "sfWebDebugFilter"
14 Info Filter executing filter "sfBasicSecurityFilter"
15 Info Filter executing filter "sfCommonFilter"
16 Info Filter executing filter "sfFlashFilter"
17 Info Filter executing filter "sfExecutionFilter"
18 Info Action call "defaultActions->executeLogin()"
19 Info View initialize view for "default/login"
20 Info View render "sf_symfony_data_dir/modules/default/templates/loginSuccess.php"
21 Info View decorate content with "sf_symfony_data_dir/modules/default/templates/defaultLayout.php"
22 Info View render "sf_symfony_data_dir/modules/default/templates/defaultLayout.php"
Step 19 & 20 looks interesting. "initialize view for "default/login"", then jump directly to "render loginSuccess.php"
!? Is that correct?
http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
|
|
|
| Re: Issues when installing sfGuard [message #21853 is a reply to message #21849 ] |
Fri, 16 February 2007 21:38   |
marke Messages: 23 Registered: January 2007 Location: Sweden |
Junior Member |
|
|
I think you are on the track now, there are no such template.
This means that if you have is_secure: on the login action will be secured.
So if you do the change in settings.yml i think you got it.
I don't have any accont to create a ticket about this so if anyone could......
/Michael
[Updated on: Fri, 16 February 2007 21:40]
|
|
|
|
| Re: Issues when installing sfGuard [message #21855 is a reply to message #21849 ] |
Fri, 16 February 2007 21:48   |
flat stanley Messages: 46 Registered: November 2006 Location: London |
Member |
|
|
yes, "render loginSuccess.php" is correct. This is the template used for the user to login, which is what you want.
try removing the second all: in your config yml
all:
.actions:
login_module: sfGuardAuth
login_action: signin
secure_module: sfGuardAuth
secure_action: secure
.settings:
# Activated modules from plugins or from the symfony core
enabled_modules: [default, sfGuardGroup, sfGuardUser, sfGuardPermission, sfGuardAuth]
Antique Silver, Hester Bateman Silver, Collecting Silver
|
|
|
| Re: [Solved] Issues when installing sfGuard [message #21859 is a reply to message #21751 ] |
Fri, 16 February 2007 22:53   |
marke Messages: 23 Registered: January 2007 Location: Sweden |
Junior Member |
|
|
Stanley, there is no template called loginSuccess.php in the sfGuardAuth module. Furthermore in the security.yml file you only set security levels for either the comlete module or for explicit actions. In this case I suppose it is the signing action that calls the signinSuccess.php template.
Please correct me if i'm wrong because i'm new to this.
sfxpt, if i'm right could you fix a ticket about this. If you are updating the wiki i also wonder if this could be of interest.
[edit] it was already done, sorry.
I had som troble with the profile issue but stumbled ove somthing interesting in the blog plugin. the reference to the id field in the sfGuardUser class from the sfGuardProfile Class is defined there like this:
user_id: { type: integer, foreignTable: sf_guard_user, foreignReference: id }
If i use this I am able to define a fixtures.yml like this:
sfGuardUser:
admin:
username: admin
password: admin
is_super_admin: true
sfGuardUserProfile:
admin:
user_id: admin
firstname: ad
lastname: min
/Michael
[Updated on: Fri, 16 February 2007 23:00]
|
|
|
| Re: [Solved] Issues when installing sfGuard [message #21861 is a reply to message #21751 ] |
Fri, 16 February 2007 23:19   |
flat stanley Messages: 46 Registered: November 2006 Location: London |
Member |
|
|
Well, I'm not sure what problem you guys had but just a few days ago I installed the latest sfGuard with the latest symfony and it worked just fine. Are you working with a fresh install?? Have you added any filters??
Antique Silver, Hester Bateman Silver, Collecting Silver
|
|
|
|
| Re: [Solved] Issues when installing sfGuard [message #21864 is a reply to message #21862 ] |
Fri, 16 February 2007 23:49   |
flat stanley Messages: 46 Registered: November 2006 Location: London |
Member |
|
|
right. You can secure the app in apps/app_name/config/security.yml with ...
and you can secure a module or action, in modules/module_name/config/security.yml with ...
#secure entire module
all:
is_secure: on
#secure list action of this module
list:
is_secure: on
I have successfully secured an entire app and selected actions but I haven't tried securing an entire module.
Is your problem with securing an entire module? did you remember to use 'all' instead of 'default'??
If this is the problem, I will check tomorrow on my development machine to see if I have the same problem.
Thanks
Antique Silver, Hester Bateman Silver, Collecting Silver
|
|
|
|
|
|
|
|
|
|
| Re: [Solved] Issues when installing sfGuard [message #22107 is a reply to message #21887 ] |
Tue, 20 February 2007 21:08   |
sfxpt Messages: 339 Registered: January 2007 Location: Canada |
Faithful Member |
|
|
| marke wrote on Sat, 17 February 2007 10:03 | I don't know if I'm going to be glad or mad but, now I've tested both forth and back and everyting works just like a charm with what I think is the default installation of this plugin.
What i did was to get rid of all that was'nt needed in the settings files ( comment's and stuff ). That is the olnly thing yhat I can see that was the difference.
|
Michael, you've saved my day again!!!
I followed your advice and everything works now!
The default apps/backend/config/settings.yml is just sooooo misleading...
oh, well, glad I'm over it.
PS. I was trying to update the sfGuard wiki so that the next person who follow it can avoid all the troubles that I bumpped into, but my symptom/solution part was deleted.
I've stopped amending the wiki since, because the comment was that my effort would be wiped off anyway, when there is new release for the sfGuard plugin...
http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
|
|
|
|
| Re: [Solved] Issues when installing sfGuard [message #22110 is a reply to message #22109 ] |
Tue, 20 February 2007 21:22   |
sfxpt Messages: 339 Registered: January 2007 Location: Canada |
Faithful Member |
|
|
thx for the offer,
please check the recent diffs of the sfGuard wiki,
Also, while you are there, please include the following sample for
apps/app_name/config/settings.yml (please include the full file spec as well).
all:
.actions:
login_module: sfGuardAuth
login_action: signin
secure_module: sfGuardAuth
secure_action: secure
.settings:
# Activated modules from plugins or from the symfony core
enabled_modules: [default, sfGuardGroup, sfGuardUser, sfGuardPermission, sfGuardAuth]
# rest of old content.
prod:
.settings: [...]
thx
http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
|
|
|
| Re: [Solved] Issues when installing sfGuard [message #22112 is a reply to message #22110 ] |
Tue, 20 February 2007 21:42   |
sfxpt Messages: 339 Registered: January 2007 Location: Canada |
Faithful Member |
|
|
Oh, don't forget to fix the file
plugins/sfGuardPlugin/modules/sfGuardAuth/config/security.ym l
which was reason for the first part of the thread:
#Login:
signin:
is_secure: off
# request_password -- method is not yet implemented.
#password:
# is_secure: off
http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
|
|
|
| Re: [Solved] Issues when installing sfGuard [message #22122 is a reply to message #21859 ] |
Tue, 20 February 2007 22:48   |
sfxpt Messages: 339 Registered: January 2007 Location: Canada |
Faithful Member |
|
|
| marke wrote on Fri, 16 February 2007 16:53 | I am able to define a fixtures.yml like this:
sfGuardUser:
admin:
username: admin
password: admin
is_super_admin: true
sfGuardUserProfile:
admin:
user_id: admin
firstname: ad
lastname: min
|
Glad it works for you that way, Michael.
I wasn't able to do that -- I have to use numbers for user_id for the sfGuardUserProfile table. I made it when I use numbers, but got the following error when changed them to ids.
maybe because I've explicitly add several records to the sfGuardUserProfile table, I don't know...
Fatal error: Class 'BasesfGuardAuthActions' not found in /var/www/sfpear/apps/backend/modules/sfGuardAuth/actions/actions.class.php on line 11
http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
|
|
|
|
|
| Re: [Solved] Issues when installing sfGuard [message #51082 is a reply to message #22107 ] |
Tue, 29 April 2008 18:29  |
tickbw Messages: 1 Registered: April 2008 |
Junior Member |
|
|
This worked for me as well!!!!!!
Thanks so much
|
|
|