Skip to content

[Bug] Avoid IHttpContextAccessor as much as possible.Β #248

Closed

Description

Which Version of Microsoft Identity Web are you using ?
Microsoft Identity Web 0.1.5-preview

Repro
Avoid IHttpContextAccessor as much as possible:

  • It gives a false sense of security. Everywhere where we can access the HttpContext directly we should do so. It’s not obvious in the multi-threaded methods that they use the HttpContext (which is not thread safe). Hiding that we use it leads to unsafe use.
  • A lot of time, the HttpContext is passed to access one field. There is a balance between the simple developer experience and
    the safety. Secretly accessing the HttpContext is not on the right side of the balance. For instance:
    ReplyForbiddenWithWwwAuthenticateHeader should pass in the HttpContext rather than relying on the accessor, it's called directly from a controller anyways (See TokenAcquisition.cs#L506)

requires more spec.

Activity

  1. jmprieur commented on Jun 26, 2020

    @jmprieur
    CollaboratorAuthor

    jennyf19 : the work you've been doing on adding suggested cache key in the TokenSerializationArgs will remove a lot of this work

  2. jmprieur commented on Jun 30, 2020

    @jmprieur
    CollaboratorAuthor

    Blocked until we have the cacheKey for the token cache providers.

  3. self-assigned this
    on Jul 1, 2020
  4. jmprieur commented on Jul 13, 2020

    @jmprieur
    CollaboratorAuthor

    Verified we've removed all what we could.

  5. jennyf19 commented on Jul 13, 2020

    @jennyf19
    Collaborator
  6. added a commit that references this issue on Jul 15, 2020
  7. added a commit that references this issue on Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions