Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Authentication middleware should NOT interfere with Authorization #234

@montella1507

Description

@montella1507

Hi,

Slim-jwt-auth is "Authentication middleware":
This middleware implements JSON Web Token Authentication.

Authentication should:

  • parse and validate token if found
  • add identity of the user to Request (if the token is valid and found)

Authentication SHOULD NOT:

  • prevent any action
  • return 401
  • disallow going to any route

Because it's part of the process which should be handled by AUTHORIZATION middleware.

slim-jwt-auth is authentication middleware , there are several good reasons, why you should not interchange / mix these two terms.

Please do not provide any "authorization" / denial service inside Authentication middleware, it is wrong place to do that and you usually want to sort your middlewares in this way:

...

  • Authentication (parse and validate identity)
  • Routing
  • Authorization

Authentication / Authentication should be split to 2 middlewares and named correctly.

Preventing routes in "authentication" middleware is wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions