@@ -55,7 +55,7 @@ public function __construct(SecurityContextInterface $securityContext, Authentic
55
55
*/
56
56
protected function requiresAuthentication (Request $ request )
57
57
{
58
- if ($ this ->options ['post_only ' ] && !$ request ->isMethod ('post ' )) {
58
+ if ($ this ->options ['post_only ' ] && !$ request ->isMethod ('POST ' )) {
59
59
return false ;
60
60
}
61
61
@@ -67,14 +67,6 @@ protected function requiresAuthentication(Request $request)
67
67
*/
68
68
protected function attemptAuthentication (Request $ request )
69
69
{
70
- if ($ this ->options ['post_only ' ] && !$ request ->isMethod ('post ' )) {
71
- if (null !== $ this ->logger ) {
72
- $ this ->logger ->debug (sprintf ('Authentication method not supported: %s. ' , $ request ->getMethod ()));
73
- }
74
-
75
- return null ;
76
- }
77
-
78
70
if (null !== $ this ->csrfProvider ) {
79
71
$ csrfToken = $ request ->get ($ this ->options ['csrf_parameter ' ], null , true );
80
72
@@ -83,8 +75,13 @@ protected function attemptAuthentication(Request $request)
83
75
}
84
76
}
85
77
86
- $ username = trim ($ request ->get ($ this ->options ['username_parameter ' ], null , true ));
87
- $ password = $ request ->get ($ this ->options ['password_parameter ' ], null , true );
78
+ if ($ this ->options ['post_only ' ]) {
79
+ $ username = trim ($ request ->request ->get ($ this ->options ['username_parameter ' ], null , true ));
80
+ $ password = $ request ->request ->get ($ this ->options ['password_parameter ' ], null , true );
81
+ } else {
82
+ $ username = trim ($ request ->get ($ this ->options ['username_parameter ' ], null , true ));
83
+ $ password = $ request ->get ($ this ->options ['password_parameter ' ], null , true );
84
+ }
88
85
89
86
$ request ->getSession ()->set (SecurityContextInterface::LAST_USERNAME , $ username );
90
87
0 commit comments