Skip to content

Conversation

peombwa
Copy link
Member

@peombwa peombwa commented Mar 10, 2023

This PR fixes #1816 by replacing System.IdentityModel.Tokens.Jwt library with an internal JWT decoder as per https://tools.ietf.org/html/rfc7519.

@peombwa peombwa self-assigned this Mar 10, 2023
@peombwa peombwa marked this pull request as ready for review March 10, 2023 23:08
@peombwa peombwa marked this pull request as draft March 10, 2023 23:20
@peombwa peombwa marked this pull request as ready for review March 11, 2023 00:53
{
// Arrange
string accessToken = "ACCESS_TOKEN_VIA_DELEGATE_PROVIDER";
string accessToken = "eyJhbGciOiJIUzI1NiJ9.eyJSb2xlIjoiVGVzdCIsIklzc3VlciI6Iklzc3VlciIsIlVzZXJuYW1lIjoiVGVzdCIsImV4cCI6MTY3ODQ4ODgxNiwiaWF0IjoxNjc4NDg4ODE2fQ.hpYypwHAV8H3jb4KuTiLpgLWy9A8H2d9HG7SxJ8Kpn0";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peombwa Why do we have a hard coded token?

Copy link
Member Author

@peombwa peombwa Mar 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timayabi2020, this is a dummy access token for running the test. Here is the jwt.ms output:

{
  "alg": "HS256"
}.{
  "Role": "Test",
  "Issuer": "Issuer",
  "Username": "Test",
  "exp": 1678488816,
  "iat": 1678488816
}.[Signature]

As part of this PR, Connect-MgGraph will now validate the structure of the JWT to determine if it can be decoded as per https://tools.ietf.org/html/rfc7519.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants