Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Security] AbstractLoginFormAuthenticator supports function makes no sense with HttpUtils ? #51382

Open
@Hanmac

Description

@Hanmac

Symfony version(s) affected

5,4, 6.4

Description

create AbstractLoginFormAuthenticator with implementing getLoginUrl without overwriting supports:

This supports check doesn't make much sense checking for a relative url

publicfunctionsupports(Request$request):bool
{
return$request->isMethod('POST') &&$this->getLoginUrl($request) ===$request->getBaseUrl().$request->getPathInfo();
}

when implementation of getLoginUrl that would be logical using HttpUtils like this

protectedfunctiongetLoginUrl(Request$request):string
{
return$this->httpUtils->generateUri($request,$this->options['login_path']);
}

returns a absolute url

currently, the documentation is wrong:

* This default implementation handles all POST requests to the
* login path (@see getLoginUrl()).

How to reproduce

implement getLoginUrl but without overwriting supports

class MyFormAuthenticatorextends AbstractLoginFormAuthenticator     private HttpUtils$httpUtils;private array$options;publicfunction__construct(HttpUtils$httpUtils,array$options)    {$this->httpUtils =$httpUtils;$this->options =$options;    }protectedfunctiongetLoginUrl(Request$request):string     {return$this->httpUtils->generateUri($request,$this->options['login_path']);     }}

Possible Solution

i don't know what the best solution would be?

  • turn getLoginUrl into a relative Url or checking on absolute Url
  • use httpUtils->checkRequestPath ?

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp