Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Rewrite JwtBearer TokenValidation Test #640

Closed
JunTaoLuo opened this issue Jan 4, 2016 · 1 comment
Closed

Rewrite JwtBearer TokenValidation Test #640

JunTaoLuo opened this issue Jan 4, 2016 · 1 comment
Assignees
Labels
3 - Done cost: XS Will take about half a day to complete task
Milestone

Comments

@JunTaoLuo
Copy link
Contributor

JunTaoLuo commented Jan 4, 2016

Currently the test is using a token generated on AAD which means that the token will expire every 60 days (or some set interval). For this unit test, we should use a statically generated token that does not expire and not depend on an external authentication authority.

[ConditionalFact(Skip = "Need to remove dependency on AAD since the generated tokens will expire")]
[FrameworkSkipCondition(RuntimeFrameworks.Mono)]
// https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/issues/179
public async Task BearerTokenValidation()
{
var server = CreateServer(o =>
{
o.Authority = "https://login.windows.net/tushartest.onmicrosoft.com";
o.Audience = "https://TusharTest.onmicrosoft.com/TodoListService-ManualJwt";
o.TokenValidationParameters.ValidateLifetime = false;
});
var newBearerToken = "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6ImtyaU1QZG1Cdng2OHNrVDgtbVBBQjNCc2VlQSJ9.eyJhdWQiOiJodHRwczovL1R1c2hhclRlc3Qub25taWNyb3NvZnQuY29tL1RvZG9MaXN0U2VydmljZS1NYW51YWxKd3QiLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC9hZmJlY2UwMy1hZWFhLTRmM2YtODVlNy1jZTA4ZGQyMGNlNTAvIiwiaWF0IjoxNDE4MzMwNjE0LCJuYmYiOjE0MTgzMzA2MTQsImV4cCI6MTQxODMzNDUxNCwidmVyIjoiMS4wIiwidGlkIjoiYWZiZWNlMDMtYWVhYS00ZjNmLTg1ZTctY2UwOGRkMjBjZTUwIiwiYW1yIjpbInB3ZCJdLCJvaWQiOiI1Mzk3OTdjMi00MDE5LTQ2NTktOWRiNS03MmM0Yzc3NzhhMzMiLCJ1cG4iOiJWaWN0b3JAVHVzaGFyVGVzdC5vbm1pY3Jvc29mdC5jb20iLCJ1bmlxdWVfbmFtZSI6IlZpY3RvckBUdXNoYXJUZXN0Lm9ubWljcm9zb2Z0LmNvbSIsInN1YiI6IkQyMm9aMW9VTzEzTUFiQXZrdnFyd2REVE80WXZJdjlzMV9GNWlVOVUwYnciLCJmYW1pbHlfbmFtZSI6Ikd1cHRhIiwiZ2l2ZW5fbmFtZSI6IlZpY3RvciIsImFwcGlkIjoiNjEzYjVhZjgtZjJjMy00MWI2LWExZGMtNDE2Yzk3ODAzMGI3IiwiYXBwaWRhY3IiOiIwIiwic2NwIjoidXNlcl9pbXBlcnNvbmF0aW9uIiwiYWNyIjoiMSJ9.N_Kw1EhoVGrHbE6hOcm7ERdZ7paBQiNdObvp2c6T6n5CE8p0fZqmUd-ya_EqwElcD6SiKSiP7gj0gpNUnOJcBl_H2X8GseaeeMxBrZdsnDL8qecc6_ygHruwlPltnLTdka67s1Ow4fDSHaqhVTEk6lzGmNEcbNAyb0CxQxU6o7Fh0yHRiWoLsT8yqYk8nKzsHXfZBNby4aRo3_hXaa4i0SZLYfDGGYPdttG4vT_u54QGGd4Wzbonv2gjDlllOVGOwoJS6kfl1h8mk0qxdiIaT_ChbDWgkWvTB7bTvBE-EgHgV0XmAo0WtJeSxgjsG3KhhEPsONmqrSjhIUV4IVnF2w";
var response = await SendAsync(server, "http://example.com/oauth", newBearerToken);
Assert.Equal(HttpStatusCode.OK, response.Response.StatusCode);
}

@Eilon
Copy link
Member

Eilon commented Jan 14, 2016

Ideally we would mock away this logic and rewrite the test to avoid these stricter checks.

@Eilon Eilon modified the milestones: Backlog, 2.1.0-rc1 Mar 29, 2018
@Eilon Eilon modified the milestones: 2.1.0-rc1, 2.1.0-mq Apr 6, 2018
Tratcher added a commit that referenced this issue May 16, 2018
@Tratcher Tratcher added 2 - Working cost: XS Will take about half a day to complete and removed 1 - Ready labels May 16, 2018
HaoK pushed a commit that referenced this issue Jul 11, 2018
Tratcher added a commit that referenced this issue Jul 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3 - Done cost: XS Will take about half a day to complete task
Projects
None yet
Development

No branches or pull requests

3 participants