Commit Graph

2611 Commits

Author SHA1 Message Date
Fabien Potencier
1436d8dab7 [Security] added an HttpUtils class to manage logic related to Requests and Responses
This change removes the need for the {_locale} hack.
Now, all paths in the Security component can be:

* An absolute path (/login)
* An absolute URL (http://symfony.com/login)
* A route name (login)

So, if you want to use a path that includes a global parameter (like _locale),
use a route instead of a path.
2011-06-22 14:47:19 +02:00
Jordi Boggiano
7350109f6e Renamed core.* events to kernel.* and CoreEvents to KernelEvents 2011-06-21 16:35:14 +02:00
Fabien Potencier
fa9b920051 [Security] renamed UserProviderInterface::loadUser() to refreshUser() 2011-06-16 18:00:36 +02:00
Fabien Potencier
fb24b95bd5 made some tweaks to error levels 2011-06-15 13:04:19 +02:00
Fabien Potencier
9e0d6177cb [Security] reverted some changes from previous merge 2011-06-15 12:35:09 +02:00
Fabien Potencier
01fcd7bdfd merged branch kaiwa/loglevel (PR #1073)
Commits
-------

cdf4b6a Checked log levels
a45d3ee Reverted last commit
529381b ControllerNotFound: Changed log level from info to error. Also moved throw exception code block up, to prevent the message from beeing logged multiple times.
7c29e88 Changed log level of "Matched route ..." message from info to debug
dca09fd Changed log level of "Using Controller ..." message from info to debug

Discussion
----------

Log levels

Just wanted to ask if the log level INFO is still correct for these messages?

As there are only four log levels left (DEBUG, INFO, WARNING, ERROR), DEBUG might be the more appropriate level for these messages now.

Let me give an example: An application is logging user actions (maybe to database) in order to assure comprehensibility, e. g. "User %s deleted post %d", "User %s written a message to user %s". These are not warnings of course, so the only suitable log level is INFO.
But they will be thrown together with these very common (at least two per request?) "Using controller..." and "Matched route..." messages when choosing INFO as log level.

---------------------------------------------------------------------------

by Seldaek at 2011/05/24 07:13:18 -0700

Agreed, this stuff is framework debug information.

---------------------------------------------------------------------------

by fabpot at 2011/05/24 08:53:24 -0700

Why do you want to change these two specific ones? The framework uses the INFO level at other places too. Is it a good idea to say that the framework only logs with DEBUG?

---------------------------------------------------------------------------

by stof at 2011/05/24 09:12:53 -0700

Doctrine logs at the INFO level too and I think it is useful to keep it as INFO. Being able to see the queries without having all DEBUG messages of the event dispatcher and security components is useful IMO.

---------------------------------------------------------------------------

by Seldaek at 2011/05/25 02:30:24 -0700

Yeah, that's true, maybe we just need to reintroduce (again, meh:) NOTICE between INFO and WARNING.

@kaiwa Of course the other way could be that you just add your DB handler to the app logger stack. That could be done in a onCoreRequest listener or such, basically you'd have to call `->pushHandler($yourDBHandler)` on the `monolog.logger.app` service. That way your messages will flow to it, but it won't receive noise from the framework stuff since those log on monolog.logger.request and other log channels.

---------------------------------------------------------------------------

by fabpot at 2011/05/25 02:48:26 -0700

@Seldaek: I don't think we need another level. We just need to come up with a standard rules about the usage of each level. Adapted from log4j:

* ERROR: Other runtime errors or unexpected conditions.
* WARN: Use of deprecated APIs, poor use of API, 'almost' errors, other runtime that are undesirable or unexpected, but not necessarily "wrong" (unable to write to the profiler DB, ).
* INFO: Interesting runtime events (security infos like the fact the user is logged-in or not, SQL logs, ...).
* DEBUG: Detailed information on the flow through the system (route match, security flow infos like the fact that a token was found or that remember-me cookie is found, ...).

What do you think?

---------------------------------------------------------------------------

by stloyd at 2011/05/25 02:53:38 -0700

+1 for this standard (also this PR can be merged then), but we should review code for other "wrong" log levels usage (if everyone accept this standard)

---------------------------------------------------------------------------

by fabpot at 2011/05/25 02:55:07 -0700

I won't merge this PR before all occurrences of the logger calls have been reviewed carefully and changed to the right level.

---------------------------------------------------------------------------

by kaiwa at 2011/05/25 02:58:44 -0700

@fabpot: Just noticed these two occurring for every request in my log file. You are right, there are other places where this changes must be applied if we will change the log level.

@stof: Hmm, i see. It is not possible to set the logger separately for each bundle, is it? That maybe would solve the problem. If somebody is interested in seeing the queries, he could set the log handler level to DEBUG for doctrine bundle, but still use INFO for the framwork itself. Plus he could even define a different output file or a completely different handler.

I'm not sure if something like that is possible already (?) or realizable at all... just came into my mind.

---------------------------------------------------------------------------

by Seldaek at 2011/05/25 03:01:07 -0700

Just FYI, from Monolog\Logger (which has CRITICAL and ALERT):

     * Debug messages
    const DEBUG = 100;

     * Messages you usually don't want to see
    const INFO = 200;

     * Exceptional occurences that are not errors
     * This is typically the logging level you want to use
    const WARNING = 300;

     * Errors
    const ERROR = 400;

     * Critical conditions (component unavailable, etc.)
    const CRITICAL = 500;

     * Action must be taken immediately (entire service down)
     * Should trigger alert by sms, email, etc.
    const ALERT = 550;

The values kind of match http error codes too, 4xx are expected errors that are not really important (404s etc) and 5xx are server errors that you'd better fix ASAP. I'm ok with the descriptions, but I think alert and critical should be included too. I'll probably update Monolog docblocks to match whatever ends up in the docs.

---------------------------------------------------------------------------

by Seldaek at 2011/05/25 03:03:21 -0700

@kaiwa you can do a lot, but not from the default monolog configuration entry, I'm not sure if we can really make that fully configurable without having a giant config mess. Please refer to my [comment above](https://github.com/symfony/symfony/pull/1073#issuecomment-1234316) to see how you could solve it. Maybe @fabpot has an idea how to make this more usable though.

---------------------------------------------------------------------------

by stof at 2011/05/25 03:19:43 -0700

@Seldaek the issue is that the different logging channels are only know in the compiler pass, not in the DI extension. So changing the level in the extension is really hard IMO.
Thus, the handlers are shared between the different logging channels (needed to open the log file only once for instance, or to send a single mail instead of one per channel) and the level is handled in the handlers, not the logger.

I'm +1 for the standard, by adding the distinction between 400 and 500 status calls using ERROR and CRITICAL (which is already the case in the code).

@kaiwa do you have time to review the calls to the logger between DEBUG and INFO or do you prefer I do it ? For instance, the Security component currently logs all message at DEBUG level and some of them should be INFO.

---------------------------------------------------------------------------

by kaiwa at 2011/05/25 04:31:04 -0700

@stof ok i'll do that

---------------------------------------------------------------------------

by kaiwa at 2011/05/25 12:22:51 -0700

Need some help :) I came across `ControllerNameParser::handleControllerNotFoundException()` which leads to redundant log messages currently:

>[2011-05-25 20:53:16] request.INFO: Unable to find controller "AppBaseBundle:Blog" - class "App\BaseBundle\Controller\BlogController" does not exist.

>[2011-05-25 20:53:16] request.ERROR: InvalidArgumentException: Unable to find controller "AppBaseBundle:Blog" - class "App\BaseBundle\Controller\BlogController" does not exist. (uncaught exception) at /home/ruth/symfony3/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php line 87

Is it necessary to call `$this->logger->info($log);` if the InvalidArgumentException will be logged anyway?

---------------------------------------------------------------------------

by stof at 2011/05/25 12:39:22 -0700

Well, the issue is that the ControllerNameParser logs messages and then uses them to throw an exception. I guess the logging call should be removed as it is redundant with the one of the ExceptionListener. @fabpot thoughts ?

---------------------------------------------------------------------------

by kaiwa at 2011/05/27 11:39:25 -0700

I checked all debug, info and log calls. Sometimes it is hard to distinguish between the levels, so it would be great if someone reviews @cdf4b6a. @stof, maybe you want to take a look?

---------------------------------------------------------------------------

by kaiwa at 2011/05/31 12:52:07 -0700

@stof, thanks for your comments. I added some replies above, please let me know your suggestions.

---------------------------------------------------------------------------

by stof at 2011/05/31 14:04:22 -0700

@kaiwa As I said before, all the security logging calls should be DEBUG (most of them) or INFO (the one syaing that authentication succeeded for instance), but not WARN or ERROR as the exception don't go outside the firewall.
2011-06-15 12:31:31 +02:00
Fabien Potencier
a232c148eb fixed CS 2011-06-14 12:54:32 +02:00
Fabien Potencier
a12ea12fc1 fixed CS 2011-06-13 18:54:20 +02:00
Ned Schwartz
47df88bfc9 made logoutPath localizable as well 2011-06-10 15:04:50 -07:00
Ned Schwartz
8fd4158468 storing localized targetPath in a string as opposed to updating the attribute 2011-06-10 14:32:10 -07:00
Ned Schwartz
17b7b558ce In the spirit of 882a8e3f09 allow for localized logout target url 2011-06-10 12:24:27 -07:00
Fabien Potencier
1aabc5da64 fixed CS 2011-06-08 12:16:48 +02:00
Fabien Potencier
62e4342a86 fixed CS 2011-06-08 12:12:55 +02:00
Fabien Potencier
188e74273a [Security] fixed sub-requests creation (closes #1212) 2011-06-08 10:36:14 +02:00
Christophe Coevoet
f3031251c5 Added the support of the locale in the login path and the check path 2011-06-06 21:44:53 +02:00
Johannes M. Schmitt
672cf78816 [Security/Http] removed irrelevant code 2011-06-03 14:02:57 +02:00
Johannes M. Schmitt
90b63ca346 [Security/Core] added missing method to interface 2011-06-01 11:48:19 +02:00
Fabien Potencier
65200aa86a added missing license headers 2011-05-31 10:57:06 +02:00
Fabien Potencier
02605f3481 merged origin/master 2011-05-31 08:34:05 +02:00
Fabien Potencier
514bf9af5d [Security] fixed wrong function call 2011-05-30 22:52:35 +02:00
Fabien Potencier
9181e5dd0c merged origin/master 2011-05-30 14:28:54 +02:00
Johannes M. Schmitt
971ff8175f [Security] fixes a possible bug when username is an integer 2011-05-30 14:09:16 +02:00
Fabien Potencier
d7220f0c1a [Security] fixed event names 2011-05-30 13:53:47 +02:00
Johannes M. Schmitt
bac3ee86f9 [Security] fixes a regression in the AclVoter 2011-05-30 10:04:46 +02:00
Johannes M. Schmitt
8837ce0e57 Merge branch 'master' of http://github.com/symfony/symfony into security 2011-05-30 10:00:07 +02:00
Fabien Potencier
0ce22f6bbe [Security] removed obsolete use statements 2011-05-30 09:36:59 +02:00
Fabien Potencier
c171142c01 renamed constants to upper cased 2011-05-30 09:04:37 +02:00
Fabien Potencier
5059559035 Merge remote branch 'Seldaek/events' into events1
* Seldaek/events:
  [EventDispatcher] Removed temporary code
  [FrameworkBundle] Improved code readability
  [FrameworkBundle] Clarified code and fixed regression
  Update Core and Security events to latest model
  [EventDispatcher] Allow registration of arbitrary callbacks
  [EventDispatcher] Remove useless code
  [EventDispatcher] Minor memory optimization to getListeners()
  [FrameworkBundle] Small optimization, remove some function calls
2011-05-30 08:58:49 +02:00
Pascal Borreli
824e48efa7 [Various] Fixed phpdoc 2011-05-29 23:33:36 +00:00
Johannes Schmitt
1f91e2e618 Revert "revert exception message"
This reverts commit b637a3190d.
2011-05-28 18:06:47 +02:00
Johannes Schmitt
edbf4ea691 Merge branch 'security' of github.com:schmittjoh/symfony into security 2011-05-28 17:09:32 +02:00
Johannes Schmitt
f37386e336 Merge branch 'master' of git://github.com/symfony/symfony into security 2011-05-28 17:07:16 +02:00
kaiwa
cdf4b6aa77 Checked log levels 2011-05-27 20:29:51 +02:00
Ryan Weaver
bad1cb61d0 [Security] Adding tests and then fixing bug where ContextListener did no logging 2011-05-26 15:08:19 -05:00
Jordi Boggiano
af0bd8a136 Update Core and Security events to latest model
The main benefit is that in XML/YML files we have common syntax (i.e. core.controller, form.pre_bind) that properly namespaces event names (before: onCoreController was ok, preBind was not).
On the other hand in PHP land we also have namespaced events, CoreEvents::controller, FormEvents::preBind, before it was Events::onCoreController, Events::onPreBind, we now have more context.
2011-05-26 11:55:07 +02:00
Jordi Boggiano
1246503e55 [EventDispatcher] Allow registration of arbitrary callbacks
This in effect removes the direct link between event name and the method name on the handler.
Any callback can be given as a handler and the event name becomes an arbitrary string. Allowing for easier namespacing (see next commit)
2011-05-26 11:54:06 +02:00
Thomas Rabaix
be2c427053 change self to static so the parent class can have access to the child constant 2011-05-24 18:25:28 +02:00
Johannes M. Schmitt
decac13331 added a few finals 2011-05-24 15:08:22 +02:00
Johannes Schmitt
bd9bfafd9c [Security/Http] use deep parameter for CSRF parameter 2011-05-18 13:01:54 +02:00
Johannes Schmitt
0eb7564f7d Merge remote branch 'origin/master' into security
Conflicts:
	src/Symfony/Bundle/FrameworkBundle/Listener/RequestAttributeInitializingListener.php
2011-05-18 12:54:47 +02:00
Johannes Schmitt
53f5c23c8f [Security/Acl] small voter refactoring 2011-05-18 12:48:50 +02:00
Kris Wallsmith
b645278f8b [Security] updated with "intention" 2011-05-16 14:16:30 -07:00
realmfoo
8519967796 Calling supportsClass from vote to find out if we can vote 2011-05-16 11:03:06 +04:00
Johannes Schmitt
28bee92c75 [Security/Http] better error message when session times out, or cookies are disabled 2011-05-14 16:41:18 +02:00
Johannes Schmitt
0acffb1a1a [Security/Http] {_locale} can be used as placeholder in target path generation
fixes #861
2011-05-14 16:21:27 +02:00
Johannes Schmitt
48dc85dc43 [Security/Acl] fixes #853 2011-05-14 14:19:55 +02:00
Johannes Schmitt
b637a3190d revert exception message 2011-05-14 13:25:03 +02:00
Ryan Weaver
1de34fde98 [Security] Improving the exception when the security context has no token
This either mostly - or always - means that no firewall is currently activated. This message tries to alert the user to this.

Reword
2011-05-11 15:09:36 -05:00
Johannes Schmitt
9408ab3010 [Security] use deep flag when retrieving username + password 2011-05-10 11:22:28 +02:00
Fabien Potencier
50c1cce014 Merge remote branch 'schmittjoh/security'
* schmittjoh/security:
  [HttpFoundation] added unit test
  [Security][HttpFoundation] splits Request::hasSession() into hasSession(), and hasPreviousSession()
  [SecurityBundle] added some tests
  add provider to configuration
  update DI to handle change in config and another provider
  separate dbal specific acl config
  add provider to configuration
  update DI to handle change in config and another provider
  separate dbal specific acl config
2011-05-09 14:26:36 +02:00
Matthieu Vachon
0da289cfbc [Security\Acl] Fixed hardcoded table names
* Replaced hardcoded table names by acl configuration options
2011-05-07 20:56:22 -04:00
Johannes Schmitt
362b7264d1 [Security][HttpFoundation] splits Request::hasSession() into hasSession(), and hasPreviousSession()
This closes #774, and fixes #772.
2011-05-05 08:38:07 +02:00
Eriksen Costa
164ce5210d capitalized 'boolean' 2011-04-27 02:35:10 -03:00
Pascal Borreli
8c0beea677 [Phpdoc] Cleaning/fixing 2011-04-23 15:18:47 +00:00
Fabien Potencier
9a4da005a2 Merge remote branch 'bschussek/form-extensions'
* bschussek/form-extensions:
  [Form] Refactored code from CoreExtension to new ValidatorExtension
  [Form] Added FormTypeExtensionInterface
  [Form] Reorganized code into "form extensions"
2011-04-23 09:11:25 +02:00
Pascal Borreli
b5769c52d6 Fixed various typo 2011-04-22 23:12:50 +00:00
Bernhard Schussek
54e66c518f [Form] Reorganized code into "form extensions"
The extension classes are now the only constructor argument of the FormFactory class. They replace the existing "type loader" classes.

    new FormFactory(array(
        new CoreExtension($validator, $storage),
        new CsrfExtension($csrfProvider),
        new DoctrineOrmExtension($em),
    ));

Together with a few upcoming commits this mechanism will make

 * extension of the form framework in bundles and
 * usage of the forms outside of Symfony2

much easier.
2011-04-22 17:41:21 +02:00
Johannes Schmitt
192592ec9b [Security/Core] force implementations to accept null values 2011-04-20 22:38:16 +02:00
Johannes Schmitt
f697fe3b26 [Security/Acl] some misc fixes 2011-04-20 22:35:17 +02:00
Johannes Schmitt
4d6e239f10 [Security/Acl] removed Doctrine dependency from interfaces and moved them to the actual implementation 2011-04-20 22:25:05 +02:00
Johannes M. Schmitt
c660fcd2f2 fixes a bug in the SwitchUserListener 2011-04-19 14:24:37 +02:00
Fabien Potencier
e09a0f9f80 Merge remote branch 'brikou/coding_standards'
* brikou/coding_standards:
  removed empty lines/trailing spaces
2011-04-19 14:06:30 +02:00
Tim Nagel
ad86f9ff0d [Security] Added missing phpdoc 2011-04-16 16:21:04 +10:00
Brikou CARRE
e898445b94 removed empty lines/trailing spaces 2011-04-15 21:12:02 +02:00
Fabien Potencier
e6fd8deb00 [Security] tweaked some exception messages 2011-04-12 11:41:39 +02:00
Fabien Potencier
d163a60f54 [Security] fixed URL 2011-04-12 10:49:22 +02:00
Jordi Boggiano
e697224efa [Security] Remove unneeded and invalid use statement 2011-04-05 18:42:00 +02:00
Gustavo Adrian
2e96f2c63d Fixed exception that was thrown while updating a field ACE 2011-04-05 13:05:20 -03:00
Johannes Schmitt
031bf35bb1 changed condition nesting 2011-03-26 09:06:03 +01:00
Johannes Schmitt
1282a595f2 Merge branch 'remember_me_dispatcher' of https://github.com/patashnik/symfony into security 2011-03-26 01:26:20 +01:00
Gustavo Adrian
bedbe51081 [Security] ACL: AclVoter::vote only gets an ObjectIdentity if $object is not an instance of ObjectIdentityInterface 2011-03-24 21:54:21 -03:00
Alexey Popkov
7423f0bf50 [SecurityBundle] fixed missing argument EventDisplatcher in RememberMe service 2011-03-24 14:00:16 +03:00
Christophe Coevoet
cc036b4f2b [Security] Removed useless method call 2011-03-23 00:02:57 +01:00
Christophe Coevoet
8b8bb66afe [Security] Fixed some listeners not updated after the event refactoring 2011-03-22 23:56:46 +01:00
Fabien Potencier
6ace6af537 Merge remote branch 'mvrhov/variousFixes' 2011-03-21 16:57:34 +01:00
Johannes M. Schmitt
eb0d772743 [Security/Acl] removed remaining LIMIT clauses 2011-03-21 11:39:05 +01:00
Miha Vrhovnik
909a6bfc30 $user* was refactored to $accout* 2011-03-21 11:20:21 +01:00
Miha Vrhovnik
a491af873b removed unecessary use statements (ExceptionEvent was also undefined namespace) 2011-03-21 10:41:39 +01:00
Johannes M. Schmitt
ede59926a4 Merge branch 'interactive-login-event' of git://github.com/yethee/symfony into security 2011-03-21 09:18:55 +01:00
Miha Vrhovnik
e35832ef2d Fixing failure on forward which was broken by Event refactoring 2011-03-19 13:06:52 +01:00
Amal Raghav
eff6bc8a80 fix to use setException 2011-03-19 17:08:34 +05:30
Deni
5e40695272 [Security] Added a type hint. 2011-03-19 01:32:33 +03:00
Fabien Potencier
cdfc731ff5 Merge remote branch 'schmittjoh/security' 2011-03-18 21:07:11 +01:00
Fabien Potencier
f990bf96ee Merge remote branch 'ornicar/removeNamespaceInSwitchUserListener' 2011-03-18 20:57:48 +01:00
ornicar
5e75c66a66 [Security] Remove duplicated namespace in SwitchUserListener 2011-03-18 12:30:09 -07:00
Johannes Schmitt
7e1c4d5748 [Security] removed un-needed event parameter from many interfaces 2011-03-18 20:20:19 +01:00
Fabien Potencier
5658d224fd Merge remote branch 'hhamon/security_token_fix' 2011-03-18 19:32:28 +01:00
hhamon
681a3b7ff0 [Security] removed import of the UserInterface interface as it is unused in the file and fix some phpdoc. 2011-03-18 18:44:04 +01:00
Johannes Schmitt
a56dbec6d8 [Security] removed un-needed event parameter from many interfaces 2011-03-18 18:26:55 +01:00
Fabien Potencier
e286adf173 [Security] fixed typos 2011-03-18 07:58:51 +01:00
Fabien Potencier
1af43a1562 fixed various bugs introduced during the event system migration 2011-03-18 07:35:59 +01:00
Fabien Potencier
6c8e71c8e7 renamed filterCore* to onCore*
The onCore* events are fired at some pre-defined points during the
handling of a request. At this is more important than the fact
that you can change things from the event.
2011-03-17 17:01:59 +01:00
Fabien Potencier
794b3b8e86 fixed phpdoc 2011-03-17 16:02:36 +01:00
Fabien Potencier
1219b98ec5 renamed some methods in the event dispatcher 2011-03-17 15:27:42 +01:00
Bernhard Schussek
466f1b99c5 [Security] Fixed method names in the Firewall listeners 2011-03-17 13:24:23 +01:00
Bernhard Schussek
ffdc879624 [Security] Fixed method calls on EventDispatcher 2011-03-17 12:34:30 +01:00
Bernhard Schussek
5f14d8d6aa Merge remote branch 'symfony/master' into event-manager
Conflicts:
	src/Symfony/Bundle/AsseticBundle/CacheWarmer/AssetWriterCacheWarmer.php
	src/Symfony/Bundle/AsseticBundle/Tests/CacheWarmer/AssetWriterCacheWarmerTest.php
	src/Symfony/Bundle/FrameworkBundle/Profiler/ProfilerListener.php
	src/Symfony/Bundle/FrameworkBundle/Resources/config/profiling.xml
	src/Symfony/Component/HttpKernel/HttpKernel.php
	src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php
	src/Symfony/Component/Security/Http/Firewall/AbstractPreAuthenticatedListener.php
2011-03-17 12:34:12 +01:00
Johannes M. Schmitt
4539b47522 [Security] small performance optimization 2011-03-14 17:41:33 +01:00
Bernhard Schussek
932f3b1f06 [Security] Fixed calls to EventDispatcher::dispatchEvent() 2011-03-13 21:30:50 +01:00
Bernhard Schussek
06c682b4fb Switched from Doctrine's EventManager implementation to the EventManager clone in Symfony2 (now called EventDispatcher again) 2011-03-13 19:49:10 +01:00
Johannes M. Schmitt
76573f1ab2 [Security] added some finals, some visibility changes 2011-03-13 19:40:12 +01:00
Bernhard Schussek
25931caeab Merge remote branch 'symfony/master' into event-manager
Conflicts:
	src/Symfony/Bundle/FrameworkBundle/Debug/TraceableEventManager.php
	src/Symfony/Bundle/WebProfilerBundle/WebDebugToolbarListener.php
	src/Symfony/Component/Security/Http/Firewall.php
	src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php
	src/Symfony/Component/Security/Http/Firewall/AbstractPreAuthenticatedListener.php
	src/Symfony/Component/Security/Http/Firewall/AccessListener.php
	src/Symfony/Component/Security/Http/Firewall/AnonymousAuthenticationListener.php
	src/Symfony/Component/Security/Http/Firewall/BasicAuthenticationListener.php
	src/Symfony/Component/Security/Http/Firewall/ChannelListener.php
	src/Symfony/Component/Security/Http/Firewall/ContextListener.php
	src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php
	src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php
	src/Symfony/Component/Security/Http/Firewall/ListenerInterface.php
	src/Symfony/Component/Security/Http/Firewall/LogoutListener.php
	src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php
	src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php
	tests/Symfony/Tests/Component/Security/Http/Firewall/RememberMeListenerTest.php
2011-03-13 19:15:25 +01:00
Johannes Schmitt
70867f06e9 re-added a __toString method for debugging purposes 2011-03-12 13:24:57 +01:00
Klaas Naaijkens
02cb362ae6 use username instead of token object in logging 2011-03-12 13:24:57 +01:00
Johannes Schmitt
97125269d2 [Security] fixed some tests 2011-03-11 12:50:52 +01:00
Johannes Schmitt
d8022e34eb [Security] removed core.security event 2011-03-11 01:43:22 +01:00
Johannes M. Schmitt
3d97638813 [Security] refactored remember-me code 2011-03-11 01:19:55 +01:00
Johannes M. Schmitt
a64cc0e3cc [Security] some more visibility changes 2011-03-10 10:25:33 +01:00
Johannes M. Schmitt
13665fc113 [Security] added some more tests 2011-03-10 10:25:33 +01:00
Johannes M. Schmitt
5127ece259 [Security] fixed some left-overs 2011-03-10 10:25:32 +01:00
Johannes Schmitt
1d5538fc60 [Security] various changes, see below
- visibility changes from protected to private
- AccountInterface -> UserInterface
- SecurityContext::vote() -> SecurityContext::isGranted()
2011-03-10 10:25:32 +01:00
Bernhard Schussek
2cf3779a2c Renamed EventArgs classes and adapted remaining code to EventManager
The only missing part is ContainerAwareEventManager::addEventSubscriberService(),
because I'm not sure how to find out the class name of a service in the DIC.

Also, inline documentation of this code needs to be finished once it is accepted.
2011-03-07 19:16:05 +01:00
Bernhard Schussek
a54d3e6fb0 Merge remote branch 'symfony/master' into event-manager 2011-03-07 19:15:57 +01:00
Fabien Potencier
8c423edfef replaced symfony-project.org by symfony.com 2011-03-06 12:40:06 +01:00
Bernhard Schussek
f1393d7b1f Replaced EventDispatcher by Doctrine's EventManager implementation
Doctrine's EventManager implementation has several advantages over the
EventDispatcher implementation of Symfony2. Therefore I suggest that we
use their implementation.

Advantages:

 * Event Listeners are objects, not callbacks. These objects have handler
   methods that have the same name as the event. This helps a lot when
   reading the code and makes the code for adding an event listener shorter.
 * You can create Event Subscribers, which are event listeners with an
   additional getSubscribedEvents() method. The benefit here is that the
   code that registers the subscriber doesn't need to know about its
   implementation.
 * All events are defined in static Events classes, so users of IDEs benefit
   of code completion
 * The communication between the dispatching class of an event and all
   listeners is done through a subclass of EventArgs. This subclass can be
   tailored to the type of event. A constructor, setters and getters can be
   implemented that verify the validity of the data set into the object.
   See examples below.
 * Because each event type corresponds to an EventArgs implementation,
   developers of event listeners can look up the available EventArgs methods
   and benefit of code completion.
 * EventArgs::stopPropagation() is more flexible and (IMO) clearer to use
   than notifyUntil(). Also, it is a concept that is also used in other
   event implementations

Before:

    class EventListener
    {
        public function handle(EventInterface $event, $data) { ... }
    }

    $dispatcher->connect('core.request', array($listener, 'handle'));
    $dispatcher->notify('core.request', new Event(...));

After (with listeners):

    final class Events
    {
        const onCoreRequest = 'onCoreRequest';
    }

    class EventListener
    {
        public function onCoreRequest(RequestEventArgs $eventArgs) { ... }
    }

    $evm->addEventListener(Events::onCoreRequest, $listener);
    $evm->dispatchEvent(Events::onCoreRequest, new RequestEventArgs(...));

After (with subscribers):

    class EventSubscriber
    {
        public function onCoreRequest(RequestEventArgs $eventArgs) { ... }

        public function getSubscribedEvents()
        {
            return Events::onCoreRequest;
        }
    }

    $evm->addEventSubscriber($subscriber);
    $evm->dispatchEvent(Events::onCoreRequest, new RequestEventArgs(...));
2011-03-05 15:30:34 +01:00
Johannes Schmitt
b67a1dd677 [Security] forward the entire access denied exception instead of only the message 2011-03-05 14:30:08 +01:00
Johannes Schmitt
63dbcea8ee Merge branch 'lewinski-fix-acl-schema-generator' into security 2011-03-05 14:13:53 +01:00
Johannes Schmitt
0eb4f49061 Merge branch 'fix-acl-schema-generator' of https://github.com/lewinski/symfony into lewinski-fix-acl-schema-generator 2011-03-05 13:54:10 +01:00
Johannes Schmitt
4c7aa343d3 Merge branch 'opensky-hotfix/remember-me-token-fix' into security 2011-03-05 13:51:52 +01:00
Johannes Schmitt
e03958f5b0 Merge branch 'cyqui-TICKET_9557' into security 2011-03-05 13:50:14 +01:00
Johannes Schmitt
f82b89cdc5 [Security] changed defaults for MessageDigestEncoder
- encode_as_base64 set to true
- iterations increased to 5000 from 1
2011-03-05 13:45:35 +01:00
Cyril Quintin
310a6c99a2 TICKET #9557: session isn't required when using http basic authentification mecanism for example 2011-03-05 13:33:56 +01:00
Johannes Schmitt
f010742e45 [Security] improved entropy to make collision attacks harder 2011-03-05 13:30:27 +01:00
Bulat Shakirzyanov
dbde41c082 [Security] added the 'key' attribute of RememberMeToken to serialized string to be stored in session 2011-03-04 13:26:08 -05:00
Pascal Borreli
843d5a8399 [Security] Fixed Typo 2011-03-01 18:58:08 +01:00
Matthew Lewinski
cde5f528c2 Fix the Acl schema generator script.
Change 3e818846 in doctrine/dbal introduced a number of new classes in
the Doctrine\DBAL\Platforms\Keywords namespace, so we need to be more
careful here when generating Acl schema, so as to only load Platform
classes and not any others in the same directory.
2011-02-27 16:56:47 -06:00
Fabien Potencier
c99a44b1e8 Merge remote branch 'schmittjoh/security'
* schmittjoh/security:
  [Security] added method to retrieve the configured remember-me parameter
  [Security] Copy token attributes when auth providers create a new token from another
2011-02-27 22:20:44 +01:00
Fabien Potencier
cdf6851eb3 fixed merge 2011-02-27 21:16:13 +01:00
Fabien Potencier
49f84f1997 Merge remote branch 'lsmith77/code_analyzer_2011_02_27'
* lsmith77/code_analyzer_2011_02_27:
  corrected NonceExpiredException namespace
  issues found by static code analysis
2011-02-27 21:12:31 +01:00
Christophe Coevoet
92bfbf575c Fixed CS 2011-02-27 20:56:29 +01:00
Lukas Kahwe Smith
2bf30f8bb7 corrected NonceExpiredException namespace 2011-02-27 19:46:40 +01:00
Lukas Kahwe Smith
4b3c49550f issues found by static code analysis 2011-02-27 19:34:02 +01:00
Pascal Borreli
787812d968 [Security] Removed useless else 2011-02-27 18:36:38 +01:00
Johannes Schmitt
97ee92e7b0 Merge branch 'CopyTokenAttributesInProviders' of https://github.com/opensky/symfony into opensky-CopyTokenAttributesInProviders 2011-02-26 21:47:57 +01:00
Johannes Schmitt
621a79f1f2 [Security] added method to retrieve the configured remember-me parameter 2011-02-26 21:44:40 +01:00
Pascal Borreli
2fbb8e07f8 [Security] Fixed typo 2011-02-26 20:02:06 +01:00
Jeremy Mikola
5113886f34 [Security] Copy token attributes when auth providers create a new token from another
PreAuthenticatedAuthenticationProvider and UserAuthenticationProvider tend to copy a token instead of modifying it during their authenticate() methods, which is probably a good idea if the token might be immutable. Ensure that the token's attributes get copied along with everything else.
2011-02-23 16:03:01 -05:00
Fabien Potencier
f54cedfe5e added LICENSE files for the subtree repositories 2011-02-22 18:58:15 +01:00
Fabien Potencier
353177d1d6 replaced Response::createRedirect by a new RedirectResponse class 2011-02-21 18:10:53 +01:00
Fabien Potencier
d94acd85f9 remove response as a service
The Response is not available in the DIC anymore.

When you need to create a response, create an instance of
Symfony\Component\HttpFoundation\Response instead.

As a side effect, the Controller::createResponse() and Controller::redirect()
methods have been removed and can easily be replaced as follows:

  return $this->createResponse('content', 200, array('foo' => 'bar'));
  return new Response('content', 200, array('foo' => 'bar'));

  return $this->redirect($url);
  return Response::createRedirect($url);
2011-02-21 17:36:04 +01:00
Johannes M. Schmitt
53f3ff8258 [Security] adds a chain user provider 2011-02-16 23:00:27 +01:00
Johannes Schmitt
82c6844147 [Security] moved Security classes out of DoctrineBundle, cleaned-up SecurityExtension accordingly
Note that this commit removes the built-in support for MongoDB user providers.
This code can be moved back in once there is a stable release for MongoDB, but
for now you have to set-up that user provider just like you would set-up any
custom user provider:

    security:
         providers:
             document_provider:
                 id: my.mongo.provider
2011-02-16 23:00:27 +01:00
Johannes Schmitt
dfd921822a [Security/Http] Adds CSRF protection to the form-login 2011-02-16 23:00:27 +01:00
Johannes M. Schmitt
d22743cf3a [Security] removed defaults from boolean columns 2011-02-16 23:00:27 +01:00
Victor Berchet
1d7f8120e0 Update code with latest Finder changes 2011-02-16 22:53:11 +01:00
Jeremy Mikola
cc4eb6b40f [Security] Add providerKey to PreAuthenticatedToken tokens constructed by PreAuthenticatedAuthenticationProvider 2011-02-15 21:55:24 +01:00
Jeremy Mikola
b8d574087f [Security] Allow authentication tokens to hold attributes 2011-02-15 21:50:02 +01:00
Johannes M. Schmitt
bc05bef2b9 [Security] fixes a bug in DigestAuthenticationListener 2011-02-14 20:55:07 +01:00
Johannes M. Schmitt
44b89e5ac3 [Security] fixes a bug when clearing cookies on logout 2011-02-14 20:55:07 +01:00
Johannes Schmitt
b685b3ab4d [Security] adds logout success handler 2011-02-14 20:55:07 +01:00
Johannes Schmitt
9e6fc0a11e [Security] fixes a bug where authentication errors might have leaked confidential information 2011-02-14 20:55:06 +01:00
Johannes Schmitt
5c7fe8f866 [Security] simplified encoder factory implementation 2011-02-14 20:55:06 +01:00
Johannes M. Schmitt
b9f4eab5c2 [Security/Acl] added pre-generated schemas 2011-02-14 20:55:06 +01:00
Deni
657f90a931 [Security] Fixed missed argument in call custom handler when authentication is successful. 2011-02-13 22:27:28 +01:00
dordille
205621dee8 Changed namepace use of SecurityContext to SecurityContextInterface so that constant SecurityContextInterface::LAST_USERNAME would resolve properly
Also changed method signature of __construct to take and instance of SecurityContextInterface instead of SecurityContext
2011-02-13 10:36:15 +01:00
Johannes M. Schmitt
3dfc09cd8d [Security] fixes some regressions 2011-02-13 00:15:57 +01:00
Jordi Boggiano
9bcd1b3e5f [Security] Fixed indenting 2011-02-12 22:14:16 +01:00
Johannes Schmitt
9749da6e52 [Security] performance improvements of PermissionGrantingStrategy 2011-02-12 21:53:04 +01:00
Johannes Schmitt
19bbafc441 [Security] Refactored security context, moved getUser() implementation to templating 2011-02-12 21:53:04 +01:00
Johannes Schmitt
66fbbd6b17 [Security] removed __toString() from AccountInterface 2011-02-12 21:53:04 +01:00
Christophe Coevoet
74b87294c2 Fixed access denied handling 2011-02-10 15:32:59 +01:00
Fabien Potencier
37537e3e8c fixed previous commit 2011-02-04 19:38:42 +01:00
Lukas Kahwe Smith
dd71501f54 some fixes by just "blindly" trying to make phpStorm code analysis happier 2011-02-04 19:30:28 +01:00
Lukas Kahwe Smith
661d5d236c fixed method call, cosmetic variable rename 2011-02-04 00:32:15 +01:00
Fabien Potencier
5288381f61 Revert "[Security] Missing Event namespace in SwitchUserListener"
This reverts commit 0169892dcd.
2011-02-02 14:35:29 +01:00
Jeremy Mikola
0169892dcd [Security] Missing Event namespace in SwitchUserListener 2011-02-02 11:32:56 +01:00
Johannes M. Schmitt
2b697423b4 [Security] bug fix in FormAuthenticationEntryPoint 2011-02-02 11:31:28 +01:00
Sebastian Utz
4d5853866a [Security] fixed a Token serialization bug 2011-02-02 11:31:28 +01:00
Johannes M. Schmitt
fbc21fedf7 [Security] some bug fixes 2011-02-02 11:31:28 +01:00
Sergey Linnik
92ddaa11cd Fixed typo 2011-01-28 18:46:27 +01:00
Bulat Shakirzyanov
81219bba15 [Security] fixed typo 2011-01-28 18:20:59 +01:00
Johannes M. Schmitt
8ccb8eb8c2 added two events "security.interactive_login", and "security.switch_user" 2011-01-27 13:49:01 +01:00
Johannes M. Schmitt
00d3d8c3bc renamed PreAuthenticatedListener to AbstractPreAuthenticatedListener to be consistent 2011-01-27 13:49:01 +01:00
Johannes Schmitt
139510a78e added some doc comments 2011-01-27 13:49:00 +01:00
Johannes M. Schmitt
cf64d2cfe7 namespace changes
Symfony\Component\Security -> Symfony\Component\Security\Core
Symfony\Component\Security\Acl remains unchanged
Symfony\Component\HttpKernel\Security -> Symfony\Component\Security\Http
2011-01-26 22:23:20 +01:00
Johannes Schmitt
e0fe42d050 removed isAuthenticated() from SecurityContext 2011-01-26 16:38:54 +01:00
Johannes Schmitt
57ae50e894 [Security] many improvements, and fixes 2011-01-26 16:38:54 +01:00
Lukas Kahwe Smith
ddea635a51 fixes else -> } else 2011-01-19 07:20:23 +01:00
Dominique Bongiraud
64fb94c725 normalized license messages in PHP files 2011-01-18 08:07:46 +01:00
Fabien Potencier
1c3a01b25c removed duplicate code 2011-01-07 17:14:41 +01:00
Johannes M. Schmitt
314defa8b4 added generic encoder factory 2011-01-06 19:20:56 +01:00
Johannes M. Schmitt
0449dbdc5d added extra exception if only a partial result is found 2011-01-05 22:51:05 +01:00
Johannes M. Schmitt
55a48bcfa6 optimized AclVoter, added unit test 2011-01-03 07:46:16 +01:00
Johannes M. Schmitt
a99d8c8558 fix possible duplicate security identities 2011-01-02 10:53:54 +01:00
Johannes Schmitt
b4288459cc added ACL system to the Security Component 2010-12-31 09:25:53 +01:00
Johannes Schmitt
27f540463a added generic encoder factory 2010-12-21 16:23:46 +01:00
Fabien Potencier
b57411b5ec renamed reloadUserByAccount() to loadUserByAccount() 2010-12-18 08:15:13 +01:00
Johannes Schmitt
df6ffbbf07 remove user provider name 2010-12-18 08:10:53 +01:00
Johannes Schmitt
3c692bd160 fixed user refreshing after unserialization 2010-12-15 17:38:30 +01:00
Johannes Schmitt
abe8047262 added authentication trust resolver 2010-12-12 10:49:43 +01:00
Fabien Potencier
9944542811 [Security] fixed method visibility 2010-12-12 08:02:13 +01:00
Fabien Potencier
131776001f removed ForbiddenHttpException
Both HttpKernel and Security define a 403 exception:

* Symfony\Component\HttpKernel\Exception\ForbiddenHttpException
* Symfony\Component\Security\Exception\AccessDeniedException

The one in HttpKernel has been removed in favor of the Security one.
2010-12-10 09:00:06 +01:00
Fabien Potencier
944d91c1df made some method name changes to have a better coherence throughout the framework
When an object has a "main" many relation with related "things" (objects,
parameters, ...), the method names are normalized:

 * get()
 * set()
 * all()
 * replace()
 * remove()
 * clear()
 * isEmpty()
 * add()
 * register()
 * count()
 * keys()

The classes below follow this method naming convention:

 * BrowserKit\CookieJar -> Cookie
 * BrowserKit\History -> Request
 * Console\Application -> Command
 * Console\Application\Helper\HelperSet -> HelperInterface
 * DependencyInjection\Container -> services
 * DependencyInjection\ContainerBuilder -> services
 * DependencyInjection\ParameterBag\ParameterBag -> parameters
 * DependencyInjection\ParameterBag\FrozenParameterBag -> parameters
 * DomCrawler\Form -> FormField
 * EventDispatcher\Event -> parameters
 * Form\FieldGroup -> Field
 * HttpFoundation\HeaderBag -> headers
 * HttpFoundation\ParameterBag -> parameters
 * HttpFoundation\Session -> attributes
 * HttpKernel\Profiler\Profiler -> DataCollectorInterface
 * Routing\RouteCollection -> Route
 * Security\Authentication\AuthenticationProviderManager -> AuthenticationProviderInterface
 * Templating\Engine -> HelperInterface
 * Translation\MessageCatalogue -> messages

The usage of these methods are only allowed when it is clear that there is a
main relation:

 * a CookieJar has many Cookies;

 * a Container has many services and many parameters (as services is the main
   relation, we use the naming convention for this relation);

 * a Console Input has many arguments and many options. There is no "main"
   relation, and so the naming convention does not apply.

For many relations where the convention does not apply, the following methods
must be used instead (where XXX is the name of the related thing):

 * get()      -> getXXX()
 * set()      -> setXXX()
 * all()      -> getXXXs()
 * replace()  -> setXXXs()
 * remove()   -> removeXXX()
 * clear()    -> clearXXX()
 * isEmpty()  -> isEmptyXXX()
 * add()      -> addXXX()
 * register() -> registerXXX()
 * count()    -> countXXX()
 * keys()
2010-11-25 17:30:06 +01:00
Fabien Potencier
a19cdce1bc [Security] added some missing unit tests 2010-10-31 23:41:36 +01:00
Fabien Potencier
ec417578ca [Security] added unit tests to some authenticated providers (code coverage is more than 96% for the Security component now) 2010-10-31 15:41:15 +01:00
Fabien Potencier
3d5054f21f [Security] added unit tests for the Authentication sub-namespace 2010-10-31 13:39:12 +01:00
Johannes M. Schmitt
3463f47698 applies base64 encoding directly to the binary data instead of their hexadecimal representation 2010-10-24 10:57:06 +02:00
Dominique Bongiraud
a85bca395a [Security]Fixed markup 2010-10-24 09:55:32 +02:00
Dominique Bongiraud
66ff8073b9 [Security]Fixed CS 2010-10-24 09:55:31 +02:00
Fabien Potencier
4027f751e3 [Security] added more unit tests 2010-10-22 17:48:58 +02:00
Fabien Potencier
d2b184e058 [Security] removed type hint in AuthenticationException as the extra information can be of different classes 2010-10-22 15:19:13 +02:00
Johannes Schmitt
d077ac4158 [Security] changed encoders to use hash() function whenver possible and replaced sha1 with sha256 as default algorithm 2010-10-22 13:24:29 +02:00
Victor Berchet
4dacdcc4ec [Security] Use a negative length parameter to simplify the code 2010-10-21 18:24:57 +02:00
Fabien Potencier
82f8ab839f [Security] added some unit tests (WIP) 2010-10-21 18:14:32 +02:00
Fabien Potencier
836c512585 fixed interfaces problems 2010-10-21 17:16:31 +02:00
Artur Kotyrba
2682bc2be5 [Security] Fixed typo 2010-10-21 08:30:46 +02:00
Fabien Potencier
0749038e73 [Security] changed the way passwords are compared to avoid timing attacks 2010-10-21 07:36:55 +02:00
Pascal Borreli
437f8c7a86 [Security] Fixed typo 2010-10-20 07:07:54 +02:00
Pascal Borreli
d067d5da69 [Security] Fixed coding standard 2010-10-19 17:22:31 +02:00
Pascal Borreli
fde278d7a8 [Security] Fixed typo 2010-10-19 17:21:28 +02:00
Fabien Potencier
f216f313e8 added the Security Component and its integration into the MVC framework
Happy birthday symfony!
2010-10-19 13:33:17 +02:00