Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: symfony/security-http
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v6.1.0-BETA1
Choose a base ref
...
head repository: symfony/security-http
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7.3
Choose a head ref

Commits on Apr 15, 2022

  1. bug #45452 [Security] Fix UserNotFoundException is not thrown (damienfa)

    This PR was merged into the 5.4 branch.
    
    Discussion
    ----------
    
    [Security] Fix UserNotFoundException is not thrown
    
    | Q             | A
    | ------------- | ---
    | Branch?       |  5.4
    | Bug fix?      | yes
    | New feature?  | no
    | Deprecations? | no
    | Tickets       | Fix #45070
    | License       | MIT
    | Doc PR        |  N/A
    
    Commits
    -------
    
    7e0ed85d9a Fix issue 45070 :  UserNotFoundException is not thrown
    fabpot authored and nicolas-grekas committed Apr 15, 2022
    Copy the full SHA
    a110818 View commit details
  2. cs fix

    nicolas-grekas committed Apr 15, 2022
    Copy the full SHA
    1bc534e View commit details
  3. Merge branch '5.4' into 6.0

    * 5.4:
      cs fix
      bug #45452 [Security] Fix UserNotFoundException is not thrown (damienfa)
    nicolas-grekas committed Apr 15, 2022
    Copy the full SHA
    a0ec71e View commit details
  4. Merge branch '6.0' into 6.1

    * 6.0:
      cs fix
      bug #45452 [Security] Fix UserNotFoundException is not thrown (damienfa)
    nicolas-grekas committed Apr 15, 2022
    Copy the full SHA
    c7fb5e2 View commit details
  5. Copy the full SHA
    774cec5 View commit details
  6. µfix

    nicolas-grekas committed Apr 15, 2022
    Copy the full SHA
    8a9e22b View commit details

Commits on Apr 16, 2022

  1. minor #46063 [Security] Add test case for user not found (chalasr)

    This PR was merged into the 5.4 branch.
    
    Discussion
    ----------
    
    [Security] Add test case for user not found
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 5.4
    | Bug fix?      | no
    | New feature?  | no
    | Deprecations? | no
    | Tickets       | -
    | License       | MIT
    | Doc PR        | -
    
    Covering the changes made in #45452.
    
    Commits
    -------
    
    4a75e98252 [Security] Add test case for user not found
    fabpot committed Apr 16, 2022
    Copy the full SHA
    3d4b612 View commit details

Commits on Apr 17, 2022

  1. Merge branch '5.4' into 6.0

    * 5.4:
      fix merge
      do not use mocks in tests when not necessary
      [Mailer] Missing import in first example
      [Security] Add test case for user not found
      [SecurityBundle] Use config's secret in remember-me signatures
    xabbuh committed Apr 17, 2022
    Copy the full SHA
    d45240c View commit details
  2. Merge branch '6.0' into 6.1

    * 6.0:
      fix merge
      do not use mocks in tests when not necessary
      [Mailer] Missing import in first example
      [Security] Add test case for user not found
      [SecurityBundle] Use config's secret in remember-me signatures
    xabbuh committed Apr 17, 2022
    Copy the full SHA
    09e90f7 View commit details

Commits on May 5, 2022

  1. Copy the full SHA
    f5b6fa2 View commit details
  2. Merge branch '4.4' into 5.4

    * 4.4:
      [Console] Better required argument check in InputArgument
      [EventDispatcher] Fix removing listeners when using first-class callable syntax
    nicolas-grekas committed May 5, 2022
    Copy the full SHA
    13c0d9c View commit details
  3. Merge branch '5.4' into 6.0

    * 5.4:
      [Console] Better required argument check in InputArgument
      [EventDispatcher] Fix removing listeners when using first-class callable syntax
    nicolas-grekas committed May 5, 2022
    Copy the full SHA
    6548626 View commit details
  4. Merge branch '6.0' into 6.1

    * 6.0:
      [Console] Better required argument check in InputArgument
      [EventDispatcher] Fix removing listeners when using first-class callable syntax
    nicolas-grekas committed May 5, 2022
    Copy the full SHA
    35817a1 View commit details
  5. fix merge

    nicolas-grekas committed May 5, 2022
    Copy the full SHA
    f249ef3 View commit details

Commits on May 6, 2022

  1. Merge branch '4.4' into 5.4

    * 4.4:
      [DoctrineBridge] Treat firstResult === 0 like null
      [HttpKernel] Fix SessionListener without session in request #46268
    nicolas-grekas committed May 6, 2022
    Copy the full SHA
    b7ee4af View commit details
  2. Merge branch '5.4' into 6.0

    * 5.4:
      [DoctrineBridge] Treat firstResult === 0 like null
      [Translation] Refresh local translations if the provider has domains
      [HttpKernel] Fix SessionListener without session in request #46268
      [Notifier] Allow symfony/mercure 0.6 in Mercure bridge
    nicolas-grekas committed May 6, 2022
    Copy the full SHA
    ce6e0a5 View commit details
  3. Merge branch '6.0' into 6.1

    * 6.0:
      [DoctrineBridge] Treat firstResult === 0 like null
      [Translation] Refresh local translations if the provider has domains
      [HttpKernel] Fix SessionListener without session in request #46268
      [Notifier] Allow symfony/mercure 0.6 in Mercure bridge
    nicolas-grekas committed May 6, 2022
    Copy the full SHA
    0bf498f View commit details

Commits on May 8, 2022

  1. Copy the full SHA
    a1d5d31 View commit details

Commits on May 11, 2022

  1. Copy the full SHA
    7877d48 View commit details
  2. Copy the full SHA
    36940fe View commit details

Commits on May 13, 2022

  1. bug #46317 [Security/Http] Ignore invalid URLs found in failure/succe…

    …ss paths (nicolas-grekas)
    
    This PR was merged into the 4.4 branch.
    
    Discussion
    ----------
    
    [Security/Http] Ignore invalid URLs found in failure/success paths
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 4.4
    | Bug fix?      | yes
    | New feature?  | no
    | Deprecations? | no
    | Tickets       | Fix #43567
    | License       | MIT
    | Doc PR        | -
    
    Commits
    -------
    
    389df989b9 [Security/Http] Ignore invalid URLs found in failure/success paths
    fabpot committed May 13, 2022
    Copy the full SHA
    0af230c View commit details

Commits on May 14, 2022

  1. Merge branch '4.4' into 5.4

    * 4.4:
      [Console] Fixes "Incorrectly nested style tag found" error when using multi-line header content
      Fix LDAP connection options
      [Security/Http] Ignore invalid URLs found in failure/success paths
    nicolas-grekas committed May 14, 2022
    Copy the full SHA
    6e456f2 View commit details
  2. Merge branch '5.4' into 6.0

    * 5.4:
      [Console] Fixes "Incorrectly nested style tag found" error when using multi-line header content
      Fix LDAP connection options
      fix probably undefined variable $expireAt
      Fix aliases handling in command name completion
      Fix division by zero
      Allow ErrorHandler ^5.0 to be used in HttpKernel
      [Security/Http] Ignore invalid URLs found in failure/success paths
      Fix typo
    nicolas-grekas committed May 14, 2022
    Copy the full SHA
    94c5f8d View commit details
  3. Merge branch '6.0' into 6.1

    * 6.0:
      [Console] Fixes "Incorrectly nested style tag found" error when using multi-line header content
      Fix LDAP connection options
      fix probably undefined variable $expireAt
      Fix aliases handling in command name completion
      Fix division by zero
      Allow ErrorHandler ^5.0 to be used in HttpKernel
      [Security/Http] Ignore invalid URLs found in failure/success paths
      Fix typo
    nicolas-grekas committed May 14, 2022
    Copy the full SHA
    7350abf View commit details

Commits on May 31, 2022

  1. Copy the full SHA
    ddf4977 View commit details
  2. [Security] Fix some phpdoc

    chalasr committed May 31, 2022
    Copy the full SHA
    2ef9d3f View commit details

Commits on Jun 4, 2022

  1. Copy the full SHA
    07876c1 View commit details

Commits on Jun 6, 2022

  1. Merge branch '5.4' into 6.0

    * 5.4:
      [Console] Prevent PHP 8.1 str_replace deprec on null
      Improve DE translations for Form/Validator
      [Serializer] Fix ignore attribute in Xml files
      [Console] Escape % in command name & description from getDefault*()
      [WebProfilerBundle] Fix dark theme selected line highlight color & reuse css vars
      [Mime] Check that the path is a file in the DataPart::fromPath
      [Cache] do not pass null to strlen()
      [Mailer] Sort transports alphabetically
      [Security] Fix some phpdoc
      [Serializer] Get attributeContext after converting name
    derrabus committed Jun 6, 2022
    Copy the full SHA
    8531f00 View commit details
  2. Merge branch '6.0' into 6.1

    * 6.0:
      [Console] Prevent PHP 8.1 str_replace deprec on null
      Improve DE translations for Form/Validator
      [Serializer] Fix ignore attribute in Xml files
      [Console] Escape % in command name & description from getDefault*()
      [WebProfilerBundle] Fix dark theme selected line highlight color & reuse css vars
      [Mime] Check that the path is a file in the DataPart::fromPath
      [Cache] do not pass null to strlen()
      [Mailer] Sort transports alphabetically
      [Security] Fix some phpdoc
      [Serializer] Get attributeContext after converting name
    derrabus committed Jun 6, 2022
    Copy the full SHA
    ab05dd3 View commit details
  3. Merge branch '6.1' into 6.2

    * 6.1:
      [Console] Prevent PHP 8.1 str_replace deprec on null
      [HttpKernel] Fix BackedEnumValueResolver already resolved enum value
      Improve DE translations for Form/Validator
      [Serializer] Fix ignore attribute in Xml files
      [Console] Escape % in command name & description from getDefault*()
      [WebProfilerBundle] Fix dark theme selected line highlight color & reuse css vars
      [Runtime] List Fulgens as backer of version 6.1
      [HttpClient] List Prisma Media as backer of version 6.1
      [WebProfilerBundle] normalizer and encoder can be undefined in template
      [Mime] Check that the path is a file in the DataPart::fromPath
      [Cache] do not pass null to strlen()
      [HtmlSanitizer][FrameworkBundle] Fix calling `allowStaticElements` when setting `allow_all_static_elements: true`
      [Mailer] Sort transports alphabetically
      [Security] Fix some phpdoc
      [Serializer] Get attributeContext after converting name
    derrabus committed Jun 6, 2022
    Copy the full SHA
    17d9e6b View commit details

Commits on Jun 7, 2022

  1. feature #46584 [Security] Enforce maximum username length in UserBadg…

    …e (wouterj)
    
    This PR was merged into the 6.2 branch.
    
    Discussion
    ----------
    
    [Security] Enforce maximum username length in UserBadge
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 6.2
    | Bug fix?      | no
    | New feature?  | no
    | Deprecations? | no
    | Tickets       | -
    | License       | MIT
    | Doc PR        | -
    
    In 2016, a CVE release was made to harden all build-in authenticators for session storage flooding attacks: https://symfony.com/blog/cve-2016-4423-large-username-storage-in-session With the new security system, we can extend the hardening to all authenticators by enforcing the maximum user length in the `UserBadge`.
    
    I believe we can do this as a "bugfix" in 6.2 directly, based on this reasoning from the blog post: "To avoid any BC break, the limit is set to 4096 characters, which should be more than enough for normal usages." For full stability safety, I think it's better to not do this on 5.4.
    
    Commits
    -------
    
    cd8b2ff1ea [Security] Enforce maximum username length
    fabpot committed Jun 7, 2022
    Copy the full SHA
    e7dea9b View commit details
  2. fix merge

    chalasr committed Jun 7, 2022
    Copy the full SHA
    9cc76e1 View commit details
  3. Merge branch '6.0' into 6.1

    * 6.0:
      fix merge
    chalasr committed Jun 7, 2022
    Copy the full SHA
    a7dca91 View commit details
  4. Merge branch '6.1' into 6.2

    * 6.1:
      fix merge
    chalasr committed Jun 7, 2022
    Copy the full SHA
    e2b1e24 View commit details
  5. Copy the full SHA
    f9c5be0 View commit details

Commits on Jun 9, 2022

  1. Copy the full SHA
    5233694 View commit details

Commits on Jun 10, 2022

  1. [Security] Fix tests

    chalasr authored and nicolas-grekas committed Jun 10, 2022
    Copy the full SHA
    69c97a7 View commit details

Commits on Jun 26, 2022

  1. Fix double authentication via RememberMe resulting in wrong RememberM…

    …e cookie being set in client
    heiglandreas authored and fabpot committed Jun 26, 2022
    Copy the full SHA
    13239a0 View commit details
  2. Merge branch '5.4' into 6.0

    * 5.4:
      Fix double authentication via RememberMe resulting in wrong RememberMe cookie being set in client
      [Security] Fix legacy impersonation system
      Fix global state pollution between tests run with ApplicationTester
      µcs fix
      [Messenger] Do not log the message object itself
      [Intl] Fix the IntlDateFormatter::formatObject signature
    fabpot committed Jun 26, 2022
    Copy the full SHA
    f96a92d View commit details
  3. Merge branch '6.0' into 6.1

    * 6.0:
      Fix double authentication via RememberMe resulting in wrong RememberMe cookie being set in client
      [Security] Fix legacy impersonation system
      Fix global state pollution between tests run with ApplicationTester
      µcs fix
      [Messenger] Do not log the message object itself
      [Intl] Fix the IntlDateFormatter::formatObject signature
    fabpot committed Jun 26, 2022
    Copy the full SHA
    698de9a View commit details
  4. Merge branch '6.1' into 6.2

    * 6.1:
      Fix double authentication via RememberMe resulting in wrong RememberMe cookie being set in client
      [HtmlSanitizer] Fix default configuration
      Initially set user null.
      [Security] Fix legacy impersonation system
      Fix global state pollution between tests run with ApplicationTester
      µcs fix
      [Messenger] Do not log the message object itself
      [Intl] Fix the IntlDateFormatter::formatObject signature
    fabpot committed Jun 26, 2022
    Copy the full SHA
    1862237 View commit details

Commits on Jun 27, 2022

  1. Merge branch '6.1' into 6.2

    * 6.1:
      CS fixes
      Bump Symfony version to 6.1.3
      Update VERSION for 6.1.2
      Update CHANGELOG for 6.1.2
      Bump Symfony version to 6.0.11
      Update VERSION for 6.0.10
      Update CHANGELOG for 6.0.10
      Bump Symfony version to 5.4.11
      Update VERSION for 5.4.10
      Update CHANGELOG for 5.4.10
      Bump Symfony version to 4.4.44
      Update VERSION for 4.4.43
      Update CONTRIBUTORS for 4.4.43
      Update CHANGELOG for 4.4.43
    nicolas-grekas committed Jun 27, 2022
    Copy the full SHA
    82ad680 View commit details

Commits on Jul 11, 2022

  1. Copy the full SHA
    0e374fc View commit details
  2. Copy the full SHA
    fdbeb53 View commit details

Commits on Jul 12, 2022

  1. feature #46907 [Security] Add #[IsGranted()] (nicolas-grekas)

    This PR was merged into the 6.2 branch.
    
    Discussion
    ----------
    
    [Security] Add `#[IsGranted()]`
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 6.2
    | Bug fix?      | no
    | New feature?  | yes
    | Deprecations? | no
    | Tickets       | Part of #44705
    | License       | MIT
    | Doc PR        | -
    
    Extracted from #45415 (and modernized a lot).
    
    I did not implement the proposals from Stof to keep this first iteration simple. I'd appreciate help to improve the attribute in a follow up PR 🙏
    
    Commits
    -------
    
    bf8d75ed86 [Security] Add `#[IsGranted()]`
    nicolas-grekas committed Jul 12, 2022
    Copy the full SHA
    df47021 View commit details
  2. Copy the full SHA
    e6d1fa6 View commit details
  3. Copy the full SHA
    071fc45 View commit details

Commits on Jul 13, 2022

  1. Check for null instead of type

    ihmels authored and wouterj committed Jul 13, 2022
    Copy the full SHA
    1a2f814 View commit details

Commits on Jul 14, 2022

  1. Merge branch '5.4' into 6.0

    * 5.4:
      [Messenger] Fix calls to deprecated DBAL methods
      Check for null instead of type
    derrabus committed Jul 14, 2022
    Copy the full SHA
    753235a View commit details
  2. Merge branch '6.0' into 6.1

    * 6.0:
      [Messenger] Fix calls to deprecated DBAL methods
      Check for null instead of type
    derrabus committed Jul 14, 2022
    Copy the full SHA
    fe431e0 View commit details
Showing with 7,982 additions and 1,590 deletions.
  1. +1 −2 .gitattributes
  2. +8 −0 .github/PULL_REQUEST_TEMPLATE.md
  3. +20 −0 .github/workflows/close-pull-request.yml
  4. +1 −4 AccessMap.php
  5. +24 −0 AccessToken/AccessTokenExtractorInterface.php
  6. +29 −0 AccessToken/AccessTokenHandlerInterface.php
  7. +85 −0 AccessToken/Cas/Cas2Handler.php
  8. +41 −0 AccessToken/ChainAccessTokenExtractor.php
  9. +47 −0 AccessToken/FormEncodedBodyExtractor.php
  10. +49 −0 AccessToken/HeaderAccessTokenExtractor.php
  11. +100 −0 AccessToken/OAuth2/Oauth2TokenHandler.php
  12. +25 −0 AccessToken/Oidc/Exception/InvalidSignatureException.php
  13. +25 −0 AccessToken/Oidc/Exception/MissingClaimException.php
  14. +248 −0 AccessToken/Oidc/OidcTokenHandler.php
  15. +53 −0 AccessToken/Oidc/OidcTrait.php
  16. +93 −0 AccessToken/Oidc/OidcUserInfoTokenHandler.php
  17. +44 −0 AccessToken/QueryAccessTokenExtractor.php
  18. +12 −1 Attribute/CurrentUser.php
  19. +37 −0 Attribute/IsCsrfTokenValid.php
  20. +42 −0 Attribute/IsGranted.php
  21. +48 −0 Attribute/IsGrantedContext.php
  22. +1 −3 Authentication/AuthenticationFailureHandlerInterface.php
  23. +2 −4 Authentication/AuthenticationSuccessHandlerInterface.php
  24. +12 −14 Authentication/AuthenticationUtils.php
  25. +106 −42 Authentication/AuthenticatorManager.php
  26. +4 −8 Authentication/CustomAuthenticationFailureHandler.php
  27. +6 −9 Authentication/CustomAuthenticationSuccessHandler.php
  28. +27 −27 Authentication/DefaultAuthenticationFailureHandler.php
  29. +19 −14 Authentication/DefaultAuthenticationSuccessHandler.php
  30. +22 −0 Authentication/ExposeSecurityLevel.php
  31. +3 −2 Authentication/UserAuthenticatorInterface.php
  32. +4 −6 Authenticator/AbstractLoginFormAuthenticator.php
  33. +9 −15 Authenticator/AbstractPreAuthenticatedAuthenticator.php
  34. +123 −0 Authenticator/AccessTokenAuthenticator.php
  35. +34 −13 Authenticator/Debug/TraceableAuthenticator.php
  36. +30 −33 Authenticator/Debug/TraceableAuthenticatorManagerListener.php
  37. +32 −0 Authenticator/FallbackUserLoader.php
  38. +29 −22 Authenticator/FormLoginAuthenticator.php
  39. +10 −15 Authenticator/HttpBasicAuthenticator.php
  40. +3 −3 Authenticator/InteractiveAuthenticatorInterface.php
  41. +31 −35 Authenticator/JsonLoginAuthenticator.php
  42. +18 −23 Authenticator/LoginLinkAuthenticator.php
  43. +4 −6 Authenticator/Passport/Badge/CsrfTokenBadge.php
  44. +4 −4 Authenticator/Passport/Badge/PasswordUpgradeBadge.php
  45. +5 −0 Authenticator/Passport/Badge/RememberMeBadge.php
  46. +52 −20 Authenticator/Passport/Badge/UserBadge.php
  47. +7 −7 Authenticator/Passport/Credentials/CustomCredentials.php
  48. +2 −2 Authenticator/Passport/Credentials/PasswordCredentials.php
  49. +32 −6 Authenticator/Passport/Passport.php
  50. +30 −12 Authenticator/RememberMeAuthenticator.php
  51. +11 −12 Authenticator/RemoteUserAuthenticator.php
  52. +5 −19 Authenticator/Token/PostAuthenticationToken.php
  53. +12 −11 Authenticator/X509Authenticator.php
  54. +62 −0 CHANGELOG.md
  55. +50 −0 Controller/SecurityTokenValueResolver.php
  56. +22 −27 Controller/UserValueResolver.php
  57. +1 −3 EntryPoint/AuthenticationEntryPointInterface.php
  58. +3 −0 EntryPoint/Exception/NotAnEntryPointException.php
  59. +6 −9 Event/AuthenticationTokenCreatedEvent.php
  60. +6 −8 Event/CheckPassportEvent.php
  61. +4 −7 Event/InteractiveLoginEvent.php
  62. +4 −21 Event/LazyResponseEvent.php
  63. +11 −17 Event/LoginFailureEvent.php
  64. +16 −16 Event/LoginSuccessEvent.php
  65. +4 −6 Event/LogoutEvent.php
  66. +6 −10 Event/SwitchUserEvent.php
  67. +4 −7 Event/TokenDeauthenticatedEvent.php
  68. +4 −6 EventListener/CheckCredentialsListener.php
  69. +6 −6 EventListener/CheckRememberMeConditionsListener.php
  70. +49 −0 EventListener/ClearSiteDataLogoutListener.php
  71. +4 −6 EventListener/CookieClearingLogoutListener.php
  72. +3 −5 EventListener/CsrfProtectionListener.php
  73. +8 −5 EventListener/CsrfTokenClearingLogoutListener.php
  74. +4 −7 EventListener/DefaultLogoutListener.php
  75. +78 −0 EventListener/IsCsrfTokenValidAttributeListener.php
  76. +107 −0 EventListener/IsGrantedAttributeListener.php
  77. +32 −13 EventListener/LoginThrottlingListener.php
  78. +3 −5 EventListener/PasswordMigratingListener.php
  79. +5 −8 EventListener/RememberMeListener.php
  80. +13 −6 EventListener/SessionStrategyListener.php
  81. +4 −6 EventListener/UserCheckerListener.php
  82. +3 −5 EventListener/UserProviderListener.php
  83. +19 −9 Firewall.php
  84. +1 −1 Firewall/AbstractListener.php
  85. +22 −38 Firewall/AccessListener.php
  86. +3 −5 Firewall/AuthenticatorManagerListener.php
  87. +7 −12 Firewall/ChannelListener.php
  88. +49 −40 Firewall/ContextListener.php
  89. +20 −36 Firewall/ExceptionListener.php
  90. +1 −1 Firewall/FirewallListenerInterface.php
  91. +10 −18 Firewall/LogoutListener.php
  92. +29 −37 Firewall/SwitchUserListener.php
  93. +1 −4 FirewallMap.php
  94. +1 −1 FirewallMapInterface.php
  95. +25 −28 HttpUtils.php
  96. +31 −19 Impersonate/ImpersonateUrlGenerator.php
  97. +1 −1 LICENSE
  98. +0 −3 LoginLink/Exception/InvalidLoginLinkAuthenticationException.php
  99. +4 −7 LoginLink/LoginLinkDetails.php
  100. +27 −18 LoginLink/LoginLinkHandler.php
  101. +3 −1 LoginLink/LoginLinkHandlerInterface.php
  102. +9 −10 LoginLink/LoginLinkNotification.php
  103. +20 −15 Logout/LogoutUrlGenerator.php
  104. +10 −4 ParameterBagUtils.php
  105. +3 −3 README.md
  106. +21 −11 RateLimiter/DefaultLoginRateLimiter.php
  107. +10 −27 RememberMe/AbstractRememberMeHandler.php
  108. +51 −37 RememberMe/PersistentRememberMeHandler.php
  109. +14 −15 RememberMe/RememberMeDetails.php
  110. +1 −4 RememberMe/ResponseListener.php
  111. +21 −13 RememberMe/SignatureRememberMeHandler.php
  112. +24 −0 SecurityRequestAttributes.php
  113. +13 −10 Session/SessionAuthenticationStrategy.php
  114. +1 −1 Session/SessionAuthenticationStrategyInterface.php
  115. +123 −0 Tests/AccessToken/Cas/Cas2HandlerTest.php
  116. +52 −0 Tests/AccessToken/OAuth2/OAuth2TokenHandlerTest.php
  117. +195 −0 Tests/AccessToken/Oidc/OidcTokenHandlerTest.php
  118. +87 −0 Tests/AccessToken/Oidc/OidcUserInfoTokenHandlerTest.php
  119. +127 −0 Tests/Authentication/AuthenticationUtilsTest.php
  120. +488 −0 Tests/Authentication/AuthenticatorManagerBCTest.php
  121. +133 −51 Tests/Authentication/AuthenticatorManagerTest.php
  122. +65 −12 Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php
  123. +71 −6 Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php
  124. +1 −1 Tests/Authenticator/AbstractAuthenticatorTest.php
  125. +122 −0 Tests/Authenticator/AbstractLoginFormAuthenticatorTest.php
  126. +112 −0 Tests/Authenticator/AccessToken/ChainedAccessTokenExtractorsTest.php
  127. +127 −0 Tests/Authenticator/AccessToken/FormEncodedBodyAccessTokenAuthenticatorTest.php
  128. +151 −0 Tests/Authenticator/AccessToken/HeaderAccessTokenAuthenticatorTest.php
  129. +119 −0 Tests/Authenticator/AccessToken/QueryAccessTokenAuthenticatorTest.php
  130. +190 −0 Tests/Authenticator/AccessTokenAuthenticatorTest.php
  131. +23 −0 Tests/Authenticator/Debug/TraceableAuthenticatorTest.php
  132. +136 −21 Tests/Authenticator/FormLoginAuthenticatorTest.php
  133. +8 −9 Tests/Authenticator/HttpBasicAuthenticatorTest.php
  134. +47 −0 Tests/Authenticator/InMemoryAccessTokenHandler.php
  135. +21 −16 Tests/Authenticator/JsonLoginAuthenticatorTest.php
  136. +11 −8 Tests/Authenticator/LoginLinkAuthenticatorTest.php
  137. +72 −0 Tests/Authenticator/Passport/Badge/UserBadgeTest.php
  138. +21 −9 Tests/Authenticator/RememberMeAuthenticatorTest.php
  139. +2 −1 Tests/Authenticator/RemoteUserAuthenticatorTest.php
  140. +31 −2 Tests/Authenticator/X509AuthenticatorTest.php
  141. +105 −0 Tests/Controller/SecurityTokenValueResolverTest.php
  142. +13 −23 Tests/Controller/UserValueResolverTest.php
  143. +23 −21 Tests/EventListener/CheckCredentialsListenerTest.php
  144. +66 −14 Tests/EventListener/CheckRememberMeConditionsListenerTest.php
  145. +48 −0 Tests/EventListener/ClearSiteDataLogoutListenerTest.php
  146. +18 −1 Tests/EventListener/CookieClearingLogoutListenerTest.php
  147. +11 −8 Tests/EventListener/CsrfProtectionListenerTest.php
  148. +36 −0 Tests/EventListener/CsrfTokenClearingLogoutListenerTest.php
  149. +346 −0 Tests/EventListener/IsCsrfTokenValidAttributeListenerTest.php
  150. +458 −0 Tests/EventListener/IsGrantedAttributeListenerTest.php
  151. +374 −0 Tests/EventListener/IsGrantedAttributeWithClosureListenerTest.php
  152. +10 −13 Tests/EventListener/LoginThrottlingListenerTest.php
  153. +61 −17 Tests/EventListener/PasswordMigratingListenerTest.php
  154. +9 −10 Tests/EventListener/RememberMeListenerTest.php
  155. +48 −7 Tests/EventListener/SessionStrategyListenerTest.php
  156. +13 −11 Tests/EventListener/UserCheckerListenerTest.php
  157. +3 −3 Tests/EventListener/UserProviderListenerTest.php
  158. +7 −8 Tests/Firewall/AccessListenerTest.php
  159. +95 −44 Tests/Firewall/ContextListenerTest.php
  160. +22 −34 Tests/Firewall/ExceptionListenerTest.php
  161. +5 −4 Tests/Firewall/LogoutListenerTest.php
  162. +36 −30 Tests/Firewall/SwitchUserListenerTest.php
  163. +7 −7 Tests/FirewallMapTest.php
  164. +57 −0 Tests/FirewallTest.php
  165. +59 −0 Tests/Fixtures/CustomUser.php
  166. +49 −0 Tests/Fixtures/DummyAuthenticator.php
  167. +29 −0 Tests/Fixtures/DummySupportsAuthenticator.php
  168. +22 −0 Tests/Fixtures/IsCsrfTokenValidAttributeController.php
  169. +62 −0 Tests/Fixtures/IsCsrfTokenValidAttributeMethodsController.php
  170. +27 −0 Tests/Fixtures/IsGrantedAttributeController.php
  171. +80 −0 Tests/Fixtures/IsGrantedAttributeMethodsController.php
  172. +98 −0 Tests/Fixtures/IsGrantedAttributeMethodsWithClosureController.php
  173. +32 −0 Tests/Fixtures/IsGrantedAttributeWithClosureController.php
  174. +23 −0 Tests/Fixtures/NullUserToken.php
  175. +77 −11 Tests/HttpUtilsTest.php
  176. +134 −64 Tests/LoginLink/LoginLinkHandlerTest.php
  177. +20 −10 Tests/Logout/LogoutUrlGeneratorTest.php
  178. +107 −21 Tests/RememberMe/PersistentRememberMeHandlerTest.php
  179. +20 −39 Tests/RememberMe/SignatureRememberMeHandlerTest.php
  180. +17 −2 Tests/Session/SessionAuthenticationStrategyTest.php
  181. +2 −2 Util/TargetPathTrait.php
  182. +23 −18 composer.json
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/Tests export-ignore
/phpunit.xml.dist export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.git* export-ignore
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Please do not submit any Pull Requests here. They will be closed.
---

Please submit your PR here instead:
https://github.com/symfony/symfony

This repository is what we call a "subtree split": a read-only subset of that main repository.
We're looking forward to your PR there!
20 changes: 20 additions & 0 deletions .github/workflows/close-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Close Pull Request

on:
pull_request_target:
types: [opened]

jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: superbrothers/close-pull-request@v3
with:
comment: |
Thanks for your Pull Request! We love contributions.
However, you should instead open your PR on the main repository:
https://github.com/symfony/symfony
This repository is what we call a "subtree split": a read-only subset of that main repository.
We're looking forward to your PR there!
5 changes: 1 addition & 4 deletions AccessMap.php
Original file line number Diff line number Diff line change
@@ -28,14 +28,11 @@ class AccessMap implements AccessMapInterface
* @param array $attributes An array of attributes to pass to the access decision manager (like roles)
* @param string|null $channel The channel to enforce (http, https, or null)
*/
public function add(RequestMatcherInterface $requestMatcher, array $attributes = [], string $channel = null)
public function add(RequestMatcherInterface $requestMatcher, array $attributes = [], ?string $channel = null): void
{
$this->map[] = [$requestMatcher, $attributes, $channel];
}

/**
* {@inheritdoc}
*/
public function getPatterns(Request $request): array
{
foreach ($this->map as $elements) {
24 changes: 24 additions & 0 deletions AccessToken/AccessTokenExtractorInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Security\Http\AccessToken;

use Symfony\Component\HttpFoundation\Request;

/**
* The token extractor retrieves the token from a request.
*
* @author Florent Morselli <florent.morselli@spomky-labs.com>
*/
interface AccessTokenExtractorInterface
{
public function extractAccessToken(Request $request): ?string;
}
29 changes: 29 additions & 0 deletions AccessToken/AccessTokenHandlerInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Security\Http\AccessToken;

use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;

/**
* The token handler retrieves the user identifier from the token.
* In order to get the user identifier, implementations may need to load and validate the token (e.g. revocation, expiration time, digital signature...).
*
* @author Florent Morselli <florent.morselli@spomky-labs.com>
*/
interface AccessTokenHandlerInterface
{
/**
* @throws AuthenticationException
*/
public function getUserBadgeFrom(#[\SensitiveParameter] string $accessToken): UserBadge;
}
85 changes: 85 additions & 0 deletions AccessToken/Cas/Cas2Handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Security\Http\AccessToken\Cas;

use Symfony\Component\HttpClient\HttpClient;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Http\AccessToken\AccessTokenHandlerInterface;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Contracts\HttpClient\HttpClientInterface;

/**
* @see https://apereo.github.io/cas/6.6.x/protocol/CAS-Protocol-V2-Specification.html
*
* @author Nicolas Attard <contact@nicolasattard.fr>
*/
final class Cas2Handler implements AccessTokenHandlerInterface
{
public function __construct(
private readonly RequestStack $requestStack,
private readonly string $validationUrl,
private readonly string $prefix = 'cas',
private ?HttpClientInterface $client = null,
) {
if (null === $client) {
if (!class_exists(HttpClient::class)) {
throw new \LogicException(\sprintf('You cannot use "%s" as the HttpClient component is not installed. Try running "composer require symfony/http-client".', __CLASS__));
}

$this->client = HttpClient::create();
}
}

/**
* @throws AuthenticationException
*/
public function getUserBadgeFrom(string $accessToken): UserBadge
{
$response = $this->client->request('GET', $this->getValidationUrl($accessToken));

$xml = new \SimpleXMLElement($response->getContent(), 0, false, $this->prefix, true);

if (isset($xml->authenticationSuccess)) {
return new UserBadge((string) $xml->authenticationSuccess->user);
}

if (isset($xml->authenticationFailure)) {
throw new AuthenticationException('CAS Authentication Failure: '.trim((string) $xml->authenticationFailure));
}

throw new AuthenticationException('Invalid CAS response.');
}

private function getValidationUrl(string $accessToken): string
{
$request = $this->requestStack->getCurrentRequest();

if (null === $request) {
throw new \LogicException('Request should exist so it can be processed for error.');
}

$query = $request->query->all();

if (!isset($query['ticket'])) {
throw new AuthenticationException('No ticket found in request.');
}
unset($query['ticket']);
$queryString = $query ? '?'.http_build_query($query) : '';

return \sprintf('%s?ticket=%s&service=%s',
$this->validationUrl,
urlencode($accessToken),
urlencode($request->getSchemeAndHttpHost().$request->getBaseUrl().$request->getPathInfo().$queryString)
);
}
}
41 changes: 41 additions & 0 deletions AccessToken/ChainAccessTokenExtractor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Security\Http\AccessToken;

use Symfony\Component\HttpFoundation\Request;

/**
* The token extractor retrieves the token from a request.
*
* @author Florent Morselli <florent.morselli@spomky-labs.com>
*/
final class ChainAccessTokenExtractor implements AccessTokenExtractorInterface
{
/**
* @param AccessTokenExtractorInterface[] $accessTokenExtractors
*/
public function __construct(
private readonly iterable $accessTokenExtractors,
) {
}

public function extractAccessToken(Request $request): ?string
{
foreach ($this->accessTokenExtractors as $extractor) {
if ($accessToken = $extractor->extractAccessToken($request)) {
return $accessToken;
}
}

return null;
}
}
47 changes: 47 additions & 0 deletions AccessToken/FormEncodedBodyExtractor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Security\Http\AccessToken;

use Symfony\Component\HttpFoundation\Request;

/**
* Extracts a token from the body request.
*
* WARNING!
* Because of the security weaknesses associated with this method,
* the request body method SHOULD NOT be used except in application contexts
* where participating browsers do not have access to the "Authorization" request header field.
*
* @author Florent Morselli <florent.morselli@spomky-labs.com>
*
* @see https://datatracker.ietf.org/doc/html/rfc6750#section-2.2
*/
final class FormEncodedBodyExtractor implements AccessTokenExtractorInterface
{
public function __construct(
private readonly string $parameter = 'access_token',
) {
}

public function extractAccessToken(Request $request): ?string
{
if (
Request::METHOD_POST !== $request->getMethod()
|| !str_starts_with($request->headers->get('CONTENT_TYPE', ''), 'application/x-www-form-urlencoded')
) {
return null;
}
$parameter = $request->request->get($this->parameter);

return \is_string($parameter) ? $parameter : null;
}
}
49 changes: 49 additions & 0 deletions AccessToken/HeaderAccessTokenExtractor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Security\Http\AccessToken;

use Symfony\Component\HttpFoundation\Request;

/**
* Extracts a token from the request header.
*
* @author Florent Morselli <florent.morselli@spomky-labs.com>
*
* @see https://datatracker.ietf.org/doc/html/rfc6750#section-2.1
*/
final class HeaderAccessTokenExtractor implements AccessTokenExtractorInterface
{
private string $regex;

public function __construct(
private readonly string $headerParameter = 'Authorization',
private readonly string $tokenType = 'Bearer',
) {
$this->regex = \sprintf(
'/^%s([a-zA-Z0-9\-_\+~\/\.]+=*)$/',
'' === $this->tokenType ? '' : preg_quote($this->tokenType).'\s+'
);
}

public function extractAccessToken(Request $request): ?string
{
if (!$request->headers->has($this->headerParameter) || !\is_string($header = $request->headers->get($this->headerParameter))) {
return null;
}

if (preg_match($this->regex, $header, $matches)) {
return $matches[1];
}

return null;
}
}
Loading